[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 9bcbfe0fa48aba1da806fecfea79e3aa2d7bdb27

Andreas Beckmann debian at abeckmann.de
Fri Dec 2 13:30:34 UTC 2011


The following commit has been merged in the develop branch:
commit 0ca4b4477ed52fa9fdcc3259a81eb8dcfbfbc3bb
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Dec 2 10:49:25 2011 +0100

    rename state_by_name() to get_package_state()
    
    Merge the two methods and replace all uses of the old name.
    Return "does-not-exist" for invalid queries.
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piuparts-report.py b/piuparts-report.py
index be2da08..60f8ff4 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -662,7 +662,7 @@ class Section:
         return link
 
     def link_to_state_page(self, section, package_name, link_target):
-        state = self._binary_db.state_by_name(package_name)
+        state = self._binary_db.get_package_state(package_name)
         if state != "unknown":
             link = "<a href=\"/%s/%s\">%s</a>" % (
                 section,
@@ -783,7 +783,7 @@ class Section:
         failed = False
         binaryrows = ""
         for binary in sorted(binaries.split(", ")):
-          state = self._binary_db.state_by_name(binary)
+          state = self._binary_db.get_package_state(binary)
           if state == "unknown":
             # Don't track udebs and binary packages on other archs. 
             # The latter is a FIXME which needs parsing the Packages files from other archs too
@@ -1007,7 +1007,7 @@ class Section:
                     for dep in package.dependencies():
                         vlist += "<li>dependency %s is %s</li>\n" % \
                                   (self.link_to_state_page(self._config.section,dep,dep), 
-                                  emphasize_reason(html_protect(self._binary_db.state_by_name(dep))))
+                                  emphasize_reason(html_protect(self._binary_db.get_package_state(dep))))
                     vlist += "</ul>\n"
                 vlist += "</li>\n"
             htmlpage = string.Template(HTML_HEADER + STATE_BODY_TEMPLATE + HTML_FOOTER)
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index acad672..64459c9 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -507,13 +507,9 @@ class PackagesDB:
           return self._packages[package_name][header]
 
     def get_package_state(self, package_name):
-        return self._package_state[package_name]
-
-    def state_by_name(self, package_name):
         if package_name in self._package_state:
             return self._package_state[package_name]
-        else:
-            return "unknown"
+        return "does-not-exist"
 
     def _find_packages_ready_for_testing(self):
         return self.get_pkg_names_in_state("waiting-to-be-tested")

-- 
piuparts git repository



More information about the Piuparts-commits mailing list