deepin(go-package): don't use replaceAll

This commit is contained in:
rewine 2023-04-12 11:25:22 +08:00
parent ef5caa6748
commit 136e1d9aa3
No known key found for this signature in database
GPG Key ID: AABB329787290824
3 changed files with 21 additions and 21 deletions

View File

@ -3,15 +3,6 @@ let
packages = self: packages = self:
let let
inherit (self) callPackage; inherit (self) callPackage;
replaceAll = x: y: ''
echo Replacing "${x}" to "${y}":
for file in $(grep -rl "${x}"); do
echo -- $file
substituteInPlace $file \
--replace "${x}" "${y}"
done
'';
in { in {
#### LIBRARIES #### LIBRARIES
dtkcommon = callPackage ./library/dtkcommon { }; dtkcommon = callPackage ./library/dtkcommon { };
@ -62,10 +53,10 @@ let
deepin-voice-note = callPackage ./apps/deepin-voice-note { }; deepin-voice-note = callPackage ./apps/deepin-voice-note { };
#### Go Packages #### Go Packages
go-lib = callPackage ./go-package/go-lib { inherit replaceAll; }; go-lib = callPackage ./go-package/go-lib { };
go-gir-generator = callPackage ./go-package/go-gir-generator { }; go-gir-generator = callPackage ./go-package/go-gir-generator { };
go-dbus-factory = callPackage ./go-package/go-dbus-factory { }; go-dbus-factory = callPackage ./go-package/go-dbus-factory { };
dde-api = callPackage ./go-package/dde-api { inherit replaceAll; }; dde-api = callPackage ./go-package/dde-api { };
dde-daemon = callPackage ./go-package/dde-daemon { }; dde-daemon = callPackage ./go-package/dde-daemon { };
deepin-pw-check = callPackage ./go-package/deepin-pw-check { }; deepin-pw-check = callPackage ./go-package/deepin-pw-check { };
deepin-desktop-schemas = callPackage ./go-package/deepin-desktop-schemas { }; deepin-desktop-schemas = callPackage ./go-package/deepin-desktop-schemas { };

View File

@ -2,7 +2,6 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, buildGoPackage , buildGoPackage
, replaceAll
, wrapQtAppsHook , wrapQtAppsHook
, wrapGAppsHook , wrapGAppsHook
, gtk3 , gtk3
@ -38,16 +37,29 @@ buildGoPackage rec {
patches = [ ./0001-fix-PATH-for-NixOS.patch ]; patches = [ ./0001-fix-PATH-for-NixOS.patch ];
postPatch = replaceAll "/usr/lib/deepin-api" "/run/current-system/sw/lib/deepin-api" postPatch = ''
+ replaceAll "/usr/share/i18n/language_info.json" "${deepin-desktop-base}/share/i18n/language_info.json" substituteInPlace lang_info/lang_info.go \
+ replaceAll "/usr/bin/dbus-send" "${dbus}/bin/dbus-send" --replace "/usr/share/i18n/language_info.json" "${deepin-desktop-base}/share/i18n/language_info.json"
+ replaceAll "/usr/bin/true" "${coreutils}/bin/true"
+ replaceAll "/usr/sbin/alsactl" "alsactl" substituteInPlace misc/systemd/system/deepin-shutdown-sound.service \
+ '' --replace "/usr/bin/true" "${coreutils}/bin/true"
substituteInPlace sound-theme-player/main.go \
--replace "/usr/sbin/alsactl" "alsactl"
substituteInPlace misc/scripts/deepin-boot-sound.sh
--replace "/usr/bin/dbus-send" "${dbus}/bin/dbus-send"
substituteInPlace lunar-calendar/huangli.go adjust-grub-theme/main.go \ substituteInPlace lunar-calendar/huangli.go adjust-grub-theme/main.go \
--replace "/usr/share/dde-api" "$out/share/dde-api" --replace "/usr/share/dde-api" "$out/share/dde-api"
substituteInPlace themes/{theme.go,settings.go} \ substituteInPlace themes/{theme.go,settings.go} \
--replace "/usr/share" "/run/current-system/sw/share" --replace "/usr/share" "/run/current-system/sw/share"
for file in $(grep "/usr/lib/deepin-api" * -nR |awk -F: '{print $1}')
do
sed -i 's|/usr/lib/deepin-api|/run/current-system/sw/lib/deepin-api|g' $file
done
''; '';
goDeps = ./deps.nix; goDeps = ./deps.nix;

View File

@ -2,7 +2,6 @@
, lib , lib
, fetchFromGitHub , fetchFromGitHub
, fetchpatch , fetchpatch
, replaceAll
, runtimeShell , runtimeShell
}: }:
@ -25,8 +24,6 @@ stdenv.mkDerivation rec {
}) })
]; ];
postPatch = replaceAll "/bin/sh" "${runtimeShell}";
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/share/gocode/src/github.com/linuxdeepin/go-lib mkdir -p $out/share/gocode/src/github.com/linuxdeepin/go-lib