diff options
author | AndersonTorres <torres.anderson.85@protonmail.com> | 2022-12-19 15:01:10 -0300 |
---|---|---|
committer | AndersonTorres <torres.anderson.85@protonmail.com> | 2022-12-19 22:39:10 -0300 |
commit | 7b9adf4dee7614a0621758819d2db601bf853bc1 (patch) | |
tree | 8926b6586562e8494882006988e5a242dad1ab0f | |
parent | 560c014f31216245830789ee7dfd3ca41bb5eca3 (diff) | |
download | nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar.gz nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar.bz2 nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar.lz nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar.xz nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.tar.zst nixpkgs-7b9adf4dee7614a0621758819d2db601bf853bc1.zip |
libarchive: refactor
- Remove "override" references on all-packages.nix - use finalAttrs style to get rid of rec - refactor postPatch to use Nix code instead of shell script
-rw-r--r-- | pkgs/development/libraries/libarchive/default.nix | 50 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 4 |
2 files changed, 28 insertions, 26 deletions
diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix index c7e9f117f94..381689f9cb6 100644 --- a/pkgs/development/libraries/libarchive/default.nix +++ b/pkgs/development/libraries/libarchive/default.nix @@ -22,43 +22,47 @@ , cmake , nix , samba +, buildPackages }: +let + autoreconfHook = buildPackages.autoreconfHook269; +in assert xarSupport -> libxml2 != null; - -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libarchive"; version = "3.6.2"; src = fetchFromGitHub { owner = "libarchive"; repo = "libarchive"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-wQbA6vlXH8pnpY7LJLkjrRFEBpcaPR1SqxnK71UVwxg="; }; - postPatch = '' - substituteInPlace Makefile.am --replace '/bin/pwd' "$(type -P pwd)" + outputs = [ "out" "lib" "dev" ]; - declare -a skip_test_paths=( + postPatch = let + skipTestPaths = [ # test won't work in nix sandbox - 'libarchive/test/test_write_disk_perms.c' - # can't be sure builder will have sparse-capable fs - 'libarchive/test/test_sparse_basic.c' - # can't even be sure builder will have hardlink-capable fs - 'libarchive/test/test_write_disk_hardlink.c' + "libarchive/test/test_write_disk_perms.c" + # the filesystem does not necessarily have sparse capabilities + "libarchive/test/test_sparse_basic.c" + # the filesystem does not necessarily have hardlink capabilities + "libarchive/test/test_write_disk_hardlink.c" # access-time-related tests flakey on some systems - 'cpio/test/test_option_a.c' - 'cpio/test/test_option_t.c' - ) - - for test_path in "''${skip_test_paths[@]}" ; do - substituteInPlace Makefile.am --replace "$test_path" "" - rm "$test_path" - done - ''; + "cpio/test/test_option_a.c" + "cpio/test/test_option_t.c" + ]; + removeTest = testPath: '' + substituteInPlace Makefile.am --replace "${testPath}" "" + rm "${testPath}" + ''; + in '' + substituteInPlace Makefile.am --replace '/bin/pwd' "$(type -P pwd)" - outputs = [ "out" "lib" "dev" ]; + ${lib.concatStringsSep "\n" (map removeTest skipTestPaths)} + ''; nativeBuildInputs = [ autoreconfHook @@ -105,7 +109,7 @@ stdenv.mkDerivation rec { includes implementations of the common tar, cpio, and zcat command-line tools that use the libarchive library. ''; - changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}"; + changelog = "https://github.com/libarchive/libarchive/releases/tag/v${finalAttrs.version}"; license = licenses.bsd3; maintainers = with maintainers; [ jcumming AndersonTorres ]; platforms = platforms.all; @@ -114,4 +118,4 @@ stdenv.mkDerivation rec { passthru.tests = { inherit cmake nix samba; }; -} +}) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0636572aa45..c9e3f6fd4a4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -20172,9 +20172,7 @@ with pkgs; libargs = callPackage ../development/libraries/libargs { }; - libarchive = callPackage ../development/libraries/libarchive { - autoreconfHook = buildPackages.autoreconfHook269; - }; + libarchive = callPackage ../development/libraries/libarchive { }; libarchive-qt = libsForQt5.callPackage ../development/libraries/libarchive-qt { }; |