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.
This commit is contained in:
Alois Wohlschlager 2023-11-19 14:35:04 +01:00
parent 029b2256e2
commit 4ddb0b4b67
No known key found for this signature in database
GPG key ID: E0F59EA5E5216914

View file

@ -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; {