Commit Graph

146 Commits

Author SHA1 Message Date
Dodji Seketeli
b2e5366d3f Introduce the concept of environment
There are resources needed by the type system and other artifacts of
libabigail.  Today, when the life time of those resources need to be
greater than all of artifacts of Abigail, then said resources are made
global.

But then global resources are not great, if anything because they
complicate the future use of the library in concurrent computing
setups.

As I was in the need to add one resource to be used by the type
system, I decided to sit down and first overhaul how these long lived
resources needed to be handled.

And here comes the concept of "environment".  An environment is a
place where one can put resources that need to live longer than all
the other artifacts of the Abigail system.  And so, the code that
creates Abigail artifacts needs and environment of for said artifacts
to use.  In other words, artifacts now use an environment.

This has interesting and strong implications.  We can only compare two
artifacts if they use the same environment.  This is quite a strong
requirement.

But then when this requirement is fulfilled, comparing two types
amounts to just comparing two pointer values; hash values for types
can also be cached.  Now *that* is great for speed of comparison, is
it not?

This patch introduce the concept environment (which is basically a new
abigail::ir::environment type), removes the global variables and uses
the environment instead.  Each ABI artifact (either type or decl) now
has a ::get_environment() member function to get its environment.

This patch also disables the caching of hash values because the
caching must happen only *after* all types have been canonicalized.
We were not respecting that requirement until now, and that introduces
wrong hash values.  A subsequent patch is going to re-introduce hash
value caching again, once the infrastructure is in place to set a flag
in the environment (hah!) once type canonicalization is done, and then
later read that flag when some client code requests a hash value, to
know if we should look in the hash value cache or not.

