← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/speedier-sandboxes into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/speedier-sandboxes into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~brian-murray/apport/speedier-sandboxes/+merge/335681

I discovered that gdb was repeatedly being installed in the gdb sandbox due to how conflict handling in apport's apt-dpkg backend happens. This resolves that.

Additionally, gdb-dbg was being installed alongside with gdb which isn't necessary.

Fixing both of these issues speeds up retracing a bit.
-- 
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/speedier-sandboxes into lp:apport.
=== modified file 'apport/sandboxutils.py'
--- apport/sandboxutils.py	2017-06-12 23:42:53 +0000
+++ apport/sandboxutils.py	2018-01-04 00:41:07 +0000
@@ -104,7 +104,7 @@
 
 def make_sandbox(report, config_dir, cache_dir=None, sandbox_dir=None,
                  extra_packages=[], verbose=False, log_timestamps=False,
-                 dynamic_origins=False):
+                 dynamic_origins=False, extra_pkgs_dbg=True):
     '''Build a sandbox with the packages that belong to a particular report.
 
     This downloads and unpacks all packages from the report's Package and
@@ -151,6 +151,9 @@
     with packages from foreign origins that appear in the report's
     Packages:/Dependencies:.
 
+    If extra_pkgs_dbg is False (True by default), then debug versions of the
+    packages in extra_packages will not be installed. 
+
     Return a tuple (sandbox_dir, cache_dir, outdated_msg).
     '''
     # sandbox
@@ -212,7 +215,7 @@
                 sandbox_dir, config_dir, report['DistroRelease'], extra_pkgs,
                 verbose, cache_dir, permanent_rootdir,
                 architecture=report.get('Architecture'), origins=origins,
-                install_deps=True)
+                install_dbg=extra_pkgs_dbg, install_deps=True)
         except SystemError as e:
             apport.fatal(str(e))
 

=== modified file 'backends/packaging-apt-dpkg.py'
--- backends/packaging-apt-dpkg.py	2017-08-25 18:59:03 +0000
+++ backends/packaging-apt-dpkg.py	2018-01-04 00:41:07 +0000
@@ -707,8 +707,8 @@
         If install_deps is True, then the dependencies of packages will also
         be installed.
 
-        Return a string with outdated packages, or None if all packages were
-        installed.
+        Return a string with outdated packages, or an empty string if all
+        packages were installed.
 
         If something is wrong with the environment (invalid configuration,
         package servers down, etc.), this should raise a SystemError with a
@@ -884,12 +884,20 @@
                     conflicts += apt.apt_pkg.parse_depends(candidate.record['Conflicts'])
                 if 'Replaces' in candidate.record:
                     conflicts += apt.apt_pkg.parse_depends(candidate.record['Replaces'])
+
                 for conflict in conflicts:
+                    if conflict[0][0] == candidate.package.name:
+                        continue
                     # apt_pkg.parse_depends needs to handle the or operator,
                     # but as policy states it is invalid to use that in
                     # Replaces/Depends, we can safely choose the first value
                     # here.
                     conflict = conflict[0]
+                    # if the conflicting package isn't installed in the
+                    # sandbox or in the list of packages to install its not a
+                    # concern.
+                    if conflict[0] not in packages and conflict[0] not in pkg_versions:
+                        continue
                     if cache.is_virtual_package(conflict[0]):
                         try:
                             providers = virtual_mapping[conflict[0]]
@@ -915,11 +923,10 @@
                             ver = self._deb_version(path)
                             if apt.apt_pkg.check_dep(ver, conflict[2], conflict[1]):
                                 os.unlink(path)
-                        try:
-                            del pkg_versions[conflict[0]]
-                        except KeyError:
-                            pass
-
+                                try:
+                                    del pkg_versions[conflict[0]]
+                                except KeyError:
+                                    pass
             if candidate.architecture != 'all' and install_dbg:
                 try:
                     dbg_pkg = pkg + '-dbg'

=== modified file 'bin/apport-retrace'
--- bin/apport-retrace	2017-06-16 16:10:43 +0000
+++ bin/apport-retrace	2018-01-04 00:41:07 +0000
@@ -314,13 +314,17 @@
              report['Architecture'])
     else:
         sandbox_dir = None
+    extra_dbg=True
     if options.gdb_sandbox:
         if report['Architecture'] == system_arch:
             options.extra_package.append('gdb')
+        # if only gdb is being installed we don't need dbg symbols for it
+        if len(options.extra_package) == 1:
+            extra_dbg=False
     sandbox, cache, outdated_msg = apport.sandboxutils.make_sandbox(
         report, options.sandbox, options.cache, sandbox_dir,
         options.extra_package, options.verbose, log_timestamps,
-        options.dynamic_origins)
+        options.dynamic_origins, extra_pkgs_dbg=extra_dbg)
 else:
     sandbox = None
     cache = None
@@ -349,7 +353,8 @@
                                              options.sandbox, options.cache,
                                              gdb_sandbox_dir, gdb_packages,
                                              options.verbose, log_timestamps,
-                                             options.dynamic_origins)
+                                             options.dynamic_origins,
+                                             extra_pkgs_dbg=False)
 else:
     gdb_sandbox = None
     gdb_cache = None


Follow ups