[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.52-17-gf515a64

Andreas Beckmann anbe at debian.org
Tue May 28 11:37:40 UTC 2013


The following commit has been merged in the develop branch:
commit a73ba778c38cc04edabca48a24c807f210727f8b
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun May 26 13:44:30 2013 +0200

    lib/db: add load_packages_urls() methods
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 5b79a46..bcd58f1 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -9,6 +9,7 @@ piuparts (0.53) UNRELEASED; urgency=low
     - Define wheezy-proposed and squeeze-proposed.
   * piupartslib/conf.py:
   * piupartslib/packagesdb.py:
+    - Add load_packages_urls() methods.
   * piuparts-master-backend.py:
   * piuparts-slave.py:
   * piuparts-analyze.py:
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 8d3ac48..ad5d956 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -35,6 +35,7 @@ import time
 import UserDict
 import apt_pkg
 
+import piupartslib
 from piupartslib.dependencyparser import DependencyParser
 
 apt_pkg.init_system()
@@ -156,9 +157,17 @@ class Package(UserDict.UserDict):
 
 class PackagesFile(UserDict.UserDict):
 
-    def __init__(self, input):
+    def __init__(self, input=None):
         UserDict.UserDict.__init__(self)
-        self._read_file(input)
+        if input is not None:
+            self._read_file(input)
+
+    def load_packages_urls(self, urls):
+        for url in urls:
+            logging.debug("Fetching %s" % url)
+            stream = piupartslib.open_packages_url(url)
+            self._read_file(stream)
+            stream.close()
 
     def _read_file(self, input):
         """Parse a Packages file and add its packages to us-the-dict"""
@@ -366,6 +375,12 @@ class PackagesDB:
     def get_mtime(self):
         return max([os.path.getmtime(sdir) for sdir in self._all])
 
+    def load_packages_urls(self, urls):
+        pf = PackagesFile()
+        pf.load_packages_urls(urls)
+        self._packages_files.append(pf)
+        self._packages = None
+
     def read_packages_file(self, input):
         self._packages_files.append(PackagesFile(input))
         self._packages = None

-- 
piuparts git repository



More information about the Piuparts-commits mailing list