[Treepkg-commits] r212 - trunk/recipes/kde_enterprise_3_5

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Aug 4 12:32:34 CEST 2009


Author: bh
Date: 2009-08-04 12:32:33 +0200 (Tue, 04 Aug 2009)
New Revision: 212

Modified:
   trunk/recipes/kde_enterprise_3_5/base.py
Log:
kdepim 3.5 recipes: Use the official tag date as the date in the package
version and include the number of changes to the tag in the package
revision.


Modified: trunk/recipes/kde_enterprise_3_5/base.py
===================================================================
--- trunk/recipes/kde_enterprise_3_5/base.py	2009-08-04 10:30:48 UTC (rev 211)
+++ trunk/recipes/kde_enterprise_3_5/base.py	2009-08-04 10:32:33 UTC (rev 212)
@@ -8,11 +8,12 @@
 """Base classes for all kdepim packagers"""
 
 import os
+import re
 import time
 import logging
 
 import treepkg.packager
-import treepkg.subversion
+import treepkg.subversion as subversion
 
 
 class BaseSourcePackager(treepkg.packager.SourcePackager):
@@ -59,9 +60,8 @@
         tags_pattern = kw.pop("tags_pattern")
         tags_subdir = kw.pop("tags_subdir")
         super(BasePackageTrack, self).__init__(*args, **kw)
-        self.tag_detector = treepkg.subversion.TagDetector(tags_url,
-                                                           tags_pattern,
-                                                           tags_subdir)
+        self.tag_detector = subversion.TagDetector(tags_url, tags_pattern,
+                                                   tags_subdir)
 
     def packager_for_new_revision(self):
         logging.info("Checking tags")
@@ -77,7 +77,12 @@
                              revision)
                 self.tag_url = tag_url
                 self.tag_revision = tag_revision
-                return self.revision_packager_cls(self, tag=tag_url, *revision)
+                tag_date, tag_change_count = self.tag_pkg_parameters(tag_url)
+                pkg_revision = self.debrevision_prefix + str(tag_change_count)
+                return self.revision_packager_cls(self, tag=tag_url,
+                                                  pkg_revision=pkg_revision,
+                                                  pkg_date=tag_date,
+                                                  *revision)
             else:
                 logging.info("Revision %s has already been packaged.",
                              revision)
@@ -93,4 +98,19 @@
     def export_tag(self, tag_url, to_dir, revision=None):
         logging.info("Exporting sources from %s to %r",
                      tag_url, to_dir)
-        treepkg.subversion.export(tag_url, to_dir, revision=revision)
+        subversion.export(tag_url, to_dir, revision=revision)
+
+    def tag_pkg_parameters(self, tag_url):
+        match = re.search(r"/enterprise[^.]*\.[^.]*\."
+                          r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/",
+                          tag_url)
+        if match:
+            date = match.group("date")
+            baserev = int(match.group("baserev"))
+            xml_log = subversion.log_xml(tag_url, baserev)
+            revisions = subversion.extract_tag_revisions(xml_log)
+            tag_change_count = len(revisions)
+            return (date, tag_change_count)
+        else:
+            raise RuntimeError("Cannot determine tag parameters from %r"
+                               % tag_url)



More information about the Treepkg-commits mailing list