Make abipkgdiff compare tar archives containing binaries
This patch adds support for comparing the ABI of binaries contained in
a tar archive.
If the archive is compressed with gzip, bzip2, lzip, lzma or xz, then
abipkgdiff recognizes the usual relevant file extensions and lets the
GNU tar program handle the decompression.
If the archive is not compressed, abipkgdiff recognizes the UStar
(Uniform Standard Tape ARchive) format, even if the archive file name
doesn't end with the .tar extension, and lets the GNU tar program
handle the extraction. If the file ends up with the .tar extension
anyway (even if it's not in the UStar format, abipkgdiff lets the GNU
tar program handle its extraction.
* config.h.in (WITH_TAR): New configuration preprocessor macro.
* configure.ac: Add a new --enable-tar option. It's turned on
automatically if the tar program is found in the PATH. Adjust the
build configuration report to add the tar archive support.
* include/abg-tools-utils.h (string_ends_with): Declare new
function.
(enum file_type): Add a new FILE_TYPE_TAR enumerator.
* src/abg-tools-utils.cc (string_ends_with): Define new function.
(operator<<(ostream&, file_type)): Serialize the new FILE_TYPE_TAR
enumerator.
(guess_file_type): Detect UStar format file by reading its magic
number. Detect compressed tar files based on the file path
extension.
* tools/abipkgdiff.cc (extract_tar): Define new function.
(extract_package): Handle tar packages.
(main): Handle tar archives.
* tools/abidiff.cc (main): Handle the new FILE_TYPE_TAR
enumerator.
* tools/abilint.cc (main): Likewise.
* tests/data/test-diff-pkg/tarpkg-0-dir{1,2}.ta{,r,.bz2, gz}: New
test input tarballs.
* tests/data/test-diff-pkg/tarpkg-0-report-0.txt: New test output
reference.
* tests/data/Makefile.am: Add the new test data file above to
source distribution.
* tests/test-diff-pkg.cc (in_out_specs): Add new tests cases.