# HG changeset patch # User Bernhard Herzog # Date 1241618451 0 # Node ID e5e23c3acaeac822c1eceed0da957fcf14dbaf20 # Parent 97fd2584df5f4e129cf1502d81b5a98ebc3beaf1 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. diff -r 97fd2584df5f -r e5e23c3acaea recipes/kde_enterprise_4/kde_l10n.py --- 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)