abipkgdiff: Add a new --self-check option

After the report of
https://sourceware.org/bugzilla/show_bug.cgi?id=26769 it became
apparent that we want to be able compare a binary against its ABIXML
representation, including for cases where the binaries are embedded in
RPM packages.

This patches thus introduces the --self-check option to abipkgdiff so
that it can be invoked like this:

    $ abipkgdiff --self-check --d1 libstdc++-debuginfo-10.2.1-8.fc34.x86_64.rpm --d1 gcc-debuginfo-10.2.1-8.fc34.x86_64.rpm libstdc++-10.2.1-8.fc34.x86_64.rpm

    ==== SELF CHECK SUCCEEDED for 'libstdc++.so.6.0.28'====
    $

With this option, libabigail compares each binary in the RPM against
its own ABIXML representation.

This should hopefully help to write regression tests which have as
sole inputs the links to download the RPMs.  It's also useful to ease
the process of reproducing the issue raised.

This option can now be used, for instance, by the libabigail-selfcheck
program over at https://pagure.io/libabigail-selfcheck.

	* tools/abipkgdiff.cc (options::self_check): Define new data
	member.
	(options::options): Initialize it.
	(display_usage): Add help string for the --self-check option.
	(parse_command): Parse the new --self-check option.
	(extract_deb): Add missing newline.
	(compare): Remove useless white space.
	(compare_to_self, self_compare_prepared_userspace_package)
	(self_compare_prepared_package, compare_to_self): Add new static
	functions.
	(class self_compare_task): Add new class.
	(prepare_package): Add a new overload that takes just one
	parameter.
	(elf_size_is_greater): Don't crash if the args are empty.
	(main): If the --self-check option is given, make sure we have
	just one package in argument.  Use the new compare_to_self
	function to handle the --self-check option.
	* doc/manuals/abipkgdiff.rst: Add documentation for the new
	--self-check option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2 files changed