← Back to team overview

keryx team mailing list archive

[Merge] lp:~jacseen/keryx/devel into lp:keryx/devel

 

Jack N has proposed merging lp:~jacseen/keryx/devel into lp:keryx/devel.

    Requested reviews:
    mac9416 (mac9416)

-- 
https://code.launchpad.net/~jacseen/keryx/devel/+merge/13513
Your team Keryx Development Team is subscribed to branch lp:keryx/devel.
=== modified file 'libkeryx/definitions/dpkg/__init__.py'
--- libkeryx/definitions/dpkg/__init__.py	2009-10-12 03:47:22 +0000
+++ libkeryx/definitions/dpkg/__init__.py	2009-10-17 03:25:23 +0000
@@ -210,12 +210,15 @@
                 #TODO: Add PPA support to minideblib so this will not be necessary.
 
         depends = []
-        for pkg in upgrade:
-            depends += self.apt_client.get_binary_dependencies(pkg, exclude=[x.name for x in status])
+        depends, nfound = self.apt_client.get_binary_dependencies(upgrade, exclude=[x.name for x in status])
 
         print depends
 
         print "%i upgradeable packages" % (len(upgrade))
+        if nfound:
+            #TODO: Should we abort if unresolved dependencies?
+            print nfound
+            print "%i packages not found" % (len(nfound))
         self.Download(upgrade+depends)
 
 
@@ -227,7 +230,8 @@
     def OnDepends(self, packages):
         """Print a list of depends/recommends/suggests of packages"""
         for package in packages:
-            print package, self.apt_client.get_binary_dependencies(package)
+            depends, nfound = self.apt_client.get_binary_dependencies(package)
+            print package, depends+nfound
 
                 
     def OnDownload(self, packages):
@@ -236,11 +240,14 @@
                             filter(Status.proj_id==self.project_entry.id).all()
 
         print "Calculating dependencies...",
-        depends = self.apt_client.get_binary_dependencies(packages, exclude=[x.name for x in status])
+        depends, nfound = self.apt_client.get_binary_dependencies(packages, exclude=[x.name for x in status])
         print "Done"
 
         print "The following extra packages will be downloaded:\n%s" % (" ".join(depends))
-        print "%i packages downloaded." % (len(depends))
+        if nfound:
+            #TODO: Should we abort if unresolved dependencies?
+            print "The following packages could not be found:\n%s" % (" ".join(nfound))
+        print "%i packages to download." % (len(depends))
 
         answer = self._question("Do you want to continue")
         if answer:

=== modified file 'libkeryx/definitions/dpkg/minideblib/AptRepoClient.py'
--- libkeryx/definitions/dpkg/minideblib/AptRepoClient.py	2009-10-10 02:54:03 +0000
+++ libkeryx/definitions/dpkg/minideblib/AptRepoClient.py	2009-10-17 03:25:23 +0000
@@ -565,20 +565,22 @@
         return _get_available_pkgs(base_url, self.binaries)
 
     def get_binary_dependencies(self, packages, depends=True, predepends=True, 
-                                recommends=True, exclude=[], current=[]):
+                                recommends=True, exclude=[], current=[], nfound=[]):
         """Returns a list of packages that are dependencies of the provided
-           package names.
+           package names, and a list of unresolvable dependencies.
         """
         for package in packages:
-            # If the package is already installed or dep-checked, skip it.
-            if package in exclude or package in current:
+            # If the package is already installed or dep-checked or not-found, skip it.
+            if package in exclude or package in current or package in nfound:
                 continue  # Next package
 
             # Get the dependencies for this package.
             try:
                 data = self.get_binary_name_version(package)[0]
             except IndexError:
-                return current
+                # If package is not found, note it and skip to next one
+                nfound += [package]
+                continue
             dependencies = []
             if depends and data.has_key("depends"):
                 dependencies += [x.split()[0] for x in data["depends"].split(", ")]
@@ -591,11 +593,13 @@
             current += [package]
 
             # Find each depend's depend's, adding them to the download list.
-            for item in dependencies:
-                current = self.get_binary_dependencies([item], exclude=exclude, current=current)
+            # though whats actually returned is a list of
+            # currently handled packages as well as all handled by the dependencies.
+            if dependencies:
+                current, nfound = self.get_binary_dependencies(dependencies, exclude=exclude, current=current, nfound=nfound)
 
         # Return the package list.
-        return current
+        return current, nfound
 
     def __get_best_version(self, package, base_url, pkgcache):
         """


Follow ups