]> sourceware.org Git - libabigail.git/commitdiff
Bug 22436 - make abipkgdiff accept several debuginfo packages
authorDodji Seketeli <dodji@redhat.com>
Mon, 27 Nov 2017 14:45:47 +0000 (15:45 +0100)
committerDodji Seketeli <dodji@redhat.com>
Mon, 27 Nov 2017 16:15:20 +0000 (17:15 +0100)
Sometimes, the debug information for one given package P can have been
split into several packages.  In that case, we need abipkgdiff to
consider several debug info packages for a given input binary package.

This patch makes abipkgdiff to accept several --d{1,2} <debug-info-package>
option, for a given input package.

* doc/manuals/abipkgdiff.rst: Document the fact that --d{1,2} can
be provided several times on the command line.
* tools/abipkgdiff.cc (options::debug_packages{1,2}): Rename the
debug_package{1,2} data members into this, and make them be vector
of strings, rather than just strings.
(package::debug_info_packages_): Renamed
package::debug_info_package_ into this and make it be a vector of
package_sptr, rather than just a package_sptr.
(package::debug_info_packages): Renamed the method
package::debug_info_package into this and -- for the getter
overload -- make it return a vector of package_sptr, rather than
just a package_sptr.  Likewise for the setter overload.  Add a
non-const getter overload.
(package::erase_extraction_directories)
(extract_package_and_map_its_content): Adjust.
(extract_rpm, extract_deb): Do not erase the content of the
extraction directory (if it was pre-existing) prior to extracting
the RPM/deb into it.
(pkg_extraction::pkgs): Renamed pkg_extraction::pkg into this and
make it be a vector of packages, rather than just a package.
(pkg_extraction::pkg_extraction): Adjust to take a package_sptr
rather than just a package.  Add an overload to take a vector of
packages_sptr.
(pkg_extraction::perform): Extract the vector of package that the
task is not responsible for, not just one random package.
(extract_package_and_map_its_content): Adjust.
(prepare_packages): Take smart pointers to package rather than
just packages.  Adjust accordingly.
(compare_prepared_package): Make the overload that takes two
packages to take two smart pointers of packages.
(compare): Make the overload that takes two package take two
package_sptr.
(parse_command_line): Parse having --d{1,2} several times for a
given input package.
(main): Take several debug info packages for one input file.
* include/abg-tools-utils.h (split_string): Declare ...
* src/abg-tools-utils.cc (split_string): ... new function.
* tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm:
Add a new RPM test input file.
* tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt:
new reference output file.
* tests/data/Makefile.am: Add the new test input files above to source
distribution.
* tests/test-diff-pkg.cc (in_out_spec): Add new test entry to
specify two debug info packages for one input package.
(test_task::perform): Support having several debug info package
paths in the IntOutSpec::{first,second}_in_debug_package_path data
member.  The debug info packages paths are separated by either a
white space or commas.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
doc/manuals/abipkgdiff.rst
include/abg-tools-utils.h
src/abg-tools-utils.cc
tests/data/Makefile.am
tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm [new file with mode: 0644]
tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt [new file with mode: 0644]
tests/test-diff-pkg.cc
tools/abipkgdiff.cc

index 86d614a53955d87a71b0585b686098454bfe077d..ba4c36d032ec5b5edc359dc6386fb926650a49f6 100644 (file)
@@ -74,12 +74,22 @@ Options
     into a separate file, tells ``abipkgdiff`` where to find that
     separate debug information package.
 
+    Note that the debug info for *package1* can have been split into
+    several different debug info packages.  In that case, several
+    instances of this options can be provided, along with those
+    several different debug info packages.
+
   * ``--debug-info-pkg2 | --d2`` <path>
 
     For cases where the debug information for *package2* is split out
     into a separate file, tells ``abipkgdiff`` where to find that
     separate debug information package.
 
+    Note that the debug info for *package2* can have been split into
+    several different debug info packages.  In that case, several
+    instances of this options can be provided, along with those
+    several different debug info packages.
+
   * ``--devel-pkg1 | --devel1`` <path>
 
     Specifies where to find the `Development Package`_ associated with
