Package init
This commit is contained in:
commit
33b796ff79
BIN
libarchive-3.4.0.tar.gz
Normal file
BIN
libarchive-3.4.0.tar.gz
Normal file
Binary file not shown.
114
libarchive-fix-zstd-test.patch
Normal file
114
libarchive-fix-zstd-test.patch
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
From aaacc8762fd8ced8823350edd8ce2e46b565582b Mon Sep 17 00:00:00 2001
|
||||||
|
From: "FeRD (Frank Dana)" <ferdnyc@gmail.com>
|
||||||
|
Date: Sun, 1 Sep 2019 02:46:55 -0400
|
||||||
|
Subject: [PATCH] test_write_filter_zstd: size @ lvl=20 < default < lvl=1
|
||||||
|
|
||||||
|
Raise compression on the second test to level=20, and perform a
|
||||||
|
third at level=1. Expect the output archive sizes to line up
|
||||||
|
based on compression level. Reduces test susceptibility to small
|
||||||
|
output size variations from different libzstd releases.
|
||||||
|
---
|
||||||
|
libarchive/test/test_write_filter_zstd.c | 66 +++++++++++++++++++++---
|
||||||
|
1 file changed, 60 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libarchive/test/test_write_filter_zstd.c b/libarchive/test/test_write_filter_zstd.c
|
||||||
|
index 9fb01906..13de1344 100644
|
||||||
|
--- a/libarchive/test/test_write_filter_zstd.c
|
||||||
|
+++ b/libarchive/test/test_write_filter_zstd.c
|
||||||
|
@@ -34,7 +34,7 @@ DEFINE_TEST(test_write_filter_zstd)
|
||||||
|
char *buff, *data;
|
||||||
|
size_t buffsize, datasize;
|
||||||
|
char path[16];
|
||||||
|
- size_t used1, used2;
|
||||||
|
+ size_t used1, used2, used3;
|
||||||
|
int i, r;
|
||||||
|
|
||||||
|
buffsize = 2000000;
|
||||||
|
@@ -125,7 +125,7 @@ DEFINE_TEST(test_write_filter_zstd)
|
||||||
|
assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
archive_write_set_filter_option(a, NULL, "compression-level", "9"));
|
||||||
|
assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
- archive_write_set_filter_option(a, NULL, "compression-level", "6"));
|
||||||
|
+ archive_write_set_filter_option(a, NULL, "compression-level", "20"));
|
||||||
|
assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2));
|
||||||
|
for (i = 0; i < 100; i++) {
|
||||||
|
sprintf(path, "file%03d", i);
|
||||||
|
@@ -140,10 +140,6 @@ DEFINE_TEST(test_write_filter_zstd)
|
||||||
|
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
|
||||||
|
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
|
||||||
|
|
||||||
|
- failure("compression-level=6 wrote %d bytes, default wrote %d bytes",
|
||||||
|
- (int)used2, (int)used1);
|
||||||
|
- assert(used2 < used1);
|
||||||
|
-
|
||||||
|
assert((a = archive_read_new()) != NULL);
|
||||||
|
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||||
|
r = archive_read_support_filter_zstd(a);
|
||||||
|
@@ -167,6 +163,64 @@ DEFINE_TEST(test_write_filter_zstd)
|
||||||
|
}
|
||||||
|
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * One more time at level 1
|
||||||
|
+ */
|
||||||
|
+ assert((a = archive_write_new()) != NULL);
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a));
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
+ archive_write_set_bytes_per_block(a, 10));
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_zstd(a));
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
+ archive_write_set_filter_option(a, NULL, "compression-level", "1"));
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used3));
|
||||||
|
+ assert((ae = archive_entry_new()) != NULL);
|
||||||
|
+ archive_entry_set_filetype(ae, AE_IFREG);
|
||||||
|
+ archive_entry_set_size(ae, datasize);
|
||||||
|
+ for (i = 0; i < 100; i++) {
|
||||||
|
+ sprintf(path, "file%03d", i);
|
||||||
|
+ archive_entry_copy_pathname(ae, path);
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
|
||||||
|
+ assertA(datasize == (size_t)archive_write_data(a, data, datasize));
|
||||||
|
+ }
|
||||||
|
+ archive_entry_free(ae);
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
|
||||||
|
+ assertEqualInt(ARCHIVE_OK, archive_write_free(a));
|
||||||
|
+
|
||||||
|
+ assert((a = archive_read_new()) != NULL);
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
|
||||||
|
+ r = archive_read_support_filter_zstd(a);
|
||||||
|
+ if (r == ARCHIVE_WARN) {
|
||||||
|
+ skipping("zstd reading not fully supported on this platform");
|
||||||
|
+ } else {
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
+ archive_read_support_filter_all(a));
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
+ archive_read_open_memory(a, buff, used3));
|
||||||
|
+ for (i = 0; i < 100; i++) {
|
||||||
|
+ sprintf(path, "file%03d", i);
|
||||||
|
+ failure("Trying to read %s", path);
|
||||||
|
+ if (!assertEqualIntA(a, ARCHIVE_OK,
|
||||||
|
+ archive_read_next_header(a, &ae)))
|
||||||
|
+ break;
|
||||||
|
+ assertEqualString(path, archive_entry_pathname(ae));
|
||||||
|
+ assertEqualInt((int)datasize, archive_entry_size(ae));
|
||||||
|
+ }
|
||||||
|
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
|
||||||
|
+ }
|
||||||
|
+ assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * Check output sizes for various compression levels, expectation
|
||||||
|
+ * is that archive size for level=20 < default < level=1
|
||||||
|
+ */
|
||||||
|
+ failure("compression-level=20 wrote %d bytes, default wrote %d bytes",
|
||||||
|
+ (int)used2, (int)used1);
|
||||||
|
+ assert(used2 < used1);
|
||||||
|
+ failure("compression-level=1 wrote %d bytes, default wrote %d bytes",
|
||||||
|
+ (int)used3, (int)used1);
|
||||||
|
+ assert(used1 < used3);
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Test various premature shutdown scenarios to make sure we
|
||||||
|
* don't crash or leak memory.
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
||||||
151
libarchive.spec
Normal file
151
libarchive.spec
Normal file
@ -0,0 +1,151 @@
|
|||||||
|
%bcond_without check
|
||||||
|
|
||||||
|
Name: libarchive
|
||||||
|
Version: 3.4.0
|
||||||
|
Release: 1
|
||||||
|
Summary: Multi-format archive and compression library
|
||||||
|
|
||||||
|
License: BSD
|
||||||
|
URL: https://www.%{name}.org/
|
||||||
|
Source0: https://www.%{name}.org/downloads/%{name}-%{version}.tar.gz
|
||||||
|
#Patch0 comes from Fedora 31
|
||||||
|
Patch0: libarchive-fix-zstd-test.patch
|
||||||
|
|
||||||
|
BuildRequires: gcc bison sharutils zlib-devel bzip2-devel xz-devel
|
||||||
|
BuildRequires: lzo-devel e2fsprogs-devel libacl-devel libattr-devel
|
||||||
|
BuildRequires: openssl-devel libxml2-devel lz4-devel automake libzstd-devel
|
||||||
|
|
||||||
|
Provides: bsdtar bsdcpio bsdcat
|
||||||
|
Obsoletes: bsdtar bsdcpio bsdcat
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{name} is an open-source BSD-licensed C programming library that
|
||||||
|
provides streaming access to a variety of different archive formats,
|
||||||
|
including tar, cpio, pax, zip, and ISO9660 images. The distribution
|
||||||
|
also includes bsdtar and bsdcpio, full-featured implementations of
|
||||||
|
tar and cpio that use %{name}.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: Development files for %{name}
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
%{name}-devel contains the header files for developing
|
||||||
|
applications that want to make use of %{name}.
|
||||||
|
|
||||||
|
%package_help
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
|
%build
|
||||||
|
%configure --disable-rpath
|
||||||
|
%disable_rpath
|
||||||
|
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%make_install
|
||||||
|
%delete_la
|
||||||
|
|
||||||
|
replace ()
|
||||||
|
{
|
||||||
|
filename=$1
|
||||||
|
file=`basename "$filename"`
|
||||||
|
binary=${file%%.*}
|
||||||
|
pattern=${binary##bsd}
|
||||||
|
|
||||||
|
awk "
|
||||||
|
/^.Dt ${pattern^^} 1/ {
|
||||||
|
print \".Dt ${binary^^} 1\";
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
!stop && /^.Nm $pattern/ {
|
||||||
|
print \".Nm $binary\" ;
|
||||||
|
stop = 1 ;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
1;
|
||||||
|
" "$filename" > "$filename.new"
|
||||||
|
mv "$filename".new "$filename"
|
||||||
|
}
|
||||||
|
|
||||||
|
for manpage in bsdtar.1 bsdcpio.1
|
||||||
|
do
|
||||||
|
installed_manpage=`find "$RPM_BUILD_ROOT" -name "$manpage"`
|
||||||
|
replace "$installed_manpage"
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
%check
|
||||||
|
%if %{with check}
|
||||||
|
logfiles ()
|
||||||
|
{
|
||||||
|
find -name '*_test.log' -or -name test-suite.log
|
||||||
|
}
|
||||||
|
|
||||||
|
tempdirs ()
|
||||||
|
{
|
||||||
|
cat `logfiles` \
|
||||||
|
| awk "match(\$0, /[^[:space:]]*`date -I`[^[:space:]]*/) { print substr(\$0, RSTART, RLENGTH); }" \
|
||||||
|
| sort | uniq
|
||||||
|
}
|
||||||
|
|
||||||
|
cat_logs ()
|
||||||
|
{
|
||||||
|
for i in `logfiles`
|
||||||
|
do
|
||||||
|
echo "=== $i ==="
|
||||||
|
cat "$i"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
run_testsuite ()
|
||||||
|
{
|
||||||
|
rc=0
|
||||||
|
LD_LIBRARY_PATH=`pwd`/.libs make %{?_smp_mflags} check -j1 || {
|
||||||
|
cat_logs
|
||||||
|
|
||||||
|
for i in `tempdirs`; do
|
||||||
|
if test -d "$i" ; then
|
||||||
|
find $i -printf "%p\n ~> a: %a\n ~> c: %c\n ~> t: %t\n ~> %s B\n"
|
||||||
|
cat $i/*.log
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
cat_logs
|
||||||
|
}
|
||||||
|
|
||||||
|
run_testsuite
|
||||||
|
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%ldconfig_scriptlets
|
||||||
|
|
||||||
|
%files
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{!?_licensedir:%global license %%doc}
|
||||||
|
%license COPYING
|
||||||
|
%{_libdir}/%{name}.so.13*
|
||||||
|
%{_bindir}/bsdtar
|
||||||
|
%{_bindir}/bsdcpio
|
||||||
|
%{_bindir}/bsdcat
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_includedir}/*.h
|
||||||
|
%{_libdir}/%{name}.so
|
||||||
|
%{_libdir}/pkgconfig/%{name}.pc
|
||||||
|
%{_libdir}/*.a
|
||||||
|
|
||||||
|
%files help
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%doc NEWS README.md
|
||||||
|
%{_mandir}/man1/*
|
||||||
|
%{_mandir}/man3/*
|
||||||
|
%{_mandir}/man5/*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Sep 16 2019 openEuler Buildteam <buildteam@openeuler.org> - 3.4.0-1
|
||||||
|
- Package init
|
||||||
Loading…
x
Reference in New Issue
Block a user