From fa5a5acbbcb1e3909eff592ddc41040d98301971 Mon Sep 17 00:00:00 2001 From: Dodji Seketeli Date: Thu, 28 Apr 2016 13:03:28 +0200 Subject: [PATCH] [abipkgdiff] Show SONAME of removed/added libraries When abipkgdiff says that a library was added or removed, it doesn't tell us about the SONAME of that library, making it hard for the user to guess that maybe this adding/removal is probably due to a SONAME change. This patch fixes that. * tools/abipkgdiff.cc (abi_diff::{added,removed}_binaries): Change the type of these data member from vector to vector. (compare): Adjust. Show the soname of added/removed binaries. Signed-off-by: Dodji Seketeli --- tools/abipkgdiff.cc | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc index 7bd1367e..83f39904 100644 --- a/tools/abipkgdiff.cc +++ b/tools/abipkgdiff.cc @@ -224,9 +224,9 @@ typedef int (*ftw_cb_type)(const char *, const struct stat*, int); /// binaries, and binaries whic ABI changed. struct abi_diff { - vector added_binaries; - vector removed_binaries; - vector changed_binaries; + vector added_binaries; + vector removed_binaries; + vector changed_binaries; /// Test if the current diff carries changes. /// @@ -1414,7 +1414,7 @@ compare(package& first_package, } else { - diff.removed_binaries.push_back(it->second->name); + diff.removed_binaries.push_back(it->second); status |= abigail::tools_utils::ABIDIFF_ABI_INCOMPATIBLE_CHANGE; status |= abigail::tools_utils::ABIDIFF_ABI_CHANGE; } @@ -1515,22 +1515,40 @@ compare(package& first_package, second_package.path_elf_file_sptr_map().begin(); it != second_package.path_elf_file_sptr_map().end(); ++it) - diff.added_binaries.push_back(it->second->name); + diff.added_binaries.push_back(it->second); if (diff.removed_binaries.size()) { cout << "Removed binaries:\n"; - for (vector::iterator it = diff.removed_binaries.begin(); + for (vector::iterator it = diff.removed_binaries.begin(); it != diff.removed_binaries.end(); ++it) - cout << " " << *it << "\n"; + { + cout << " " << (*it)->name << ", "; + string soname; + get_soname_of_elf_file((*it)->path, soname); + if (!soname.empty()) + cout << "SONAME: " << soname; + else + cout << "no SONAME"; + cout << "\n"; + } } if (opts.show_added_binaries && diff.added_binaries.size()) { cout << "Added binaries:\n"; - for (vector::iterator it = diff.added_binaries.begin(); + for (vector::iterator it = diff.added_binaries.begin(); it != diff.added_binaries.end(); ++it) - cout << " " << *it << "\n"; + { + cout << " " << *it << ", "; + string soname; + get_soname_of_elf_file((*it)->path, soname); + if (!soname.empty()) + cout << "SONAME: " << soname; + else + cout << "no SONAME"; + cout << "\n"; + } } if (!opts.keep_tmp_files)