The patch obviously changes the output of numerous regression tests
(if anything b/c it disables hash value caching) so 'make check'
yields regressions.  But then, it's only the subsequent patch that
updates the tests.

	* include/abg-ir.h: Adjust note about memory management.
	(class environment): Declare new class.
	(translation_unit::translation_unit): Take an environment in
	parameter.
	(translation_unit::{g,s}et_environment): Declare new member
	functions.
	(type_or_decl_base::{g,s}et_environment): Likewise.
	(type_or_decl_base::{get_cached_hash_value,
	set_cached_hash_value}): Change the name of
	decl_base::peek_hash_value() and decl_base::set_hash() here into
	these and move them here.
	(type_or_decl_base::hashing_started): Move
	decl_base::hashing_started() here.
	({g,s}et_environment_for_artifact): Declare new functions.
	(class decl_base): Move member functions hashing_started(),
	peek_hash_value() and set_hash() on to the type_or_decl_base base
	class.
	(scope_decl::scope_decl): Initialize the virtual member
	type_or_decl_base().
	(type_decl::{get_void_type_decl,
	get_variadic_parameter_type_decl}): Remove these static member
	functions.  They are now non-static member functions of the new
	environment type.
	* src/abg-ir.cc (class environment_setter): New internal class.
	(get_canonical_types_map): Remove.  This now becomes a member
	function of the environment type.
	(class usage_watchdog): Remove.
	(usage_watchdog_{s,w}ptr): Remove these typedefs.
	(get_usage_watchdog_wptr, ref_usage_watchdog)
	(maybe_cleanup_type_system_data): Remove these functions.
	(translation_unit::priv::usage_watchdog_): Remove data member.
	(translation_unit::priv::env_): New data member.
	(translation_unit::priv::priv): Take an environment and initialize
	the new env_ data member.  Do not initialize the removed
	usage_watchdog_.
	(translation_unit::translation_unit): Take an environment
	parameter.
	(translation_unit::get_global_scope): Set the environment of a new
	global scope.
	(translation_unit::{g,s}et_environment): New accessors.
	(translation_unit::bind_function_type_life_time): Set the
	environment of the function type.
	(struct environment::priv): New class.
	(environment::{environment, ~environment, get_canonical_types_map,
	get_variadic_parameter_type_decl, canonicalization_is_done}): New
	member functions.
	(struct type_or_decl_base::priv): New class.
	(type_or_decl_base::{type_or_decl_base, hashing_started,
	get_cached_hash_value, set_cached_hash_value, set_environment,
	get_environment, traverse}): New member functions.
	({s,g}get_environment_for_artifact): New functions.
	(decl_base::priv::{hash_, hashing_started}): Remove.
	(decl_base::priv::priv): Adjust.
	(decl_base::decl_base): In the copy constructor, initialize the
	virtual base type_or_decl_base.  Do not initialize hash_ and
	hashing_started data member that got removed.
	(decl_base::{hashing_started, peek_hash_value, set_hash}): Remove
	member functions.
	(strip_typedef): Set the environment of the new type which has its
	typedefs stripped off.  Adjust the call to type_or_void().
	(scope_decl::{add, insert}_member_decl): Set the environment of
	the new member decl to the environment of its scope.
	(synthesize_type_from_translation_unit)
	(synthesize_function_type_from_translation_unit): Set the
	environment for the newly synthesized type. Adjust calls to
	type_or_void().
	(type_or_void): Take an environment in parameter.  Get the void
	type from the environment.
	(get_canonical_types_map): Remove.
	(type_base::get_canonical_type_for): Get the canonical types map
	from the environment, not from a global variable.
	(type_decl::{get_void_type_decl,
	get_variadic_parameter_type_decl}): Remove.
	(pointer_type_def::pointer_type_def): Adjust call to type_or_void.
	(reference_type_def::reference_type_def): Likewise.
	(function_decl::parameter::get_pretty_representation): Get the
	variadic parameter type decl from the environment.
	(class_decl::priv::classes_being_compared_): Remove static data
	member.
	(class_decl::priv::{mark_as_being_compared,
	unmark_as_being_compared, comparison_started): Use the "classes
	being compared" map from the environment.
	(class_decl::base_spec::get_hash): Adjust.
	(keep_type_alive): Get the alive types array from the environment)
	not from a global variable anymore.
	(get_next_string): Put the counter in thread-local storage.
	* src/abg-hash.cc (scope_decl:#️⃣:operator())
	(function_decl:#️⃣:operator()): Do not handle caching (here).
	* include/abg-corpus.h (corpus::{g,s}et_environment): Declare new
	accessors.
	* src/abg-corpus.cc (corpus::priv::env): New data member.
	(corpus::priv::priv): Initialize it.
	(corpus::corpus):  Take an environment in parameter.
	(corpus::{g,s}et_environment): Define new member functions
	(corpus::add): Set the environment of the newly added translation
	unit, if it's not set already set.  In any case, assert that the
	translation unit must use the same environment as the corpus.
	* include/abg-dwarf-reader.h (create_read_context)
	(read_corpus_from_elf): Take an environment parameter.
	({s,g}et_debug_info_root_path, {s,g}et_environment): Declare new
	functions.
	* src/abg-dwarf-reader.cc (read_context::{env_,
	offline_callbacks_}): New data members.
	(read_context::read_context): Initialize them.
	(read_context::clear_per_translation_unit_data): Do not touch the
	void type declaration, it doesn't belong to the translation unit.
	(read_context::{env, offline_callbacks}): New accessors.
	(read_context::{create_default_dwfl}): New member function.
	(read_context::dwfl_handle): Add a setter overload.
	({s,g}et_debug_info_root_path): Define new accessors.
	(create_default_dwfl, create_dwfl_sptr, create_default_dwfl_sptr):
	Remove these.
	(build_translation_unit_and_add_to_ir): Adjust to pass the
	environment to the newly created translation unit.
	(build_function_decl): Adjust to pass the environment to the
	created function and parameter types.  Get variadic parameter type
	node from the current environment, not from a global variable.
	And do not try to canonicalize function types here.
	(read_debug_info_into_corpus): Set the environment of the newly
	created corpus.
	(build_ir_node_for_void_type): Get the void type node from the
	current environment, rather than from a global variable.
	(create_read_context): Take the environment in parameter.
	Create the default dwarf front end library handle using the new
	member function of the read context.  Set the current environment
	used by the reader.
	(read_corpus_from_elf): Take an environment in
	parameter. Overhaul.  This is now simpler.
	(has_alt_debug_info): Adjust the call to create_read_context() to
	make it pass an empty environment.
	* include/abg-fwd.h (class environment): Forward declare.
	* include/abg-reader.h (read_translation_unit_from_file)
	(read_translation_unit_from_buffer)
	(read_translation_unit_from_istream)
	(read_corpus_from_native_xml): Take an environment in parameter.
	* src/abg-reader.cc (read_context::m_env): New data member.
	(read_context::read_context): Initialize it.
	(read_context::{get_environment, set_environment}): New data
	member.
	(read_translation_unit): Set environment of the new translation
	unit.
	(read_corpus_from_input): Set the environment of the new corpus.
	(read_translation_unit_from_file)
	(read_translation_unit_from_buffer)
	(read_translation_unit_from_istream, read_corpus_from_native_xml):
	Take an environment in parameter.
	(build_function_parameter): Get variadic parameter type from the environment.
	* src/abg-comparison.cc (compute_diff): Add asserts in all the
	overloads to ensure that the artifact being compared come from the
	same environment.
	* tests/print-diff-tree.cc (main): Create an env for the ABI
	artifacts to use.
	* tests/test-abidiff.cc (main): Likewise.
	* tests/test-diff-dwarf.cc (main): Likewise.
	* tests/test-ir-walker.cc (main): Likewise.
	* tests/test-read-dwarf.cc (main): Likewise.
	* tests/test-read-write.cc (main): Likewise.
	* tools/abicompat.cc (main): Likewise.
	* tools/abidiff.cc (main): Likewise.
	* tools/abidw.cc (main): Likewise.
	* tools/abilint.cc (main): Likewise.
	* tools/abipkgdiff.cc (main): Likewise.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-09-07 23:35:29 +02:00
Dodji Seketeli
277e524392 Add a new --noout option to abidw
* tools/abidw.cc (options::noout): New data member.
	(options::options): Initialize it.
	(display_usage): Add a usage string for the new option.
	(parse_command_line): Parse the new option.
	(main): If --noout is provided, do not emit the XML form.
 	* doc/manuals/abidw.rst: Document the new option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-29 16:23:15 +02:00
Dodji Seketeli
e61afa7291 Add a --no-architecture option to abidiff
This new option omits architectures when comparing ABIs.

	* tools/abidiff.cc (options::no_arch): New data member.
	(options::options): Initialize it.
	(display_usage): Display a help string for the new options.
	(parse_command_line): Parse the new options.
	(main): If --no-architecture is provided, set the corpus
	architecture to "".
	* doc/manuals/abidiff.rst: Document the new options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-29 16:23:15 +02:00
Dodji Seketeli
72b42c3090 Misc style cleanups
* configure.ac: Fix some spelling typos.
	* src/abg-tools-utils.cc (guess_file_type): Fix indentation.
	* tests/test-diff-pkg.cc (int_out_specs): Add some vertical spaces
	for better legibility.
	* tools/abidiff.cc (main): Add a missing space.
	* tools/abipkgdiff.cc (extract_deb): Fix a typo in the comment.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-22 14:32:20 +02:00
Dodji Seketeli
585fc4c33c 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.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-22 14:32:20 +02:00
Dodji Seketeli
fca8506ab9 Misc style fixes in abipkgdiff
* include/abg-tools-utils.h (enum file_type): Fix the comment for
	for the FILE_TYPE_DEB enumerator.
	* tools/abipkgdiff.cc (main): Fix the style of the conditions.
	Also, fix the text emitted.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-22 12:19:27 +02:00
Dodji Seketeli
d7dbbf0d50 Make abipkgdiff compare directories containing binaries
abipkgdiff knows how to compare the ABI of binaries contained in .deb
and .rpm files.  This patch adds support for comparing the ABI of
binaries contained in two directories.

	* include/abg-tools-utils.h (enum file_type): Add a new
	FILE_TYPE_DIR enumerator.
	* src/abg-tools-utils.cc (operator<<(ostream&, file_type)):
	Support serialization of the new FILE_TYPE_DIR enumerator.
	(guess_file_type): Detect that the path given is a directory.
	* tools/abipkgdiff.cc (package::package): If the package is a
	directory, then set its extracted directory path to the path of
	the directory.
	(package::erase_extraction_directory): Do not erase the extraction
	directory if the package is a directory provided by the user.
	(extract_package): If the package is a directory provided by the
	user, then there is nothing to extract.
	(main): If the first package is a directory, then the second one
	should be a directory as well.
	* tools/abidiff.cc (main): Support directories as input.
	* tools/abilint.cc (main): Likewise.
	* tests/data/test-diff-pkg/dirpkg-0-dir{1,2}/libobj-v0.so: New
	binary test inputs.
	* test/data/test-diff-pkg/dirpkg-0-report-0.txt: New input test
	file.
	* tests/data/test-diff-pkg/dirpkg-1-dir{1,2}/obj-v0.cc: Source
	code of the binary test inputs above.
	* tests/data/Makefile.am: Add the new files above to the source
	distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the new test input
	files above to the set of tests this harness has to run over.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-22 12:19:27 +02:00
Dodji Seketeli
d1c6ef0cb5 make abipkgdiff compile with GCC 4.4.7
GCC 4.4.7 won't let us declare an instance of string with __thread.
So for now, package::extracted_packages_parent_dir() juststores its string
globally.  We are single-threaded for now anyway.

	* tools/abipkgdiff.cc (package::extracted_packages_parent_dir):
	The string holding the dir name is no more __thread, as this won't
	compile with GCC 4.4.7

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-21 13:08:38 +02:00
Dodji Seketeli
7bcaf67504 Add a --stats to abidiff and abidw
For now, this new --stats emits diagnostics about the number of types
canonicalized at the very end of building the ABI corpus as well as
the number of types that were scheduled for late canonicalizing and
that couldn't be canonicalized.

	* include/abg-dwarf-reader.h (get_show_stats)
	(set_show_stats): New accessors for a new "show_stats" property of
	the dwarf reader context.
	* src/abg-dwarf-reader.cc: Include iostream to use std::cerr.
	(dwarf_reader::show_stats_): New data member.
	(dwarf_reader::dwarf_reader): Initialize it.
	(dwarf_reader::show_stats)
	(get_show_stats)
	(set_show_stats): Define new accessors.
	(dwarf_reader::die_type_map): Add const overload to this accessor.
	(dwarf_reader::lookup_type_from_die_offset): Make this accessor
	const.
	(dwarf_reader::add_late_canonicalized_types_stats): New member
	function.
	(dwarf_reader::perform_late_type_canonicalizing): Emit the
	statistics about late-canonicalized types if the user asked for
	it.
	* tools/abidiff.cc (options::show_stats): New data member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(parse_command_line): Parse the new --stats option.
	(main): Create a dwarf reader context, set the show_stats to it
	and then use that context to read the corpora before diffing them.
	* tools/abidw.cc (options::show_stats): New data member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(parse_command_line): Parse the new --stats option.
	(main): Set the show_stats to the dwarf reader context before
	using it.
	* doc/manuals/abidiff.rst: Update the manual.
	* doc/manuals/abidw.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-20 13:25:42 +02:00
Dodji Seketeli
dd15667e8e Fix typos in abipkgdiff
* tools/abipkgdiff.cc (display_usage): s/pompare/compare.  Give a
	better help message for --help.
	(extract_rpm): Insert a space after the path of the package being
	extracted, when emitting a verbose message.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 16:50:18 +02:00
Dodji Seketeli
57e2cb9e07 Update comment about the supported formats in abipkgdiff
* tools/abipkgdiff.cc: Now that .deb packages are supported, say
	it.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 15:24:12 +02:00
Dodji Seketeli
28090bad1b Make the support of RPM and DEB package formats conditional
If at configure time the libabigail source tarball detects that
rpm2cpio and cpio are present then it enables the support for rpm
files.  Users can explicitly enable or disable that support by passing
--enable-rpm or --disable-rpm to configure.

Similarly if it detects that dpkg is present at configure time then it
enables the support for deb files.  Users can explicitly enable or
disable that support by passing --enable-deb or --disable-deb to
configure.

	* config.h.in: Define WITH_DEB and WITH_RPM pre-processor macros.
	* configure.ac: Add --enable-{rpm,deb} switches.  Check for
	rpm2cpio and cpio programs, unless --disable-rpm was provided.  If
	they are found and if --enable-rpm=auto was provided, then
	consider that --enable-rpm=yes was provided.  In that case, set
	the WITH_RPM macro to 1.  Otherwise, undefine that macro.
	Similarly, check for dpkg unless --disable-deb was provided.  If
	it's found and if --enable-deb=auto was provided, consider that
	--enable-deb=yes was provided.  In that case, set the WITH_DEB
	macro to 1.  Otherwise, undefine that macro.  Define the
	ENABLE_RPM and ENABLE_DEB conditional automake variables, if the
	rpm resp. deb support is enabled.  Emit a notice about the rpm and
	deb features being enabled or not, at the end of the configure
	process.
	* tests/test-diff-pkg.cc: Include the config.h header.
	(in_out_spec): Guard rpm tests by the WITH_RPM macro.  Similarly,
	guard deb tests by the WITH_DEB macro.
	* tools/abipkgdiff.cc: Include the config.h header.
	(extract_rpm): Guard this function definition with the WITH_RPM
	macro.
	(extract_deb): Guard this function definition with the WITH_DEB
	macro.
	(extract_package): Guard the handling of rpm packages with the
	WITH_RPM macro and the handling of deb package with the WITH_DEB
	macro.  If a package not-support package format is encountered,
	emit an appropriate error message and error out.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:40:32 +02:00
Matthias Klose
4df0a4d952 Add support for .deb files to abipkgdiff
This lets abipkgdiff compare debian binary packages.

The patch contains test cases for debian package with split debug info
that is referenced by the build-id scheme.  These test cases come from
the bug report https://sourceware.org/bugzilla/show_bug.cgi?id=18792,
more particularly from the attachment
https://sourceware.org/bugzilla/attachment.cgi?id=8516.

	* include/abg-tools-utils.h (file_type): Add FILE_TYPE_DEB.
	* tools/abipkgdiff.cc (extract_deb): New.
	(extract_package, main): Handle FILE_TYPE_DEB.
	* src/abg-tools-utils.cc (operator<<): Handle FILE_TYPE_DEB.
	(guess_file_type): Detect FILE_TYPE_DEB.
	* tools/abidiff.cc (main): Handle FILE_TYPE_DEB.
	* tools/abilint.cc (main): Handle FILE_TYPE_DEB.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a-dbgsym_2.4.0-1_amd64.ddeb:
	Input debian debug info package; to be compared by the test
	harness runtestdiffpkg.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64.deb:
	Input debian package; to be compared by the test harness
	runtestdiffpkg.
	* tests/data/test-diff-pkg/libsigc++-2.0-0v5-dbgsym_2.4.1-1ubuntu2_amd64.ddeb:
	Input debug info package
	* tests/data/test-diff-pkg/libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64.deb:
	Input debian package; to be compared by the test harness
	runtestdiffpkg.
	* tests/data/test-diff-pkg/libsigc++-2.0-0c2a_2.4.0-1_amd64--libsigc++-2.0-0v5_2.4.1-1ubuntu2_amd64-report-0.txt:
	Reference output for the comparison of the packages above.
	* tests/data/Makefile.am: Add the new files above to the source distribution.
	* tests/test-diff-pkg.cc (in_out_specs): Add the input packages
	above to the set of files to be compared by this test harness.

Signed-off-by: Matthias Klose <doko@debian.org>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-14 13:36:23 +02:00
Dodji Seketeli
56112bae3b Add an abipkgdiff --fail-no-dbg command line option
* tools/abipkgdiff.cc (options::fail_if_no_debug_info): New data
	member.
	(options::options): Initialize it.
	(display_usage): Document it.
	(compare): If the user asked for it, fail if the we couldn't file
	the debug info for the corpus files being compared.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
c09bb53ab1 Add -h and -d option shortcuts to abidw
Added a -h option shortcut for the --help option and a -d option
shortcut for the --debug-info-dir option, to the abidw program.

	* tools/abidw.cc (display_usage): Added a documentation string.
	(parse_command_line): Parse the new -h and -d shortcuts.
	* doc/manuals/abidw.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
71acc72064 Add a -h option shortcut to abidiff
Added a -h shortcut for --help to the abidiff program.n

	* tools/abidiff.cc (display_usage): Add documentation for the new
	switch.
	(parse_command_line): Parse the -h option.
	* doc/manuals/abidiff.rst: Update the manual.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:53 +02:00
Dodji Seketeli
da870f3598 Add a -h shortcup to abipkgdiff --help
* tools/abipkgdiff.cc (display_usage): Document the -h shortcut.
	(parse_command_line): Parse the -h shortcut to --help.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-13 23:26:52 +02:00
Dodji Seketeli
9f7c07460d Add --no-added-syms to abipkgdiff
With this new option the tool ignores added functions, variables and
their symbols.

	* tools/abipkgdiff.cc (options::show_added_syms): New data member.
	(options::options): Initialize it.
	(parse_command_line): Parse the new --no-added-syms option and set
	the options::show_added_syms flag accordingly.
	(display_usage): Add a help string for the new option.
	(set_diff_context_from_opts): Set the diff context according to
	the state of the new options::show_added_syms flag.
	* doc/manuals/abipkgdiff.rst: Add manual entry for the new
	--no-added-syms options.
	* tests/data/test-diff-pkg/test-rpm-report-5.txt: New test
	reference input file.
	* tests/data/Makefile.am: Add the new file above to source
	distribution.
	* tests/test-diff-pkg.cc (InOutSpec::prog_options): New data
	member.
	(in_out_specs): Adjust.  Add a new input to run the test again
	with --no-added-syms.
	(main): Adjust to pass the program options contained in
	InOutSpec::prog_options to abipkgdiff.

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

fixup! Add --no-added-syms to abipkgdiff

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-08-06 15:22:38 +02:00
Dodji Seketeli
f0d319ab42 Make abipkgdiff erase the *parent* directory of temporary files
abipkgdiff was erasing the temporary files created by it wasn't
erasing the parent directory containing them.  Fixed thus.

	* tools/abipkgdiff.cc
	(erase_created_temporary_directories_parent): New static function.
	(compare): After comparison, erase the temporary parent directory
	as well.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-24 14:09:55 +02:00
Dodji Seketeli
b8ae34192f Extract all packages for a given run of abipkgdiff under the same temp dir
This patch extracts all packages for a given run of abipkgdiff under
the same temporary directory, cluttering /tmp less.

To do this, the patch makes accesses of data members of the 'package'
type go through accessor functions only.  Then the accessor for the
parent directory of all extracted package does the job of computing
the path to that parent directory in a way that makes it unique, per
thread.

	* tools/abipkgdiff.cc (package::{<all data members>}): Make the
	data members be private.  Make their names end with an underscore.
	(package::extracted_package_parent_dir_path): Remove.
	(package::extracted_package_dir_path): Rename into
	package::extracted_dir_path_.
	(package::extracted_packages_parent_dir): New static member
	function, accessor.
	(package::package): Adjust to the new names of the data members.
	Call the new package::extracted_package_parent_dir() static member
	function to initial the package::extracted_dir_path_ data member.
	(package::{path, extracted_dir_path, type, is_debug,
	path_elf_file_sptr_map, debug_info_package}): New accessors for
	the data members.
	(package::{erase_extraction_directory,
	erase_extraction_directories}): Adjust.
	(erase_created_temporary_directories)
	(create_maps_of_package_content)
	(extract_package_and_map_its_content, prepare_packages, compare)
	(main): Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-22 16:05:11 +02:00
Dodji Seketeli
decf33e847 Add a --keep-tmp-files option to abipkgidff
Sometimes, for debugging purposes it can be very handy to inspect the
content of the packages as seen by the tool.  This patch thus adds a
new --keep-tmp-files options so that users can inspect the content of
packages that were extracted.

	* tools/abipkgdiff.cc (options::keep_tmp_files): New data member.
	(options::options): Initialize it.
	(display_usage): Display a usage string for the new
	--keep-tmp-files option.
	(parse_command_line): Parse the new --keep-tmp-files option.
	(compare): Do not erase temporary directories if the users asked so.
	* doc/manuals/abipkgdiff.rst: Document the new --keep-tmp-files
	options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-22 15:36:16 +02:00
Dodji Seketeli
819f8941cf Show linkage names in abipkgdiff output
With this patch abipkgdiff now shows the linkage names of
added/removed functions and variables.  In addition, there now is a
--no-linkage-name option to avoid seeing linkage names.

	* doc/manuals/abipkgdiff.rst: Document the new --no-linkage-name
	options.
	* tools/abipkgdiff.cc (options::show_linkage_names): New data
	member.
	(options::options): Initialize it.
	(display_usage): Display a usage string for --no-linkage-name.
	(parse_command_line): Parse the --no-linkage-name option.
	(set_diff_context_from_opts): Set the diff context accordingly.
	* tests/data/test-diff-pkg/test-rpm-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 16:09:53 +02:00
Dodji Seketeli
b638309e48 Add --no-added-binaries to abipkgdiff
* tools/abipkgdiff.cc (options::show_added_binaries): New data
	member.
	(options::options): Initialize it.
	(display_usage): Add a help string for --no-added-binaries.
	(parse_command_line): Parse the new --no-added-binaries option.
	(compare): Do not show added binaries if the user doesn't want to.
	* doc/manuals/abipkgdiff.rst: Document the new --no-added-binaries
	option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 14:15:33 +02:00
Dodji Seketeli
96af1baf13 make abipkgdiff return a proper exit code
With this patch, abipkgdiff returns the same exit code as abidiff.
It's zero if there is no ABI change, and non-zero if there are ABI
changes.  The exact value depends on the kind of changes that is
detected.

	* tools/abipkgdiff.cc (compare): Return an instance
	abigail::tools_utils::abidiff_status, just like what we do in
	abidiff.
	* doc/manuals/abipkgdiff.rst: Document the new exit code.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 14:11:53 +02:00
Dodji Seketeli
6d4c194c04 Fix logic of determining if changes happened in abidiff
Now that we can easily check if the diff between two corpora carries
net changes (i.e, changes after applying suppression specifications)
we can simplify the logic of determining if the corpora have
"worthwhile" changes, in abidiff.

	* tools/abidiff.cc (main): Simplify the logic when determining if
	the comparison between two corpora yields worthwhile changes.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-21 12:54:57 +02:00
Dodji Seketeli
92b821034a Clean up the output of abicompat weak mode
Remove ugly vertical spaces from the output of abicompat in weak
mode and adjust regression tests accordingly.

	* tools/abicompat.cc (perform_compat_check_in_weak_mode): Remove
	disgracious vertical spaces in the wording.
	* tests/data/test-abicompat/test5-fn-changed-report-0.txt: Adjust.
	* tests/data/test-abicompat/test6-var-changed-report-0.txt: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-20 16:01:27 +02:00
Sinny Kumari
ab1316bcbc Display --suppressions|--suppr option in help usage
* tools/abipkgdiff.cc (display_usage): Print
	 --suppressions|--suppr <path> option in help usage

Signed-off-by: Sinny Kumari <sinny@redhat.com>
2015-07-20 12:47:07 +02:00
Dodji Seketeli
78e7890b20 Fix the wording of description of abipkgdiff.cc again
* tools/abipkgdiff.cc: Fix the wording again.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-20 10:15:00 +02:00
Dodji Seketeli
f681c33970 Remove use of tmpnam from abilint
We were using the unsafe tmpnam function in abilint.  This patch
creates a helper type abigail::tools_utils::temp_file that does away
with the use tmpnam in abilint.

	* include/abg-tools-utils.h (abigail::tools_utils::temp_file):
	Declare new type.
	(abigail::tools_utils::temp_file_sptr): New typedef.
	* src/abg-tools-utils.cc (temp_file::priv): Define new type.
	(temp_file::{temp_file, is_good, get_path, get_stream, create}):
	Define new member functions.
	* tools/abilint.cc (main): Do not use tmpnam anymore.  Use the new
	abigail::tools_utils::temp_file type instead.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-20 10:06:17 +02:00
Dodji Seketeli
1ddde3d9d0 Try to avoid a race condition when abipkgdiff extracts packages.
abipkgdiff extracts the content of the first package in a directory
named <tmpdir>/package1 and the content second package in
<tmpdir>/package2.  If two independant instances of abipkgdiff are
launched at the same time, they are going to walk on each others'
toes, to say the least.

This patch extracts the content of each package in directory named
<tmpdir>/<randomname>/package1, where randomname is supposed to be a
random number, and so should be unique, most of the time.

I guess we should try harder to generate a randomname that is unique
when we see that the directory <tmpdir>/<randomname> exists already,
but for now, what we have is good enough, or at least better than what
we have had so far.

	* include/abg-tools-utils.h (get_random_number)
	(get_random_number_as_string): Declare new functions.
	* src/abg-tools-utils.cc (get_random_number)
	(get_random_number_as_string): Define them.
	* tools/abipkgdiff.cc
	(package::extracted_package_parent_dir_path): New data member.
	(package::package): Initialize
	package::extracted_package_parent_dir_path to
	<tmpdir>/<randomname>, with randomname being a random number
	represented as a string.
	(extract_rpm): Make sure to create a hierarchy of directories, not
	just a directory.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-20 00:02:00 +02:00
Dodji Seketeli
77fa0621e4 Fix the wording of the description of the abipkgdiff.cc file
* tools/abipkgdiff.cc: Fix the wording of the description.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-19 19:54:57 +02:00
Dodji Seketeli
80dc31f540 Add --suppressions to abipkgdiff
* tools/abipkgdiff.cc (options::suppressions): New data member.
	(set_diff_context_from_opts): Set the suppression specifications
	provided by the user to the diff context.
	(parse_command_line): Parse the --suppressions and --suppr command
	line options.
	* doc/manuals/abipkgdiff.rst: Document the --suppressions and
	--suppr options.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-19 19:52:01 +02:00
Dodji Seketeli
7f67f2573d Fix the --verbose option
When a binary cannot be analyzed by abipkgdiff, silently skip it
unless --verbose is used, in which case, display a message saying
that it couldn't be analyzed.

	* tools/abipkgdiff.cc (compare): In the elf_file overload, do not
	emit an error message when a binary could not be analyzed unless
	--verbose was provided.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:36 +02:00
Dodji Seketeli
317f4e1ff3 Cleanup the output for added/removed binaries
* tools/abipkgdiff.cc (compare): In the overload for packages,
	indent the content of the "Removed binaries" and "Added binaries"
	paragraphs.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:24 +02:00
Dodji Seketeli
3b85f2864d Avoid redundant diff report messages by default.
Just like what abidiff does, this patch avoids emitting redundant diff
report messages unless the user provides the --redundant switch.

	* tools/abipkgdiff.cc (options::show_redundant_changes): New data
	member.
	(options::options): Initialize it.
	(display_usage): Add a help string for the --redundant command
	Line option.
	(set_diff_context_from_opts): New static function.
	(compare): Take the options variable.  Set the diff context from
	the options, especially if we should show redundant changes or
	not.  Use that diff context when comparing ABIs.
	(parse_command_line): Parse the new --redundant command line
	switch.
	* doc/manuals/abipkgdiff.rst: Document the new --redundant option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:20 +02:00
Dodji Seketeli
71a5e0762e Support comparing only shared libraries
It turned out on some packages we are interested on comparing shared
libraries only.  This patch adds that functionality by adding a new
--dso-only command line option to abipkgdiff.

	* tools/abipkgdiff.cc (options::compare_dso_only): New data
	member.
	(options::options): Initialize it.
	(display_usage): Display a little help string for it.
	(create_maps_of_package_content): Take the option variable.  Do
	not compare non-dso files if the --dso-only option was provided.
	(extract_package_and_map_its_content, prepare_packages, compare):
	Take the option variable.
	(parse_command_line): Parse the new --dso-only option.
	* doc/manuals/abipkgdiff.rst: Add documentation for the new
	--dso-only option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:15 +02:00
Dodji Seketeli
2da9825c59 Comment functions and types of abipkgdiff
* src/abg-dwarf-reader.cc (get_soname_of_elf_file): Better wording
	of the apidoc of this function.
	* tools/abipkgdiff.cc (verbose, elf_file_paths): Add apidoc for
	these global variables.
	(struct options, ): Add apidoc for these types.
	(options::{erase_extraction_directory,
	erase_extraction_directories}, display_usage, extract_rpm)
	(erase_created_temporary_directories, extract_package)
	(file_tree_walker_callback_fn, compare)
	(create_maps_of_package_content)
	(extract_package_and_map_its_content, prepare_packages, compare)
	(parse_command_line): Add apidoc for these functions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:11:08 +02:00
Dodji Seketeli
21bf2a87d8 Comment functions and types of abipkgdiff
* src/abg-dwarf-reader.cc (get_soname_of_elf_file): Better wording
	of the apidoc of this function.
	* tools/abipkgdiff.cc (verbose, elf_file_paths): Add apidoc for
	these global variables.
	(struct options, ): Add apidoc for these types.
	(options::{erase_extraction_directory,
	erase_extraction_directories}, display_usage, extract_rpm)
	(erase_created_temporary_directories, extract_package)
	(file_tree_walker_callback_fn, compare)
	(create_maps_of_package_content)
	(extract_package_and_map_its_content, prepare_packages, compare)
	(parse_command_line): Add apidoc for these functions.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:10:07 +02:00
Dodji Seketeli
080218e6a1 Various style fixes
* abipkgdiff.cc (get_soname_of_elf_file): Fix spacing.
	* tools/abipkgdiff.cc (elf_file_paths): Make this global variable
	static.
	(extract_rpm): Rename parameter pkg_path name into package_path.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:10:03 +02:00
Dodji Seketeli
5df40e91ce Remove the last direct fiddling with ELF from abipkgdiff.cc
Directly using elfutils from abipkgdiff.cc feels like a taping into
the wrong abstraction layer from this level.  So this patch moves the
determination of the type of elf file into abg-dwarf-reader.cc and
uses it from there.  The patch also simplifies the instantiation of
types elf_file and package, from abipkgdiff.cc.

	* abg-dwarf-reader.h (enum elf_type): Move this declaration here
	from abipkgdiff.cc to here.
	(get_type_of_elf_file): Declare this new function.
	(get_soname_from_elf): Change this to take a path to the elf file
	rather than a Elf* handler.  So now to use this, the user doesn't
	have to get her hand dirty with elfutils.
	* src/abg-dwarf-reader.cc (get_soname_from_elf): Change this to
	take a path to the elf file rather than a Elf* handler.
	(elf_file_type): Move this static function here, from
	abipkgdiff.cc.
	(get_type_of_elf_file): New function.  This has been factorized
	out of create_maps_of_package_content() in abipkgdiff.cc.
	* tools/abipkgdiff.cc (class elf_file): Changed struct elf_file
	into this.  Make the default constructor private.
	(elf_file::elf_file): Change the constructor to just take the path
	to the elf_file.  The base name, soname and elf file type are now
	computed from the path file, in the constructor.  This makes
	instantiation much much easier from the point of view of the user
	of the type.
	(struct abi_diff): Renamed struct abi_changes into this.
	(abi_diff::has_changes): Define new member function.
	(abi_diffs): Remove this global variable.
	(package::package): Remove the elf file type from the set of
	parameters of this constructor.  Rather, compute that elf file
	type from the path to the elf file, in the constructor.  Again,
	this eases the use of the type.
	(elf_file_type): Remove this from here, as it got moved to
	abg-dwarf-reader.cc.
	(compare): In the elf_file overload, return true if the comparison
	yields ABI changes.
	(create_maps_of_package_content): Do not fiddle with elfutils
	stuff here.  Rather, just instantiate elf_file and the analyzing
	of the file magically happens.
	(compare): Make the package overload take an abi_diff as output
	parameter, rather than populating a global variable in return.
	(compare): Add an other overload for package that doesn't take the
	abi_diff as output parameter and write it in terms of the previous
	one.
	(main): Adjust as the instantiation of package is now simpler.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:57 +02:00
Dodji Seketeli
e96f9f3690 Add a --verbose option to abipkgdiff
It turned out it's important to be able to see what abipkgdiff is
actually doing.  This patch adds a --verbose option that emits many
useful information about the tool's progress.

	* tools/abipkgdiff.cc (verbose): Add a new global variable.
	(package::erase_extraction_directory, extract_rpm, compare)
	(create_maps_of_package_content): Emit verbose information.
	(parse_command_line): Parse the --verbose option.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:53 +02:00
Dodji Seketeli
3aa51dac47 Use the library to implement ABI comparison in abipkgdiff
Until now, abipkgdiff was spawning a process running the 'abidiff'
command line tool to perform ABI comparison on binaries.  This helped
in sketching what was possible with this tool.  However, it's
sub-optimal in a final setup so this patch uses the libabigail library
to perform that comparison.

	* tools/abipkgdiff.cc (compare): In the overload for elf_file, use
	abigail::comparison::compute_diff() to compare the ABI of two
	corpora.  The corpora themselves is read using
	abigail::dwarf_reader::read_corpus_from_elf().  This cleans up the
	output of the tool because nothing is emitted to standard output
	if the two ABI corpora compares equal.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:43 +02:00
Dodji Seketeli
2c3677bcfa Fix several string passing issues in abipkgdiff.cc
A number of functions have string parameters passed by value.  Ooops.
They must be passed by reference.

Fixed thus.

	* tools/abipkgdiff.cc (elf_file::elf_file): Pass the strings by
	reference.  Also, change the order of the parameters; all the
	strings are passed first, then the elf_type is passed last.
	(package::package): Likewise, pass the strings by reference, not
	by value.
	(create_maps_of_package_content): Adjust for the change in
	parameters order of elf_file::elf_file.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:36 +02:00
Dodji Seketeli
63ffa0320a Only try to compare DSOs or executable binaries in abipkgdiff
* tools/abipkgdiff.cc (compare): In the overload for packages,
	only compare binaries that are DSO or executable.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:14 +02:00
Dodji Seketeli
e6dc360038 Avoid flushing the output stream in abipkgdiff.cc
* tools/abipkgdiff.cc (extract_package)
	(create_maps_of_package_content, compare, main): Avoid flushing
	the output stream arbitrarily.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:09:06 +02:00
Sinny Kumari
254dfd3655 Move get_soname() function to abg-dwarf-reader.h/cc
Initially, fetching SONAME from a given DSO file was done in
abipkgdiff.cc. But, this function fits better when defined in
abg-dwarf-reader.cc in order to make it usable by other tools if
needed. For consistancy, get_soname() function has been renamed to
get_soname_from_elf().

        * include/abg-dwarf-reader.h (get_soname_from_elf): Declare
         new function
        * src/abg-dwarf-reader.cc (get_soname_from_elf): Define new
        function
        * tools/abipkgdiff.cc (get_soname): Remove function
        (pkg_diff): Call get_soname_from_elf() instead of get_soname()

Signed-off-by: Sinny Kumari <sinny@redhat.com>
2015-07-17 10:09:06 +02:00
Dodji Seketeli
e0b4f2b7e2 Important organizational changes in abipkgdiff.cc
This patch introduces many changes that should hopefully improve
legibility and ease of maintenance.  Here is a list of the topic of
the changes:

  * Avoid using shortened names when the line is not too long.

  * Use shared_ptr when possible.

  * When a function parameter is not meant to be nil, do not pass it
    as a pointer; rather, pass it as a reference.

  * Avoid doing things that can "fail" in a destructor; e.g, spawning
    a process.  Also, it's not common practise to cleanup a resource in a
    type destructor, when that resource has not been created in one of the
    member functions of the type.  It eases maintenance when resource
    creation and cleanup is performed at the same logical level.

	* tools/abipkgdiff.cc (option::package{1,2}): Rename
	option::pkg{1,2} into this, to increase legibility.
	(option::debug_package{1,2}): Likewise, rename
	option::debug_pkg{1,2} into this.
	(elf_file::~elf_file): Do not "delete this" in a destructor.  This
	leads to double free.  It's when someone invokes the "delete"
	operator on a pointer to the object that the destructor of the
	object is executed automatically; so if in the destructor the
	delete operator is called again, bad things are going to happen.
	As the destructor is now empty, remove it altogether.
	(elf_file_sptr): New typedef for shared_ptr<elf_file>.
	(package::path): Rename package::pkg_path into this, for better
	legibility.
	(package::extracted_package_dir_path): Rename
	package::extracted_pkg_dir_path into this.
	(package::type): Rename package::pkg_type into this.
	(package::is_debug_info): Rename package::is_debuginfo_pkg into
	this.
	(package::path_elf_file_sptr_map): Rename
	package::dir_elf_files_map into this because this is a map of
	path -> elf_file_sptr.  Also, now the value of the map element is
	a elf_file_sptr, no more an elf_file*.
	(package::debug_info_package): Rename package::debuginfo_pkg into
	this.
	(package::package): Adjust for the changes above.
	(package::{erase_extraction_directory,
	erase_extraction_directories}): New member functions.
	(elf_file_paths): Renamed dir_elf_files_path into this.
	(erase_created_temporary_directories)
	(create_maps_of_package_content)
	(extract_package_and_map_its_content, prepare_packages): New
	static functions.
	(get_soname, elf_file_type, extract_rpm): Make this static.
	(extract_package): Take a const package& rather than a
	package_sptr to express that the function really expects a non-nil
	object by reference (not by copy) and that the object won't be
	modified.  Using a reference removes the possibility that the
	pointer could be nil, causing crashes in the code where
	parameter->something was used.  Now only parameter.something can
	be used, so no crash possible there.  This is more solid code.
	(file_tree_walker_callback_fn): Rename callback() into this.  It
	makes the code more legible and kind of 'self-documented'.  At
	least you get the hint that this is a callback function for some
	file tree walking (ftw) function. Adjust for the relevant names
	renaming above.
	(compare): Rename compute_abidiff into this; again, this increases
	legibility; at least at the point of use of this function.  Rename
	compare_package() into a an overload of compare() as well.
	compare_package() used to take a vector of packages.  It was hard
	to guess by reading the signature of the function, which element
	of the vector is expected to be the first vector of the
	comparison, which one is to be the second, etc.  Now, this
	function takes two packages, named first_package and
	second_package.  That is more "typed"; that is, the signature is
	more meaningful.  Greater legibility, hopefully.  And in the body
	of the function, the debug information packages are now accessed
	using the package::debug_info_package data member.  Again, this is
	less surprising, I believe.  Also, explicitly erase the temporary
	files that were created during this comparison.  All this
	simplifies the logic of this function, hopefully.
	(parse_command_line): Make this static.  Add new --d1 and --d2
	command line switches that are shortcuts of --debug-info-pkg1 and
	--debug-info-pkg2.  Adjust this function for the relevant name
	changes above.  Make lines be shorter than 80 characters.
	(main): Do not create any vector of parameters anymore as the
	compare_packages() function don't take any vector of parameter
	anymore.  Just instantiate first_package and second_package now.
	Adjust for the relevant name changes above.  This hopefully
	simplifies the logic of this function.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:08:56 +02:00
Dodji Seketeli
c53994326e Wording fixes in abipkgdiff.cc
Through the libabigail project, we try to:
 1/ make function names start with a verb
 2/ avoid shortening function names, *unless* longer names make the
 current line exceed 80 characters per line.

We believe these rules improve legibility for people reading the code.

This patch slightly changes abipkgdiff.cc file to comply with the
above.

	* tools/abipkgdiff.cc (extract_package): Renamed extract_pkg into
	this because shortening 'package' into 'pkg' provides no
	legibility improvement.
	(compare_packages): Renamed pkg_diff() into this, so that the name
	of the function starts with a verb, and the shortened 'pkg' word
	is renamed back to the 'package' word.  This way, the code almost
	reads like normal English sentences with verbs and complement,
	thus enhancing legibility and easing latter maintenance.
	(main): Adjust for the changes above.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:08:42 +02:00
Dodji Seketeli
039db6cbfe Re-indent tools/abipkgdiff.cc
While reading the source code, I realized parts of it where not yet
following the GNU-style indentation of the rest of the project files.

So I thought I'd do this early now, so that other changes happen on
top of the properly indented file.

Fixed thus.

	* tools/abipkgdiff.cc: Re-indent the file properly and fix some
	white spacing here and there.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:08:34 +02:00
Dodji Seketeli
397aaea630 Some slight typo and wording fixes in abipkgdiff
* tools/abipkgdiff.cc (display_usage): Fixed the typo in
	'bi-pacakge.'  Also, refer to 'package', not to 'bi-package' that
	is surprising to the user at first.
	(compute_abidiff): Shorten the size of the introductory line.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
2015-07-17 10:08:26 +02:00