Mercurial > treepkg
changeset 286:4376c5315c72
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.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Tue, 04 Aug 2009 10:32:33 +0000 |
parents | bfcb6bef7f58 |
children | 1fcdffbeb9de |
files | recipes/kde_enterprise_3_5/base.py |
diffstat | 1 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/recipes/kde_enterprise_3_5/base.py Tue Aug 04 10:30:48 2009 +0000 +++ b/recipes/kde_enterprise_3_5/base.py Tue Aug 04 10:32:33 2009 +0000 @@ -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)