index 99c4f7aaee2ee997fdaa311e9b7c9a9d0b1f4153..850ca18274b519a893114c980337d81a92f81081 100644 (file)
@@ -60,6 +60,7 @@ bool string_ends_with(const string&, const string&);
 bool string_begins_with(const string&, const string&);
 bool string_is_ascii(const string&);
 bool string_is_ascii_identifier(const string&);
+bool split_string(const string&, const string&, vector<string>&);
 
 suppr::type_suppression_sptr
 gen_suppr_spec_from_headers(const string& hdrs_root_dir);
index c08f35a5fa2701f28dc2512600ef0bcebe68bd9a..554e04cb2fb7883d59baa34c903db368c0896876 100644 (file)
@@ -586,6 +586,56 @@ string_is_ascii_identifier(const string& str)
   return true;
 }
 
+/// Split a given string into substrings, given some delimiters.
+///
+/// @param input_string the input string to split.
+///
+/// @param delims a string containing the delimiters to consider.
+///
+/// @param result a vector of strings containing the splitted result.
+///
+/// @return true iff the function found delimiters in the input string
+/// and did split it as a result.  Note that if no delimiter was found
+/// in the input string, then the input string is added at the end of
+/// the output vector of strings.
+bool
+split_string(const string& input_string,
+            const string& delims,
+            vector<string>& result)
+{
+  size_t current = 0, next;
+  bool did_split = false;
+
+  do
+    {
+      // Trim leading white spaces
+      while (current < input_string.size() && isspace(input_string[current]))
+       ++current;
+
+      if (current >= input_string.size())
+       break;
+
+      next = input_string.find_first_of(delims, current);
+      if (next == string::npos)
+       {
+         string s = input_string.substr(current);
+         if (!s.empty())
+           result.push_back(input_string.substr(current));
+         did_split = (current != 0);
+         break;
+       }
+      string s = input_string.substr(current, next - current);
+      if (!s.empty())
+       {
+         result.push_back(input_string.substr(current, next - current));
+         did_split = true;
+       }
+      current = next + 1;
+    }
+  while (next != string::npos);
+
+  return did_split;
+}
 
 /// The private data of the @ref temp_file type.
 struct temp_file::priv
index 7d8d25f74b5c4c989ea55ef985b241628c9e084b..132c0b76eeec798f1a080b2ab3b6b030ca9cb3f7 100644 (file)
@@ -1347,7 +1347,9 @@ test-diff-pkg/libcdio-debuginfo-0.94-1.fc26.x86_64.rpm \
 test-diff-pkg/libcdio-debuginfo-0.94-2.fc26.x86_64.rpm \
 test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm \
 test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm \
+test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm \
 test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt \
+test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt \
 \
 test-fedabipkgdiff/dbus-glib-0.104-3.fc23.x86_64.rpm \
 test-fedabipkgdiff/dbus-glib-debuginfo-0.104-3.fc23.x86_64.rpm \
diff --git a/tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm b/tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm
new file mode 100644 (file)
index 0000000..727dadf
Binary files /dev/null and b/tests/data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm differ
diff --git a/tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt b/tests/data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt
new file mode 100644 (file)
index 0000000..e69de29
index d2cbccaef5aae88ba4a1ddbb7f0e031b8ef0691b..4e2c94d51f46987ad306e0570581971e88361d31 100644 (file)
 #include <string>
 #include <cstdlib>
 #include <iostream>
+#include <vector>
 #include "abg-workers.h"
 #include "test-utils.h"
 #include "abg-tools-utils.h"
 
 using std::string;
+using std::vector;
 using std::cerr;
 using abigail::tests::get_src_dir;
+using abigail::tools_utils::split_string;
 
 struct InOutSpec
 {
@@ -522,6 +525,20 @@ static InOutSpec in_out_specs[] =
     "data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt",
     "output/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-0.txt"
   },
