diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-09-24 16:27:09 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-09-27 22:28:03 +0200 |
commit | 778904f14cd059327453557a26eaabc3c42ddc5c (patch) | |
tree | 2dfb1e3aa98c3dc3c4b4ccef8d1bf542645194bd /eclass/tests | |
parent | unpacker.eclass: Add support for .lz4 and .lzo compression (diff) | |
download | gentoo-778904f14cd059327453557a26eaabc3c42ddc5c.tar.gz gentoo-778904f14cd059327453557a26eaabc3c42ddc5c.tar.bz2 gentoo-778904f14cd059327453557a26eaabc3c42ddc5c.zip |
unpacker.eclass: Add on-the-fly .gpkg.tar unpacking support
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/tests')
-rwxr-xr-x | eclass/tests/unpacker.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/eclass/tests/unpacker.sh b/eclass/tests/unpacker.sh index 1f2327054521..40bde1bf30de 100755 --- a/eclass/tests/unpacker.sh +++ b/eclass/tests/unpacker.sh @@ -136,6 +136,43 @@ test_deb() { "create_deb '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}" } +create_gpkg() { + local suffix=${1} + local tool=${2} + local archive=${3} + local infile=${4} + local gpkg_dir=${archive%.gpkg.tar} + + mkdir image metadata "${gpkg_dir}" || die + cp "${infile}" image/ || die + tar -c metadata | ${tool} > "${gpkg_dir}/metadata.tar${suffix}" + assert "packing metadata.tar${suffix} failed" + : > "${gpkg_dir}/metadata.tar${suffix}.sig" || die + tar -c image | ${tool} > "${gpkg_dir}/image.tar${suffix}" + assert "packing image.tar${suffix} failed" + : > "${gpkg_dir}/image.tar${suffix}.sig" || die + : > "${gpkg_dir}"/gpkg-1 || die + tar -cf "${archive}" --format=ustar \ + "${gpkg_dir}"/{gpkg-1,{metadata,image}.tar"${suffix}"} || die + rm -r image metadata "${gpkg_dir}" || die +} + +test_gpkg() { + local suffix=${1} + local tool=${2} + local tool_cmd + + if [[ -n ${tool} ]]; then + tool_cmd="${tool} -c" + else + tool_cmd=cat + fi + + test_unpack "test-${tool}-1.2.3-1.gpkg.tar" \ + "test-${tool}-1.2.3-1/image/test.in" "tar ${tool}" \ + "create_gpkg '${suffix}' '${tool_cmd}' \${archive} \${TESTFILE}" +} + test_reject_junk() { local suffix=${1} local archive=test${1} @@ -209,6 +246,16 @@ test_deb .xz xz test_deb .bz2 bzip2 test_deb .lzma lzma +test_gpkg +test_gpkg .gz gzip +test_gpkg .bz2 bzip2 +test_gpkg .lz4 lz4 +test_gpkg .lz lzip +test_gpkg .lzma lzma +test_gpkg .lzo lzop +test_gpkg .xz xz +test_gpkg .zst zstd + test_unpack test.zip test.in zip 'zip -q ${archive} ${TESTFILE}' # test handling non-adjusted zip with junk prepended test_unpack test.zip test.in zip \ |