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:
let
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 {
#### LIBRARIES
dtkcommon = callPackage ./library/dtkcommon { };
@ -62,10 +53,10 @@ let
deepin-voice-note = callPackage ./apps/deepin-voice-note { };
#### 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-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 { };
deepin-pw-check = callPackage ./go-package/deepin-pw-check { };
deepin-desktop-schemas = callPackage ./go-package/deepin-desktop-schemas { };

View File

@ -2,7 +2,6 @@
, lib
, fetchFromGitHub
, buildGoPackage
, replaceAll
, wrapQtAppsHook
, wrapGAppsHook
, gtk3
@ -38,16 +37,29 @@ buildGoPackage rec {
patches = [ ./0001-fix-PATH-for-NixOS.patch ];
postPatch = replaceAll "/usr/lib/deepin-api" "/run/current-system/sw/lib/deepin-api"
+ replaceAll "/usr/share/i18n/language_info.json" "${deepin-desktop-base}/share/i18n/language_info.json"
+ replaceAll "/usr/bin/dbus-send" "${dbus}/bin/dbus-send"
+ replaceAll "/usr/bin/true" "${coreutils}/bin/true"
+ replaceAll "/usr/sbin/alsactl" "alsactl"
+ ''
postPatch = ''
substituteInPlace lang_info/lang_info.go \
--replace "/usr/share/i18n/language_info.json" "${deepin-desktop-base}/share/i18n/language_info.json"
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 \
--replace "/usr/share/dde-api" "$out/share/dde-api"
substituteInPlace themes/{theme.go,settings.go} \
--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;

View File

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