From 4ddb0b4b677fd55acab809b2559a722f5b33a517 Mon Sep 17 00:00:00 2001 From: Alois Wohlschlager Date: Sun, 19 Nov 2023 14:35:04 +0100 Subject: [PATCH] polkit: remove rsync build dependency It the polkit post-install, the files that are supposed to live under /etc and /run/current-system/sw/share have to be merged into the package at the correct location. Previously, rsync was used for this job. By being a bit careful about the ordering, it is possible to use plain mv instead. The main advantage is that the number of transitive reverse dependencies of rsync is reduced significantly, so rsync changes will no longer need to go through staging. --- pkgs/development/libraries/polkit/default.nix | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix index 80badcdd4dbd..dabba056b487 100644 --- a/pkgs/development/libraries/polkit/default.nix +++ b/pkgs/development/libraries/polkit/default.nix @@ -9,7 +9,6 @@ , mesonEmulatorHook , ninja , perl -, rsync , python3 , fetchpatch , gettext @@ -72,7 +71,6 @@ stdenv.mkDerivation rec { meson ninja perl - rsync # man pages libxslt @@ -131,7 +129,7 @@ stdenv.mkDerivation rec { # at install time but Meson does not support this # so we need to convince it to install all files to a temporary # location using DESTDIR and then move it to proper one in postInstall. - DESTDIR = "${placeholder "out"}/dest"; + env.DESTDIR = "dest"; inherit doCheck; @@ -165,19 +163,15 @@ stdenv.mkDerivation rec { postInstall = '' # Move stuff from DESTDIR to proper location. - # We use rsync to merge the directories. - rsync --archive "${DESTDIR}/etc" "$out" - rm --recursive "${DESTDIR}/etc" - rsync --archive "${DESTDIR}${system}"/* "$out" - rm --recursive "${DESTDIR}${system}"/* - rmdir --parents --ignore-fail-on-non-empty "${DESTDIR}${system}" + # We need to be careful with the ordering to merge without conflicts. for o in $(getAllOutputNames); do - rsync --archive "${DESTDIR}/''${!o}" "$(dirname "''${!o}")" - rm --recursive "${DESTDIR}/''${!o}" + mv "$DESTDIR/''${!o}" "''${!o}" done - # Ensure the DESTDIR is removed. - destdirContainer="$(dirname "${DESTDIR}")" - pushd "$destdirContainer"; rmdir --parents "''${DESTDIR##$destdirContainer/}${builtins.storeDir}"; popd + mv "$DESTDIR/etc" "$out" + mv "$DESTDIR${system}/share"/* "$out/share" + # Ensure we did not forget to install anything. + rmdir --parents --ignore-fail-on-non-empty "$DESTDIR${builtins.storeDir}" "$DESTDIR${system}/share" + ! test -e "$DESTDIR" ''; meta = with lib; {