← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~brian-murray/apport/single-dir-cache-archives into lp:apport

 

Brian Murray has proposed merging lp:~brian-murray/apport/single-dir-cache-archives into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~brian-murray/apport/single-dir-cache-archives/+merge/262283

I noticed that my addition of archivedir was the same as the archives variable, so I've removed that and replaced it with archivedir.

I also noticed we don't return if ps is undefined so I fixed that too.
-- 
Your team Apport upstream developers is requested to review the proposed merge of lp:~brian-murray/apport/single-dir-cache-archives into lp:apport.
=== modified file 'backends/packaging-apt-dpkg.py'
--- backends/packaging-apt-dpkg.py	2015-06-17 15:49:10 +0000
+++ backends/packaging-apt-dpkg.py	2015-06-18 00:04:53 +0000
@@ -272,6 +272,8 @@
             ps = self.json_request(ps_url, entries=True)[0]['self_link']
         except IndexError:
             return None
+        if not ps:
+            return None
         sf_urls = ps + '?ws.op=sourceFileUrls'
         sfus = self.json_request(sf_urls)
         if not sfus:
@@ -801,7 +803,6 @@
                     conflicts += apt.apt_pkg.parse_depends(candidate.record['Conflicts'])
                 if 'Replaces' in candidate.record:
                     conflicts += apt.apt_pkg.parse_depends(candidate.record['Replaces'])
-                archives = apt.apt_pkg.config.find_dir('Dir::Cache::archives')
                 for conflict in conflicts:
                     # apt_pkg.parse_depends needs to handle the or operator,
                     # but as policy states it is invalid to use that in
@@ -817,7 +818,7 @@
                             # unpacked into the sandbox.
                             continue
                         for p in providers:
-                            debs = os.path.join(archives, '%s_*.deb' % p)
+                            debs = os.path.join(archivedir, '%s_*.deb' % p)
                             for path in glob.glob(debs):
                                 ver = self._deb_version(path)
                                 if apt.apt_pkg.check_dep(ver, conflict[2], conflict[1]):
@@ -828,7 +829,7 @@
                                 pass
                         del providers
                     else:
-                        debs = os.path.join(archives, '%s_*.deb' % conflict[0])
+                        debs = os.path.join(archivedir, '%s_*.deb' % conflict[0])
                         for path in glob.glob(debs):
                             ver = self._deb_version(path)
                             if apt.apt_pkg.check_dep(ver, conflict[2], conflict[1]):


Follow ups