Merge pull request #206795 from atorres1985-contrib/libarchive

libarchive: refactor
This commit is contained in:
Anderson Torres 2022-12-23 20:51:47 -03:00 committed by GitHub
commit e95d1a063e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 27 deletions

View File

@ -22,44 +22,48 @@
, 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 = ''
outputs = [ "out" "lib" "dev" ];
postPatch = let
skipTestPaths = [
# test won't work in nix sandbox
"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"
];
removeTest = testPath: ''
substituteInPlace Makefile.am --replace "${testPath}" ""
rm "${testPath}"
'';
in ''
substituteInPlace Makefile.am --replace '/bin/pwd' "$(type -P pwd)"
declare -a skip_test_paths=(
# 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'
# 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
${lib.concatStringsSep "\n" (map removeTest skipTestPaths)}
'';
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [
autoreconfHook
pkg-config
@ -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;
};
}
})

View File

@ -20254,9 +20254,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 { };