Mercurial > treepkg
changeset 270:e5e23c3acaea
Add tag detection to the enterprise4 kde-l10n packager by using
BasePackageTrack as the base class and overwriting export_tag to export
the tag's sources using the l10n package's custom subversion abstraction.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Wed, 06 May 2009 14:00:51 +0000 |
parents | 97fd2584df5f |
children | 12facd1b5f19 |
files | recipes/kde_enterprise_4/kde_l10n.py |
diffstat | 1 files changed, 21 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/recipes/kde_enterprise_4/kde_l10n.py Wed May 06 13:54:04 2009 +0000 +++ b/recipes/kde_enterprise_4/kde_l10n.py Wed May 06 14:00:51 2009 +0000 @@ -14,6 +14,8 @@ import treepkg.util import treepkg.subversion as subversion +from base import TagDetector, BasePackageTrack + class SubversionSubset(object): @@ -51,11 +53,20 @@ subversion.checkout(svn_url, localdir, revision=revision, recurse=recurse) - def export(self, destdir): + def export(self, destdir, url=None): + if url is not None: + baseurl = url + else: + baseurl = self.localdir for desc in self.subdirectories: - subdir = desc[0] - subversion.export(os.path.join(self.localdir, subdir), - os.path.join(destdir, subdir)) + if len(desc) == 2: + subdir, recurse = desc + else: + subdir = desc[0] + recurse = True + subversion.export(os.path.join(baseurl, subdir), + os.path.join(destdir, subdir), + recurse=recurse) def last_changed_revision(self): return max([subversion.last_changed_revision(os.path.join(self.localdir, @@ -162,17 +173,19 @@ source_packager_cls = SourcePackager -class PackageTrack(treepkg.packager.PackageTrack): - - extra_config_desc = ["version_template"] +class PackageTrack(BasePackageTrack): revision_packager_cls = RevisionPackager def __init__(self, *args, **kw): - self.version_template = kw.pop("version_template") svn_url = kw["svn_url"] super(PackageTrack, self).__init__(*args, **kw) self.working_copy = SubversionSubset(svn_url, self.checkout_dir, subdirectories= [("", False), ("de",), ("scripts",)]) + + def export_tag(self, tag_url, to_dir): + logging.info("Exporting sources from %s to %r", + tag_url, to_dir) + self.working_copy.export(to_dir, url=tag_url)