+  {
+    "data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
+    "data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64.rpm",
+    "--fail-no-dbg",
+    "",
+    "data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm "
+    "data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
+    "data/test-diff-pkg/libxfce4ui-debuginfo-4.12.1-8.fc27.ppc64.rpm "
+    "data/test-diff-pkg/libxfce4ui-devel-debuginfo-4.12.1-8.fc27.ppc64.rpm",
+    "",
+    "",
+    "data/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt",
+    "output/test-diff-pkg/libxfce4ui-devel-4.12.1-8.fc27.ppc64-self-report-ok-0.txt"
+  },
 #endif //WITH_RPM
 
 #ifdef WITH_DEB
@@ -575,9 +592,9 @@ struct test_task : public abigail::workers::task
     string first_in_package_path, second_in_package_path,
       prog_options,
       ref_abi_diff_report_path, out_abi_diff_report_path, cmd, abipkgdiff,
-      first_in_debug_package_path, second_in_debug_package_path,
       first_in_devel_package_path, second_in_devel_package_path,
       suppression_path;
+    vector<string> first_in_debug_package_paths, second_in_debug_package_paths;
 
     first_in_package_path =
       string(get_src_dir()) + "/tests/" + spec.first_in_package_path;
@@ -588,17 +605,36 @@ struct test_task : public abigail::workers::task
 
     if (spec.first_in_debug_package_path
        && strcmp(spec.first_in_debug_package_path, ""))
-      first_in_debug_package_path =
-       string(get_src_dir()) + "/tests/" + spec.first_in_debug_package_path;
+      {
+       vector<string> debug_info_pkg_paths;
+       split_string(spec.first_in_debug_package_path, ", ",
+                    debug_info_pkg_paths);
+       assert(!debug_info_pkg_paths.empty());
+       for (vector<string>::const_iterator s = debug_info_pkg_paths.begin();
+            s != debug_info_pkg_paths.end();
+            ++s)
+         first_in_debug_package_paths.push_back(string(get_src_dir()) +
+                                                "/tests/" + *s);
+      }
     else
-      first_in_debug_package_path.clear();
+      first_in_debug_package_paths.clear();
 
     if (spec.second_in_debug_package_path
        && strcmp(spec.second_in_debug_package_path, ""))
-      second_in_debug_package_path =
-       string(get_src_dir()) + "/tests/" + spec.second_in_debug_package_path;
+      {
+       vector<string> debug_info_pkg_paths;
+       split_string(spec.second_in_debug_package_path,
+                    ", ",
+                    debug_info_pkg_paths);
+       assert(!debug_info_pkg_paths.empty());
+       for (vector<string>::const_iterator s = debug_info_pkg_paths.begin();
+            s != debug_info_pkg_paths.end();
+            ++s)
+         second_in_debug_package_paths.push_back(string(get_src_dir()) +
+                                                 "/tests/" + *s);
+      }
     else
-      second_in_debug_package_path.clear();
+      second_in_debug_package_paths.clear();
 
     if (spec.first_in_devel_package_path
        && strcmp(spec.first_in_devel_package_path, ""))
@@ -635,10 +671,17 @@ struct test_task : public abigail::workers::task
     if (!prog_options.empty())
       abipkgdiff +=  " " + prog_options;
 
-    if (!first_in_debug_package_path.empty())
-      abipkgdiff += " --d1 " + first_in_debug_package_path;
-    if (!second_in_debug_package_path.empty())
-      abipkgdiff += " --d2 " + second_in_debug_package_path;
+    for (vector<string>::const_iterator p =
+          first_in_debug_package_paths.begin();
+        p != first_in_debug_package_paths.end();
+        ++p)
+      abipkgdiff += " --d1 " + *p;
+
+    for (vector<string>::const_iterator p =
+          second_in_debug_package_paths.begin();
+        p != second_in_debug_package_paths.end();
+        ++p)
+      abipkgdiff += " --d2 " + *p;
 
     if (!first_in_devel_package_path.empty())
       abipkgdiff += " --devel1 " + first_in_devel_package_path;
index 6eea1598ce2965a751c01647529e9045ad7c6127..8ce591ce22b7c5f2fbc867244f5e74ede19746a2 100644 (file)
@@ -171,8 +171,8 @@ public:
   bool         parallel;
   string       package1;
   string       package2;
