* 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>
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>
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>
* 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>
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>
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>
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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
* 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>
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>
* 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>
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>
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>
* 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>
* 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>
* 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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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>
* 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>
The compiler complains that in function callback(), parameters st and
flag are unused. In that case, C++ allows the name of the parameter
to be omitted; that makes the compiler complaint go away.
* tools/abipkgdiff.cc (callback): Remove the name of parameters st
and flag.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
In this declaration:
const bool
extract_rpm(const string& pkg_path, const string &extracted_pkg_dir_path)
the compiler rightfully complains that the const qualifier on the
return type is useless. This is because the value is returned by copy
so the const-ness is not relevant.
Fixed thus.
* tools/abipkgdiff.cc (extract_rpm): Remove useless const qualifier.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The compiler complains that there are some branches in the
get_soname() function that don't end up with a return statement. For
instance, there is no return statement right before the end of the
function, in case the outermost for loop is not taken.
This patch fixes that by having just one return statement at the end
of the function.
* tools/abipkgdiff.cc (get_soname): Have just one return statement
at the end of this function.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
The compiler rightfully complains that data members should be
initialized in the other in which they are declared.
Fixed thus.
* tools/abipkgdiff.cc (elf_file::elf_file): Initialize data member
in the same order as they were declared.
(package::package): Likewise.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Removed binaries can also lead to ABI breakage if an applicating was using
it previously. So, display it in ABI change report. Also, looking for
ABI change in symbolic link files doesn't make sense. Now, we are not
looking into ABI changes in symlink binaries.
* tools/abipkgdiff.cc (abi_changes): Declare new struct
(callback): Exclude symbloic link file for durther processing
(compute_abidiff): Consider SONAME if exists as key in map instead
of binary name, else binary as key. Also, print if removed/added
binaries exist between packages
Now, abipkgdiff can take two rpm packages and optional corresponding
debug-info pacakges. It look for same binary in both rpm directory and
if found calls abdiff along with debug-info options to get ABI changes
between them.
* tools/abipkgdiff.cc (compute_abidiff): New function
tools/abipkgdiff.cc (pkg_diff): Iterate through list of binaries
in both package directory and call compute_diff function if
same binary found in both file.
tools/abipkgdiff.cc (main): Also consider debug-info directories
avilable in debu-info packages.
Signed-off-by: Sinny Kumari <sinny@redhat.com>
An RPM package may conatins binaries, source/header files, config files,
etc. For abi check we are interested only in ELF binary files. This commit
stores binary files from extracted RPM in a map whose key is
binary file basename and value is struct elf_file with memeber variable
name, path, soname, type
* tools/abipkgdiff.cc (elf_type): Declare new enum
(elf_file): Declare new struct
(package): Add member variable dir_elf_files_map
(get_soname): Define new function
(elf_file_type): Define new function
(extract_rpm): Iterate over extracted directory files
and filter ELF binary files along with their information
like name, soname, elf_type and save in dir_elf_files_map
Input pacakges need to extracted for further processing which includes
fecthing all files in extracted rpms and look for ELF files aginst
which abi diff is required. Pacakges will be extracted in system tmp
directory.
* tools/abipkgdiff.cc (struct package): Declare new struct
(package_sptr): Declare shared_ptr for struct package
(extract_rpm): Define new fuction to extract rpm package
(extract_pkg): Define new function to extract pacakge
(pkg_diff): Define new function to get ABI diff between
two packages
(main): Create new object of type pacakge for each binary
and debuginfo pacakge passed in commandline options
Signed-off-by: Sinny Kumari <sinny@redhat.com>
To run abipkgdiff between two pacakges, it should know whether
input files are valid pacakge file or not. This patch detects RPM and SRPM
pacakge file type. abipkgdiff uses it to know whether input files are
valid RPM pacakge file or not.
* include/abg-tools-utils.h (file_type): Added member
FILE_TYPE_RPM and FILE_TYPE_SRPM
(operator<<): New function declaration.
* src/abg-tools-utils.cc (file_type): Detect RPM and
SRPM file type
(operator<<): New function definition
* tools/abidiff.cc (main): Check for RPM and SRPM
file type as well.
* tools/abilint.cci (main): Check for RPM and SRPM file
type as well.
* tools/abipkgdiff.cc (main): Check whether input files
to abipkgdiff are valid RPM files or not.
Signed-off-by: Sinny Kumari <sinny@redhat.com>