[Treepkg-commits] r459 - in trunk: recipes/kde/enterprise treepkg

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Oct 20 09:51:54 CEST 2010


Author: bricks
Date: 2010-10-20 09:51:53 +0200 (Wed, 20 Oct 2010)
New Revision: 459

Modified:
   trunk/recipes/kde/enterprise/kde_l10n.py
   trunk/recipes/kde/enterprise/tags.py
   trunk/treepkg/packager.py
Log:
consolidate enterprise packagers


Modified: trunk/recipes/kde/enterprise/kde_l10n.py
===================================================================
--- trunk/recipes/kde/enterprise/kde_l10n.py	2010-10-15 17:03:11 UTC (rev 458)
+++ trunk/recipes/kde/enterprise/kde_l10n.py	2010-10-20 07:51:53 UTC (rev 459)
@@ -59,19 +59,7 @@
 
     def __init__(self, *args, **kw):
         super(SourcePackager, self).__init__(*args, **kw)
-        self.enterprise_version = (time.strftime("%Y%m%d", time.localtime())
-                                   + "." + str(self.revision))
 
-    def determine_package_version(self, directory):
-        enterprise_version = self.enterprise_version
-        revision = self.revision
-        rules_revision = self.parent.rules_revision
-        pkg_revision = self.parent.pkg_revision
-        pkg_date = self.parent.pkg_date
-
-        return super(SourcePackager, self).determine_package_version($
-                                directory, locals())
-
     def create_l10n_de_tarball(self, pkgbasedir, pkgbaseversion):
         logging.info("Creating kde-l10n-de tarball")
         de_tarball = os.path.join(self.work_dir,

Modified: trunk/recipes/kde/enterprise/tags.py
===================================================================
--- trunk/recipes/kde/enterprise/tags.py	2010-10-15 17:03:11 UTC (rev 458)
+++ trunk/recipes/kde/enterprise/tags.py	2010-10-20 07:51:53 UTC (rev 459)
@@ -6,80 +6,21 @@
 # This program is free software under the GPL (>=v2)
 # Read the file COPYING coming with the software for details.
 
-"""Base classes for all kde entperprise packagers"""
+"""PackageTrack for kde entperprise tag only builds"""
 
-import re
-import time
 import logging
 
-import treepkg.packager
-import treepkg.subversion as subversion
+import recipes.kde.enterprise.generic as enterprise
 
+class PackageTrack(enterprise.PackageTrack):
 
-class SourcePackager(treepkg.packager.SourcePackager):
+    """In contrast to recipes.kde.enterprise.generic.PackageTrack
+       this PackageTrack either builds trunk or newest tag"""
 
-    def __init__(self, *args, **kw):
-        super(SourcePackager, self).__init__(*args, **kw)
-        self.enterprise_version = (self.parent.pkg_date + "."
-                                   + str(self.revision))
+    revision_packager_cls = enterprise.RevisionPackager
 
-    def determine_package_version(self, directory):
-        enterprise_version = self.enterprise_version
-        revision = self.revision
-        rules_revision = self.parent.rules_revision
-        pkg_revision = self.parent.pkg_revision
-        pkg_date = self.parent.pkg_date
-
-        return super(SourcePackager, self).determine_package_version(
-                directory, locals())
-
-    def prepare_sources_for_tarball(self, pkgbasedir, pkgbaseversion):
-        self.update_version_numbers(pkgbasedir)
-
-    def get_change_msg(self):
-        return self.changemsg_template % dict(revision=self.revision,
-                                     pkg_date=self.parent.pkg_date,
-                                     rules_revision=self.parent.rules_revision)
-
-    def update_version_numbers(self, pkgbasedir):
-        """Updates the version numbers in the code in pkgbasedir.
-        The default implementation does nothing.  Derived classes should
-        override this method if necessary.
-        """
-
-
-class RevisionPackager(treepkg.packager.RevisionPackager):
-
-    source_packager_cls = SourcePackager
-
     def __init__(self, *args, **kw):
-        self.pkg_date = kw.pop("pkg_date",
-                               time.strftime("%Y%m%d", time.localtime()))
-        super(RevisionPackager, self).__init__(*args, **kw)
-
-
-class PackageTrack(treepkg.packager.PackageTrack):
-
-    revision_packager_cls = RevisionPackager
-
-    extra_config_desc = [("tags_url", str, ""),
-                         ("tags_pattern", str, ""),
-                         ("tags_subdir", str, ""),
-                         ("tags_rules_subdir", str, "")]
-
-    def __init__(self, *args, **kw):
-        tags_url = kw.pop("tags_url")
-        tags_pattern = kw.pop("tags_pattern")
-        tags_subdir = kw.pop("tags_subdir")
-        tags_rules_subdir = kw.pop("tags_rules_subdir")
         super(PackageTrack, self).__init__(*args, **kw)
-        self.tag_detector = subversion.TagDetector(tags_url, tags_pattern,
-                                                   tags_subdir)
-        self.tag_rules_detector = subversion.TagDetector(tags_url, tags_pattern,
-                                                   tags_rules_subdir)
-        self.found_tag_rules = False
-        if tags_rules_subdir:
-            self.found_tag_rules = True
 
     def packager_for_new_revision(self):
         logging.info("Checking tags")
@@ -118,36 +59,4 @@
         else: # 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).packager_for_new_revision()
-
-    def export_sources(self, to_dir):
-        if self.tag_url is not None:
-            logging.info("Exporting sources for tarball from %r to %r",
-                         self.tag_url, to_dir)
-            self.working_copy.export_tag(self.tag_url, to_dir,
-                                         revision=self.tag_revision)
-        else:
-            super(PackageTrack, self).export_sources(to_dir)
-
-    def copy_debian_directory(self, to_dir):
-        if self.use_tag_rules:
-            logging.info("Exporting debian package description from %s to %s",
-                    self.tag_rules_url, to_dir)
-            self.rules_working_copy.export_tag(self.tag_rules_url, to_dir)
-        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)
+            return super(PackageTrack, self).new_revsision_packager()

Modified: trunk/treepkg/packager.py
===================================================================
--- trunk/treepkg/packager.py	2010-10-15 17:03:11 UTC (rev 458)
+++ trunk/treepkg/packager.py	2010-10-20 07:51:53 UTC (rev 459)
@@ -632,7 +632,10 @@
         env["DEB_BUILD_PARALLEL"] = "true"
         return env
 
-    def packager_for_new_revision(self):
+    def new_revsision_packager(self):
+        """ Checks if a new revision is available and returns a new
+        revision packager class. Don't override this method in a subclass.
+        Use packager_for_new_revision() instead."""
         current_revision = (self.last_changed_revision(),
                             self.rules_working_copy.last_changed_revision())
         logging.info("New revision is %s", current_revision)
@@ -644,6 +647,9 @@
             logging.info("Revision %s has already been packaged.",
                          current_revision)
 
+    def packager_for_new_revision(self):
+        return self.new_revsision_packager()
+
     def package_if_updated(self, revision=None, do_svn_update=True):
         """Returns a new packager if the working copy has not been packaged yet.
         If do_svn_update is true -- the default -- update the working



More information about the Treepkg-commits mailing list