[linux-signed] 02/03: debian/bin/sign.py: Change caching to support multiple mirrors and suites

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Fri Jan 6 02:24:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch sid
in repository linux-signed.

commit 8fba5e99c673777a0006d7413e0da2bf58a70695
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Fri Jan 6 01:50:17 2017 +0000

    debian/bin/sign.py: Change caching to support multiple mirrors and suites
---
 debian/bin/sign.py | 13 +++++++------
 debian/changelog   |  1 +
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/debian/bin/sign.py b/debian/bin/sign.py
index 32aeeb0..e92c453 100755
--- a/debian/bin/sign.py
+++ b/debian/bin/sign.py
@@ -19,7 +19,7 @@ class MissingPackageError(Exception):
 _release_data = {}
 
 def get_release_data(mirror, suite):
-    if not _release_data:
+    if (mirror, suite) not in _release_data:
         # I would prefer to use InRelease here to avoid a possible
         # mismatch but inline-signed files can include unsigned text
         # that we might mistakenly trust.
@@ -54,15 +54,16 @@ def get_release_data(mirror, suite):
         release_stream = io.TextIOWrapper(io.BytesIO(release_raw), 'utf-8')
 
         # Make a dictionary of per-file data
+        _release_data[(mirror, suite)] = data = {}
         for file_data in deb822.Release(release_stream)['SHA256']:
-            _release_data[file_data['name']] = file_data
+            data[file_data['name']] = file_data
 
-    return _release_data
+    return _release_data[(mirror, suite)]
 
 _packages_data = {}
 
 def get_packages_data(mirror, suite, arch):
-    if arch not in _packages_data:
+    if (mirror, suite, arch) not in _packages_data:
         release_data = get_release_data(mirror, suite)
 
         path = 'main/binary-%s/Packages.xz' % arch
@@ -84,14 +85,14 @@ def get_packages_data(mirror, suite, arch):
             io.BytesIO(lzma.decompress(packages_raw)), 'utf-8')
 
         # Make a dictionary of per-package data
-        _packages_data[arch] = data = {}
+        _packages_data[(mirror, suite, arch)] = data = {}
         for package_data in deb822.Packages.iter_paragraphs(packages_stream):
             name = package_data['Package']
             # Filter so the heap doesn't become huge
             if name.startswith('linux-image-'):
                 data[name] = package_data
 
-    return _packages_data[arch]
+    return _packages_data[(mirror, suite, arch)]
 
 def get_package(mirror, suite, name, version, arch):
     packages_dir = 'debian/localpackages/'
diff --git a/debian/changelog b/debian/changelog
index 3347266..7b49205 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ linux-signed (3.4) UNRELEASED; urgency=medium
   * debian/control: Correct syntax of Built-Using field (Closes: #846488)
   * debian/rules: Use dpkg-parsechangelog -S option to select fields
   * debian/bin/sign.py: Introduce specific exception classes
+  * debian/bin/sign.py: Change caching to support multiple mirrors and suites
 
  -- Ben Hutchings <ben at decadent.org.uk>  Fri, 09 Dec 2016 12:48:17 +0000
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux-signed.git



More information about the Kernel-svn-changes mailing list