lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

dpkg: fix build on case-insensitive file systems; add install check

+41 -19
+41 -19
pkgs/by-name/dp/dpkg/package.nix
··· 14 14 autoreconfHook, 15 15 pkg-config, 16 16 diffutils, 17 + versionCheckHook, 17 18 glibc ? !stdenv.hostPlatform.isDarwin, 18 19 }: 19 20 20 - stdenv.mkDerivation rec { 21 + stdenv.mkDerivation (finalAttrs: { 21 22 pname = "dpkg"; 22 23 version = "1.22.21"; 23 24 24 25 src = fetchgit { 25 26 url = "https://git.launchpad.net/ubuntu/+source/dpkg"; 26 - rev = "applied/${version}"; 27 - hash = "sha256-UiXZfwvgsgyXR6olNzKelt/3Fgtp7KU8UbTRRkDl8wY="; 27 + tag = "applied/${finalAttrs.version}"; 28 + leaveDotGit = true; 29 + # Fix filename conflict on case-insensitive filesystems 30 + postFetch = '' 31 + pushd $out 32 + git checkout HEAD -- scripts/t/Dpkg_BuildTree.t 33 + mv scripts/t/Dpkg_BuildTree.t scripts/t/Dpkg_BuildTreeC.t 34 + substituteInPlace scripts/Makefile.am --replace-fail t/Dpkg_BuildTree.t t/Dpkg_BuildTreeC.t 35 + substituteInPlace scripts/Makefile.in --replace-fail t/Dpkg_BuildTree.t t/Dpkg_BuildTreeC.t 36 + git checkout HEAD -- scripts/t/dpkg_buildtree.t 37 + rm -rf .git 38 + popd 39 + ''; 40 + hash = "sha256-LK6nOPewjRyKyHdwJgmLILoZ6sEfJzRtC7pIeWz01lA="; 28 41 }; 29 42 30 43 configureFlags = [ ··· 48 61 PATH=$TMPDIR:$PATH 49 62 50 63 for i in $(find . -name Makefile.in); do 51 - substituteInPlace $i --replace "install-data-local:" "disabled:" ; 64 + substituteInPlace $i --replace-quiet "install-data-local:" "disabled:" ; 52 65 done 53 66 54 67 # Skip check broken when cross-compiling. ··· 61 74 62 75 # Dpkg commands sometimes calls out to shell commands 63 76 substituteInPlace lib/dpkg/dpkg.h \ 64 - --replace '"dpkg-deb"' \"$out/bin/dpkg-deb\" \ 65 - --replace '"dpkg-split"' \"$out/bin/dpkg-split\" \ 66 - --replace '"dpkg-query"' \"$out/bin/dpkg-query\" \ 67 - --replace '"dpkg-divert"' \"$out/bin/dpkg-divert\" \ 68 - --replace '"dpkg-statoverride"' \"$out/bin/dpkg-statoverride\" \ 69 - --replace '"dpkg-trigger"' \"$out/bin/dpkg-trigger\" \ 70 - --replace '"dpkg"' \"$out/bin/dpkg\" \ 71 - --replace '"debsig-verify"' \"$out/bin/debsig-verify\" \ 72 - --replace '"rm"' \"${coreutils}/bin/rm\" \ 73 - --replace '"cat"' \"${coreutils}/bin/cat\" \ 74 - --replace '"diff"' \"${diffutils}/bin/diff\" 77 + --replace-fail '"dpkg-deb"' \"$out/bin/dpkg-deb\" \ 78 + --replace-fail '"dpkg-split"' \"$out/bin/dpkg-split\" \ 79 + --replace-fail '"dpkg-query"' \"$out/bin/dpkg-query\" \ 80 + --replace-fail '"dpkg-divert"' \"$out/bin/dpkg-divert\" \ 81 + --replace-fail '"dpkg-statoverride"' \"$out/bin/dpkg-statoverride\" \ 82 + --replace-fail '"dpkg-trigger"' \"$out/bin/dpkg-trigger\" \ 83 + --replace-fail '"dpkg"' \"$out/bin/dpkg\" \ 84 + --replace-fail '"debsig-verify"' \"$out/bin/debsig-verify\" \ 85 + --replace-fail '"rm"' \"${coreutils}/bin/rm\" \ 86 + --replace-fail '"cat"' \"${coreutils}/bin/cat\" \ 87 + --replace-fail '"diff"' \"${diffutils}/bin/diff\" 88 + '' 89 + + lib.optionalString stdenv.hostPlatform.isDarwin '' 90 + # realpath("/var/lib/dpkg", NULL) gives EPERM on sandboxed darwin instead of the expected ENOENT, 91 + # which makes some tests fail. 92 + sed -i '/opts normalize/a AT_SKIP_IF([true])' src/at/chdir.at 75 93 '' 76 94 + lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 77 95 substituteInPlace src/main/help.c \ 78 - --replace '"ldconfig"' \"${glibc.bin}/bin/ldconfig\" 96 + --replace-fail '"ldconfig"' \"${glibc.bin}/bin/ldconfig\" 79 97 ''; 80 98 81 99 buildInputs = [ ··· 96 114 postInstall = '' 97 115 for i in $out/bin/*; do 98 116 if head -n 1 $i | grep -q perl; then 99 - substituteInPlace $i --replace \ 117 + substituteInPlace $i --replace-fail \ 100 118 "${perl}/bin/perl" "${perl}/bin/perl -I $out/${perl.libPrefix}" 101 119 fi 102 120 done ··· 105 123 cp -r scripts/t/origins $out/etc/dpkg 106 124 ''; 107 125 126 + doInstallCheck = true; 127 + nativeInstallCheckInputs = [ versionCheckHook ]; 128 + versionCheckProgramArg = "--version"; 129 + 108 130 setupHook = ./setup-hook.sh; 109 131 110 132 meta = with lib; { ··· 112 134 homepage = "https://wiki.debian.org/Teams/Dpkg"; 113 135 license = licenses.gpl2Plus; 114 136 platforms = platforms.unix; 115 - broken = stdenv.hostPlatform.isDarwin; 116 137 maintainers = with maintainers; [ siriobalmelli ]; 138 + mainProgram = "dpkg"; 117 139 }; 118 - } 140 + })