From e739993feadb32f641e22e1d9848a7521eb75dc9 Mon Sep 17 00:00:00 2001 From: quantenzitrone Date: Sun, 5 Jul 2026 04:34:58 +0200 Subject: [PATCH] storebackup: enable strictDeps, split phases the result only changes in the outpath (creating diff in all wrapped binaries) and in some of the shebangs due to relying on patchShebangs instead of manually patching them with sed --- pkgs/by-name/st/storebackup/package.nix | 40 ++++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/pkgs/by-name/st/storebackup/package.nix b/pkgs/by-name/st/storebackup/package.nix index 025b26f581a4..19f5dcb61ed2 100644 --- a/pkgs/by-name/st/storebackup/package.nix +++ b/pkgs/by-name/st/storebackup/package.nix @@ -9,6 +9,7 @@ diffutils, writeScriptBin, bzip2, + runtimeShellPackage, }: # quick usage: @@ -22,6 +23,8 @@ let dummyMount = writeScriptBin "mount" "#!${stdenv.shell}"; + + perl' = perl.withPackages (p: [ p.DBFile ]); in stdenv.mkDerivation (finalAttrs: { @@ -31,8 +34,18 @@ stdenv.mkDerivation (finalAttrs: { __structuredAttrs = true; enableParallelBuilding = true; + strictDeps = true; nativeBuildInputs = [ makeWrapper ]; - buildInputs = [ perl ]; + nativeInstallCheckInputs = [ + diffutils + perl' + ]; + buildInputs = [ + perl' + which + bzip2 + runtimeShellPackage + ]; src = fetchurl { url = "mirror://savannah/storebackup/storeBackup-${finalAttrs.version}.tar.bz2"; @@ -45,15 +58,20 @@ stdenv.mkDerivation (finalAttrs: { ]; installPhase = '' + runHook preInstall + mkdir -p $out/scripts mv * $out mv $out/_ATTENTION_ $out/doc mv $out/{correct.sh,cron-storebackup} $out/scripts - find $out -name "*.pl" | xargs sed -i \ - -e 's@/bin/pwd@${coreutils}/bin/pwd@' \ - -e 's@/bin/sync@${coreutils}/bin/sync@' \ - -e '1 s@/usr/bin/env perl@${perl.withPackages (p: [ p.DBFile ])}/bin/perl@' + runHook postInstall + ''; + + preFixup = '' + find $out -name "*.pl" -print0 | xargs --null sed -i \ + -e 's@/bin/pwd@${coreutils}/bin/pwd@g' \ + -e 's@/bin/sync@${coreutils}/bin/sync@g' for p in $out/bin/* do wrapProgram "$p" --prefix PATH ":" "${ @@ -63,8 +81,12 @@ stdenv.mkDerivation (finalAttrs: { ] }" done + ''; + + doInstallCheck = true; + installCheckPhase = '' + runHook preInstallCheck - patchShebangs $out # do a dummy test ensuring this works PATH=$PATH:${dummyMount}/bin @@ -84,7 +106,7 @@ stdenv.mkDerivation (finalAttrs: { $out/bin/storeBackup.pl --sourceDir "$source" --backupDir backup latestBackup=backup/default/$(ls -1 backup/default | sort | tail -n 1) $out/bin/storeBackupRecover.pl -b "$latestBackup" -t restored -r / - ${diffutils}/bin/diff -r "$source" restored + diff -r "$source" restored # storeBackupCheckSource should return 0 $out/bin/storeBackupCheckSource.pl -s "$source" -b "$latestBackup" @@ -98,7 +120,7 @@ stdenv.mkDerivation (finalAttrs: { rm -fr restored } - testDir=$TMP/testDir + testDir=$HOME/testDir mkdir $testDir echo X > $testDir/X @@ -120,6 +142,8 @@ stdenv.mkDerivation (finalAttrs: { backupRestore 'test 3: backup, restore' $out backupRestore 'test 4: backup diffutils to same backup locations, restore' ${diffutils} } + + runHook postInstallCheck ''; meta = {