[Treepkg-commits] r487 - trunk/recipes/kde/enterprise

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Thu Nov 11 12:50:08 CET 2010


Author: bricks
Date: 2010-11-11 12:50:08 +0100 (Thu, 11 Nov 2010)
New Revision: 487

Modified:
   trunk/recipes/kde/enterprise/tags.py
Log:
added an option to fail if a tag could not be found instread of building trunk
fail is the default now


Modified: trunk/recipes/kde/enterprise/tags.py
===================================================================
--- trunk/recipes/kde/enterprise/tags.py	2010-11-11 11:47:31 UTC (rev 486)
+++ trunk/recipes/kde/enterprise/tags.py	2010-11-11 11:50:08 UTC (rev 487)
@@ -10,6 +10,7 @@
 
 import logging
 
+from treepkg.readconfig import convert_bool
 import recipes.kde.enterprise.generic as enterprise
 
 class PackageTrack(enterprise.PackageTrack):
@@ -19,7 +20,18 @@
 
     revision_packager_cls = enterprise.RevisionPackager
 
+    extra_config_desc = [("tags_url", str, ""),
+                         ("tags_pattern", str, ""),
+                         ("tags_subdir", str, ""),
+                         ("tags_scm_type", str, None),
+                         ("tags_rules_url", str, None),
+                         ("tags_rules_pattern", str, ""),
+                         ("tags_rules_subdir", str, ""),
+                         ("tags_rules_scm_type", str, None),
+                         ("fail_if_tag_not_found", convert_bool, "true")]
+
     def __init__(self, *args, **kw):
+        self.fail_if_tag_not_found = kw.pop("fail_if_tag_not_found")
         super(PackageTrack, self).__init__(*args, **kw)
 
     def packager_for_new_revision(self):
@@ -31,7 +43,10 @@
         logging.info("Found: %s: %s", tag_url, tag_revision)
         logging.info("Found rules: %s: %s", tag_rules_url, tag_rules_revision)
         if self.use_tag_rules and tag_rules_url is None:
-            self.use_tag_rules = False # maybe it's better to raise an exception
+            self.use_tag_rules = False
+            logging.error("No rules found in tag but tag should be used to" \
+                          " build package.")
+            return
         if tag_url is not None:
             if not self.use_tag_rules:
                 tag_rules_revision = self.rules_working_copy.last_changed_revision()
@@ -56,7 +71,11 @@
                 logging.info("Revision %s has already been packaged.",
                              revision)
         
-        else: # tag_url is not set -> build trunk
+        else:
+            if self.fail_if_tag_not_found:
+                logging.error("Could not find tag for track %s", self.name)
+                return
+            # tag_url is not set -> build trunk
             # don't use rules from tags for trunk builds
             self.use_tag_rules = False
             return super(PackageTrack, self).new_revsision_packager()



More information about the Treepkg-commits mailing list