-  string       debug_package1;
-  string       debug_package2;
+  vector<string> debug_packages1;
+  vector<string> debug_packages2;
   string       devel_package1;
   string       devel_package2;
   size_t       num_workers;
@@ -321,7 +321,7 @@ private:
   abigail::tools_utils::file_type      type_;
   kind                                 kind_;
   map<string, elf_file_sptr>           path_elf_file_sptr_map_;
-  package_sptr                         debug_info_package_;
+  vector<package_sptr>                 debug_info_packages_;
   package_sptr                         devel_package_;
   package_sptr                         kabi_whitelist_package_;
   suppressions_type                    private_types_suppressions_;
@@ -439,22 +439,44 @@ public:
   path_elf_file_sptr_map()
   {return path_elf_file_sptr_map_;}
 
-  /// Getter for the debug info package associated to the current
+  /// Getter for the debug info packages associated to the current
   /// package.
   ///
-  /// @return the debug info package associated to the current
+  /// There can indeed be several debug info packages needed for one
+  /// input package, as the debug info for that input package can be
+  /// split across several debuginfo packages.
+  ///
+  /// @return the debug info packages associated to the current
   /// package.
-  const shared_ptr<package>&
-  debug_info_package() const
-  {return debug_info_package_;}
+  const vector<package_sptr>&
+  debug_info_packages() const
+  {return debug_info_packages_;}
+
 
-  /// Setter for the debug info package associated to the current
+  /// Getter for the debug info packages associated to the current
   /// package.
   ///
+  /// There can indeed be several debug info packages needed for one
+  /// input package, as the debug info for that input package can be
+  /// split across several debuginfo packages.
+  ///
+  /// @return the debug info packages associated to the current
+  /// package.
+  vector<package_sptr>&
+  debug_info_packages()
+  {return debug_info_packages_;}
+
+  /// Setter for the debug info packages associated to the current
+  /// package.
+  ///
+  /// There can indeed be several debug info packages needed for one
+  /// input package, as the debug info for that input package can be
+  /// split across several debuginfo packages.
+  ///
   /// @param p the new debug info package.
   void
-  debug_info_package(const shared_ptr<package> p)
-  {debug_info_package_ = p;}
+  debug_info_packages(const vector<package_sptr> &p)
+  {debug_info_packages_ = p;}
 
   /// Getter for the devel package associated to the current package.
   ///
