From 136e1d9aa368f72bf8390eef3384fbdaf37dea04 Mon Sep 17 00:00:00 2001 From: rewine Date: Wed, 12 Apr 2023 11:25:22 +0800 Subject: [PATCH] deepin(go-package): don't use replaceAll --- pkgs/desktops/deepin/default.nix | 13 ++-------- .../deepin/go-package/dde-api/default.nix | 26 ++++++++++++++----- .../deepin/go-package/go-lib/default.nix | 3 --- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pkgs/desktops/deepin/default.nix b/pkgs/desktops/deepin/default.nix index e48d88f962f3..aa0c50f0a88c 100644 --- a/pkgs/desktops/deepin/default.nix +++ b/pkgs/desktops/deepin/default.nix @@ -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 { }; diff --git a/pkgs/desktops/deepin/go-package/dde-api/default.nix b/pkgs/desktops/deepin/go-package/dde-api/default.nix index 3f38a599a25d..9643ee35dc8b 100644 --- a/pkgs/desktops/deepin/go-package/dde-api/default.nix +++ b/pkgs/desktops/deepin/go-package/dde-api/default.nix @@ -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; diff --git a/pkgs/desktops/deepin/go-package/go-lib/default.nix b/pkgs/desktops/deepin/go-package/go-lib/default.nix index 706ff58ebfbe..751cba56ce35 100644 --- a/pkgs/desktops/deepin/go-package/go-lib/default.nix +++ b/pkgs/desktops/deepin/go-package/go-lib/default.nix @@ -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