Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Unified Diff: chromite/lib/binpkg.py

Issue 5370005: Treat packages with missing SHA1 as not duplicated. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | prebuilt_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromite/lib/binpkg.py
diff --git a/chromite/lib/binpkg.py b/chromite/lib/binpkg.py
index 40a29dbcd22904dcd9d1c90af568178928085a51..48adccb2093f04cc998a0d64a72db0171abc0068 100644
--- a/chromite/lib/binpkg.py
+++ b/chromite/lib/binpkg.py
@@ -51,9 +51,10 @@ class PackageIndex(object):
uri = self.header['URI']
for pkg in self.packages:
- cpv, sha1 = pkg['CPV'], pkg['SHA1']
- path = pkg.get('PATH', cpv + '.tbz2')
- db[sha1] = urlparse.urljoin(uri, path)
+ cpv, sha1 = pkg['CPV'], pkg.get('SHA1')
+ if sha1:
+ path = pkg.get('PATH', cpv + '.tbz2')
+ db[sha1] = urlparse.urljoin(uri, path)
def _ReadPkgIndex(self, pkgfile):
"""Read a list of key/value pairs from the Packages file into a dictionary.
@@ -180,9 +181,9 @@ class PackageIndex(object):
uploads = []
base_uri = self.header['URI']
for pkg in self.packages:
- sha1 = pkg['SHA1']
+ sha1 = pkg.get('SHA1')
uri = db.get(sha1)
- if uri and uri.startswith(base_uri):
+ if sha1 and uri and uri.startswith(base_uri):
pkg['PATH'] = uri[len(base_uri):].lstrip('/')
else:
uploads.append(pkg)
« no previous file with comments | « no previous file | prebuilt_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698