r356 - branches/rewrite/src

Marco Presi partial-mirror-devel@lists.alioth.debian.org
Mon, 22 Nov 2004 17:19:51 -0700


Author: zufus
Date: Mon Nov 22 17:19:49 2004
New Revision: 356

Modified:
   branches/rewrite/src/Backend.py
   branches/rewrite/src/Pool.py
Log:
Updated Pool's method to manage upgrade of Pool, after Backend class
redefinition.

In Backend.py added two simple methods to retrive __bin and __source
pkgLists from dists instance.

TODO (zufus): add methods for sources upgrade



Modified: branches/rewrite/src/Backend.py
==============================================================================
--- branches/rewrite/src/Backend.py	(original)
+++ branches/rewrite/src/Backend.py	Mon Nov 22 17:19:49 2004
@@ -50,11 +50,25 @@
             raise InvalidOption(self._name, key)
         return item
 
+    def _getBinList (self):
+        """
+        Return binList associated to this Backend
+        """
+        return self._dists.__bin
+
+    def _getSrcList (self):
+        """
+        Return srcList associated to this Backend
+        """
+        return self._dists.__source
+
+
     def update (self):
         self._dists.update()
 
     def upgrade (self):
         self._dists.upgrade()
+        self._pool.upgrade(self._getBinList(), self._getSrcList())
         
     def remove (self):
         """ Remove backend """

Modified: branches/rewrite/src/Pool.py
==============================================================================
--- branches/rewrite/src/Pool.py	(original)
+++ branches/rewrite/src/Pool.py	Mon Nov 22 17:19:49 2004
@@ -43,14 +43,14 @@
         #self._local = "%s/pool/" % (self._backend["mirror_dir"])
         self._local = self._dir._dir
         
-    def binUpdates (self):
+    def binUpdates (self, pkgList):
         """
         Scan into a Backend PackageList (_bin) and look for
         packages that have newer version on remote (or local)
         repository.  Return a PackageList of packages to be downloaded.
         """
         
-        for (pkgName, pkg) in backend.__bin.items():
+        for (pkgName, pkg) in pkgList.items():
             localName = pkg['Filename']
 
             if not os.path.exists (os.path.join (self._local,localName)):
@@ -67,7 +67,16 @@
         for p in self._plist.keys():
             print "%s \n" % (pkg['Filename'])
 
-    def upgrade (self):
+    def upgrade (self, binList, srcList):
+        """
+        Manage the pool upgrade process
+        """
+        self.binUpdates (binList)
+        #self.srcUpdates (srcList)
+        self._upgrade ()
+
+
+    def _upgrade (self):
         """
         Get from remote (or local) repository new version of packages
         that were previously downloaded.