[Treepkg-commits] r178 - in trunk: bin test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Apr 14 11:42:00 CEST 2009


Author: bh
Date: 2009-04-14 11:41:59 +0200 (Tue, 14 Apr 2009)
New Revision: 178

Modified:
   trunk/bin/listpackages.py
   trunk/test/test_listpackages.py
Log:
Make bin/listpackages.py ignore revisions that have not been built
successfully, unless the revision has been explicitly selected.  Add a
test case for this.


Modified: trunk/bin/listpackages.py
===================================================================
--- trunk/bin/listpackages.py	2009-04-09 18:59:44 UTC (rev 177)
+++ trunk/bin/listpackages.py	2009-04-14 09:41:59 UTC (rev 178)
@@ -65,7 +65,13 @@
     revisions = sorted(revisions, key=lambda r: r.status.start, reverse=True)
 
     if main_rev is None:
-        revpkg = revisions[0]
+        filtered = [revpkg for revpkg in revisions
+                    if revpkg.status.status.finished
+                       and not revpkg.status.status.error]
+        if filtered:
+            revpkg = filtered[0]
+        else:
+            revpkg = None
     else:
         # iterate in reverse, so that we pick up the newest revision
         # packager with the desired revision first if rules_rev is None

Modified: trunk/test/test_listpackages.py
===================================================================
--- trunk/test/test_listpackages.py	2009-04-09 18:59:44 UTC (rev 177)
+++ trunk/test/test_listpackages.py	2009-04-14 09:41:59 UTC (rev 178)
@@ -30,19 +30,29 @@
 
     package_dirs = []
     for revision in revisions:
-        rev, rules_rev = revision
         status = RevisionStatus(None)
-        status.binary_package_created()
+        if len(revision) == 2:
+            rev, rules_rev = revision
+            status.binary_package_created()
+        else:
+            rev, rules_rev, status_name = revision
+            getattr(status, status_name)()
+
         status.start = start_time
         status.stop = start_time + build_duration
         start_time += check_interval
 
+        if status.status.finished and not status.status.error:
+            src_files = [(template % (rev,), "") for template in src_templates]
+            bin_files = [(template % (rev,), "") for template in bin_templates]
+        else:
+            src_files = []
+            bin_files = []
+
         package_dirs.append(("%s-%s" % (rev, rules_rev),
                              [("status", "".join(status.serialize())),
-                              ("src", [(template % (rev,), "")
-                                       for template in src_templates]),
-                              ("binary", [(template % (rev,), "")
-                                          for template in bin_templates])]))
+                              ("src", src_files),
+                              ("binary", bin_files)]))
     return (track,
             [("pkg",
               package_dirs)])
@@ -162,6 +172,29 @@
 """)
 
 
+class TestListPackagesTrackNoRevisionWithIncompleteBuilds(ListPackagesTest):
+
+    track_files = [package_track_files("kdepim", "1.0.1",
+                                       ["kdepim", "kleopatra"],
+                                       [(702432, 47),
+                                        (704195, 31, "error")])]
+
+    def test_listpackages_source(self):
+        self.check_cmd(["--track=kdepim", "--source"],
+                       """\
+kdepim/pkg/702432-47/src/kdepim_1.0.1.702432-1.diff.gz
+kdepim/pkg/702432-47/src/kdepim_1.0.1.702432-1.dsc
+kdepim/pkg/702432-47/src/kdepim_1.0.1.702432.orig.tar.gz
+""")
+
+    def test_listpackages_binary(self):
+        self.check_cmd(["--track=kdepim", "--binary"],
+                       """\
+kdepim/pkg/702432-47/binary/kdepim_1.0.1.702432-1_i386.deb
+kdepim/pkg/702432-47/binary/kleopatra_1.0.1.702432-1_i386.deb
+""")
+
+
 class TestListPackagesNoTrackNoRevision(ListPackagesTest):
 
     track_files = [package_track_files("kdepim", "1.0.1",



More information about the Treepkg-commits mailing list