changeset 525:e73a4bbc35e7

tag_pkg_parameters depends on scm therefore move this method to the tagdetetors which are scm aware currently bot tag_pkg_parameters (for git and svn) contain hardcoded regular expressions which should be removed in future
author Bjoern Ricks <bricks@intevation.de>
date Mon, 15 Nov 2010 14:34:15 +0000
parents e90a21cfbc3b
children 4a56ebc53ada
files recipes/kde/enterprise/generic.py treepkg/git.py treepkg/subversion.py
diffstat 3 files changed, 30 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/recipes/kde/enterprise/generic.py	Thu Nov 11 11:50:08 2010 +0000
+++ b/recipes/kde/enterprise/generic.py	Mon Nov 15 14:34:15 2010 +0000
@@ -132,7 +132,7 @@
                 self.tag_revision = tag_revision
                 self.tag_rules_url = tag_rules_url
                 self.tag_rules_revision = tag_rules_revision
-                tag_date, tag_change_count = self.tag_pkg_parameters(tag_url)
+                tag_date, tag_change_count = self.tag_detector.tag_pkg_parameters(tag_url)
                 pkg_revision = (self.pkg_revision_template
                                 % dict(pkg_revision=tag_change_count,
                                        rules_revision=revision[1]))
@@ -166,17 +166,3 @@
         else:
             super(PackageTrack, self).copy_debian_directory(to_dir)
 
-    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 = 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)
--- a/treepkg/git.py	Thu Nov 11 11:50:08 2010 +0000
+++ b/treepkg/git.py	Mon Nov 15 14:34:15 2010 +0000
@@ -171,3 +171,16 @@
             except GitError:
                 pass
         return urlrev
+
+    def tag_pkg_parameters(self, tag_name):
+        # FIXME: Don't hardcore svn tag path and regex
+        #match = re.search(r"enterprise[^.]*\.[^.]*\."
+        match = re.search(r"enterprise[^.]*"
+                          r"(?P<date>[0-9]{8})",
+                          tag_name)
+        if match:
+            date = match.group("date")
+            return (date, 1)
+        else:
+            raise GitError("Cannot determine tag parameters from %s"
+                               % tag_name)
--- a/treepkg/subversion.py	Thu Nov 11 11:50:08 2010 +0000
+++ b/treepkg/subversion.py	Mon Nov 15 14:34:15 2010 +0000
@@ -345,3 +345,19 @@
         except SubversionError:
             pass
         return urlrev
+
+    def tag_pkg_parameters(self, tag_url):
+        # FIXME: Don't hardcore svn tag path and regex
+        match = re.search(r"/enterprise[^.]*\.[^.]*\."
+                          r"(?P<date>[0-9]{8})\.(?P<baserev>[0-9]+)/",
+                          tag_url)
+        if match:
+            date = match.group("date")
+            baserev = 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 %s"
+                               % tag_url)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)