@@ -541,8 +563,8 @@ public:
   erase_extraction_directories(const options &opts) const
   {
     erase_extraction_directory(opts);
-    if (debug_info_package())
-      debug_info_package()->erase_extraction_directory(opts);
+    if (!debug_info_packages().empty())
+      debug_info_packages().front()->erase_extraction_directory(opts);
     if (devel_package())
       devel_package()->erase_extraction_directory(opts);
     if (kabi_whitelist_package())
@@ -591,7 +613,7 @@ struct compare_args
 /// A convenience typedef for arguments passed to the comparison workers.
 typedef shared_ptr<compare_args> compare_args_sptr;
 
-static bool extract_package_and_map_its_content(package &pkg,
+static bool extract_package_and_map_its_content(const package_sptr &pkg,
                                                options &opts);
 
 /// Getter for the path to the parent directory under which packages
@@ -727,17 +749,8 @@ extract_rpm(const string& package_path,
       << extracted_package_dir_path
       << " ...";
 
-  string cmd = "test -d " +
-    extracted_package_dir_path +
-    " && rm -rf " + extracted_package_dir_path;
-
-  if (system(cmd.c_str()))
-    {
-      if (opts.verbose)
-       emit_prefix("abipkgdiff", cerr) << "command " << cmd << " FAILED\n";
-    }
-
-  cmd = "mkdir -p " + extracted_package_dir_path + " && cd " +
+  string cmd = "test -d " + extracted_package_dir_path
+    + " || mkdir -p " + extracted_package_dir_path + " ; cd " +
     extracted_package_dir_path + " && rpm2cpio " + package_path +
     " | cpio -dium --quiet";
 
@@ -781,17 +794,7 @@ extract_deb(const string& package_path,
       << extracted_package_dir_path
       << " ...";
 
-  string cmd = "test -d " +
-    extracted_package_dir_path +
-    " && rm -rf " + extracted_package_dir_path;
-
-  if (system(cmd.c_str()))
-    {
-      if (opts.verbose)
-       emit_prefix("abipkgdiff", cerr) << "command "  << cmd <<  " FAILED\n";
-    }
-
-  cmd = "mkdir -p " + extracted_package_dir_path + " && dpkg -x " +
+  string cmd = "mkdir -p " + extracted_package_dir_path + " && dpkg -x " +
     package_path + " " + extracted_package_dir_path;
 
   if (system(cmd.c_str()))
@@ -1493,30 +1496,41 @@ maybe_handle_kabi_whitelist_pkg(const package& pkg, options &opts)
   return true;
 }
 
-/// The task that performs the extraction of the content of a package
-/// into a temporary directory.
+/// The task that performs the extraction of the content of several
+/// packages into a temporary directory.
+///
+/// If this task has several packages to extract, then it extracts
+/// them in sequence.
 ///
-/// Note that several instanaces of tasks can perform their jobs in
-/// parallel.
+/// Note that several instances of tasks can perform their jobs (i.e
+/// extract packages in sequence) in parallel.
 class pkg_extraction_task : public task
 {
   pkg_extraction_task();
 
 public:
-  package &pkg;
+  vector<package_sptr> pkgs;
   const options &opts;
   bool is_ok;
 
-  pkg_extraction_task(package &p, const options &o)
-    : pkg(p), opts(o), is_ok(false)
+  pkg_extraction_task(const package_sptr &p, const options &o)
+    : opts(o), is_ok(true)
+  {pkgs.push_back(p);}
+
+  pkg_extraction_task(const vector<package_sptr> &packages, const options &o)
+    : pkgs(packages), opts(o), is_ok(true)
   {}
 
-  /// The job performed by the current task.  It's to be performed in
-  /// parallel with other jobs.
+  /// The job performed by the current task, which is to extract its
+  /// packages in sequence.  This is job is to be performed in
+  /// parallel with other jobs of other tasks.
   virtual void
   perform()
   {
-    is_ok = extract_package(pkg, opts);
+    for (vector<package_sptr>::const_iterator p = pkgs.begin();
+        p != pkgs.end();
+        ++p)
+      is_ok &= extract_package(**p, opts);
   }
 }; //end class pkg_extraction_task
 
@@ -1536,11 +1550,11 @@ class pkg_prepare_task : public abigail::workers::task
   pkg_prepare_task();
 
 public:
-  package &pkg;
+  package_sptr pkg;
   options &opts;
   bool is_ok;
 
-  pkg_prepare_task(package &p, options &o)
+  pkg_prepare_task(package_sptr &p, options &o)
     : pkg(p), opts(o), is_ok(false)
   {}
 
@@ -1548,7 +1562,7 @@ public:
   virtual void
   perform()
   {
-    is_ok = extract_package_and_map_its_content(pkg, opts);
+    is_ok = pkg && extract_package_and_map_its_content(pkg, opts);
   }
 }; //end class pkg_prepare_task
 
@@ -1851,8 +1865,9 @@ create_maps_of_package_content(package& package, options& opts)
 ///
 /// @return true iff the extraction and analyzing went well.
 static bool
-extract_package_and_map_its_content(package &pkg, options &opts)
+extract_package_and_map_its_content(const package_sptr &pkg, options &opts)
 {
+  assert(pkg);
 
   pkg_extraction_task_sptr main_pkg_extraction;
   pkg_extraction_task_sptr dbg_extraction;
@@ -1863,21 +1878,22 @@ extract_package_and_map_its_content(package &pkg, options &opts)
 
   main_pkg_extraction.reset(new pkg_extraction_task(pkg, opts));
 
-  if (package_sptr dbg_pkg = pkg.debug_info_package())
+  if (!pkg->debug_info_packages().empty())
     {
-      dbg_extraction.reset(new pkg_extraction_task(*dbg_pkg, opts));
+      dbg_extraction.reset(new pkg_extraction_task(pkg->debug_info_packages(),
+                                                  opts));
       ++NUM_EXTRACTIONS;
     }
 
-  if (package_sptr devel_pkg = pkg.devel_package())
+  if (package_sptr devel_pkg = pkg->devel_package())
     {
-      devel_extraction.reset(new pkg_extraction_task(*devel_pkg, opts));
+      devel_extraction.reset(new pkg_extraction_task(devel_pkg, opts));
       ++NUM_EXTRACTIONS;
     }
 
-  if (package_sptr kabi_wl_pkg = pkg.kabi_whitelist_package())
+  if (package_sptr kabi_wl_pkg = pkg->kabi_whitelist_package())
     {
-      kabi_whitelist_extraction.reset(new pkg_extraction_task(*kabi_wl_pkg,
+      kabi_whitelist_extraction.reset(new pkg_extraction_task(kabi_wl_pkg,
                                                              opts));
       ++NUM_EXTRACTIONS;
     }
@@ -1899,12 +1915,12 @@ extract_package_and_map_its_content(package &pkg, options &opts)
   // Analyze and map the content of the extracted package.
   bool is_ok = false;
   if (main_pkg_extraction->is_ok)
-    is_ok = create_maps_of_package_content(pkg, opts);
+    is_ok = create_maps_of_package_content(*pkg, opts);
 
   if (is_ok)
     {
-      maybe_create_private_types_suppressions(pkg, opts);
-      maybe_handle_kabi_whitelist_pkg(pkg, opts);
+      maybe_create_private_types_suppressions(*pkg, opts);
+      maybe_handle_kabi_whitelist_pkg(*pkg, opts);
     }
 
   return is_ok;
@@ -1928,7 +1944,9 @@ extract_package_and_map_its_content(package &pkg, options &opts)
 ///
 /// @return true iff the preparation went well.
 static bool
-prepare_packages(package &first_package, package &second_package, options &opts)
+prepare_packages(package_sptr &first_package,
+                package_sptr &second_package,
+                options &opts)
 {
   pkg_prepare_task_sptr first_pkg_prepare;
   pkg_prepare_task_sptr second_pkg_prepare;
@@ -2070,16 +2088,15 @@ compare_prepared_userspace_packages(package& first_package,
 
   // Setting debug-info path of libraries
   string debug_dir1, debug_dir2, relative_debug_path = "/usr/lib/debug/";
-  if (first_package.debug_info_package()
-      && second_package.debug_info_package())
+  if (!first_package.debug_info_packages().empty()
+      && !second_package.debug_info_packages().empty())
     {
       debug_dir1 =
-       first_package.debug_info_package()->extracted_dir_path() +
+       first_package.debug_info_packages().front()->extracted_dir_path() +
+       relative_debug_path;
+      debug_dir2 =
+       second_package.debug_info_packages().front()->extracted_dir_path() +
        relative_debug_path;
-      if (second_package.debug_info_package())
-       debug_dir2 =
-         second_package.debug_info_package()->extracted_dir_path() +
-         relative_debug_path;
     }
 
   for (map<string, elf_file_sptr>::iterator it =
@@ -2238,16 +2255,15 @@ compare_prepared_linux_kernel_packages(package& first_package,
 
   // Setting debug-info path of binaries
   string debug_dir1, debug_dir2, relative_debug_path = "/usr/lib/debug/";
-  if (first_package.debug_info_package()
-      && second_package.debug_info_package())
+  if (!first_package.debug_info_packages().empty()
+      && !second_package.debug_info_packages().empty())
     {
       debug_dir1 =
-       first_package.debug_info_package()->extracted_dir_path() +
+       first_package.debug_info_packages().front()->extracted_dir_path() +
+       relative_debug_path;
+      debug_dir2 =
+       second_package.debug_info_packages().front()->extracted_dir_path() +
        relative_debug_path;
-      if (second_package.debug_info_package())
-       debug_dir2 =
-         second_package.debug_info_package()->extracted_dir_path() +
-         relative_debug_path;
     }
 
   string vmlinux_path1, vmlinux_path2;
@@ -2369,7 +2385,7 @@ compare_prepared_package(package& first_package, package& second_package,
 ///
 /// @return the status of the comparison.
 static abidiff_status
-compare(package& first_package, package& second_package,
+compare(package_sptr& first_package, package_sptr& second_package,
        abi_diff& diff, options& opts)
 {
   // Prepare (extract and analyze the contents) the packages and their
@@ -2378,11 +2394,11 @@ compare(package& first_package, package& second_package,
   // Note that the package preparations happens in parallel.
   if (!prepare_packages(first_package, second_package, opts))
     {
-      maybe_erase_temp_dirs(first_package, second_package, opts);
+      maybe_erase_temp_dirs(*first_package, *second_package, opts);
       return abigail::tools_utils::ABIDIFF_ERROR;
     }
 
-  return compare_prepared_package(first_package, second_package, diff, opts);
+  return compare_prepared_package(*first_package, *second_package, diff, opts);
 }
 
 /// Compare the ABI of two packages.
@@ -2395,7 +2411,9 @@ compare(package& first_package, package& second_package,
 ///
 /// @return the status of the comparison.
 static abidiff_status
-compare(package& first_package, package& second_package, options& opts)
+compare(package_sptr& first_package,
+       package_sptr& second_package,
+       options& opts)
 {
   abi_diff diff;
   return compare(first_package, second_package, diff, opts);
@@ -2453,8 +2471,8 @@ parse_command_line(int argc, char* argv[], options& opts)
              opts.wrong_option = argv[i];
              return true;
             }
-          opts.debug_package1 =
-           abigail::tools_utils::make_path_absolute(argv[j]).get();
+          opts.debug_packages1.push_back
+           (abigail::tools_utils::make_path_absolute(argv[j]).get());
           ++i;
         }
       else if (!strcmp(argv[i], "--debug-info-pkg2")
@@ -2467,8 +2485,8 @@ parse_command_line(int argc, char* argv[], options& opts)
              opts.wrong_option = argv[i];
              return true;
             }
-          opts.debug_package2 =
-           abigail::tools_utils::make_path_absolute(argv[j]).get();
+          opts.debug_packages2.push_back
+           (abigail::tools_utils::make_path_absolute(argv[j]).get());
           ++i;
         }
       else if (!strcmp(argv[i], "--devel-pkg1")
@@ -2700,15 +2718,19 @@ main(int argc, char* argv[])
 
   package_sptr second_package(new package(opts.package2, "package2"));
 
-  if (!opts.debug_package1.empty())
-    first_package->debug_info_package
-      (package_sptr(new package(opts.debug_package1,
+  for (vector<string>::const_iterator p = opts.debug_packages1.begin();
+       p != opts.debug_packages1.end();
+       ++p)
+    first_package->debug_info_packages().push_back
+      (package_sptr(new package(*p,
                                "debug_package1",
                                /*pkg_kind=*/package::KIND_DEBUG_INFO)));
 
-  if (!opts.debug_package2.empty())
-    second_package->debug_info_package
-      (package_sptr(new package(opts.debug_package2,
+  for (vector<string>::const_iterator p = opts.debug_packages2.begin();
+       p != opts.debug_packages2.end();
+       ++p)
+    second_package->debug_info_packages().push_back
+      (package_sptr(new package(*p,
                                "debug_package2",
                                /*pkg_kind=*/package::KIND_DEBUG_INFO)));
 
@@ -2770,8 +2792,8 @@ main(int argc, char* argv[])
                      | abigail::tools_utils::ABIDIFF_ERROR);
            }
 
-         if (!first_package->debug_info_package()
-             || !second_package->debug_info_package())
+         if (first_package->debug_info_packages().empty()
+             || second_package->debug_info_packages().empty())
            {
              emit_prefix("abipkgdiff", cerr)
                << "a Linux Kernel package must be accompanied with its "
@@ -2834,5 +2856,5 @@ main(int argc, char* argv[])
              | abigail::tools_utils::ABIDIFF_ERROR);
     }
 
-  return compare(*first_package, *second_package, opts);
+  return compare(first_package, second_package, opts);
 }
This page took 0.055244 seconds and 5 git commands to generate.