comparison recipes/kde_enterprise_4/kde_l10n.py @ 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 766df0172f0b
children 026dd7286431
comparison
equal deleted inserted replaced
269:97fd2584df5f 270:e5e23c3acaea
11 import time 11 import time
12 12
13 import treepkg.packager 13 import treepkg.packager
14 import treepkg.util 14 import treepkg.util
15 import treepkg.subversion as subversion 15 import treepkg.subversion as subversion
16
17 from base import TagDetector, BasePackageTrack
16 18
17 19
18 class SubversionSubset(object): 20 class SubversionSubset(object):
19 21
20 """Manage a subversion working copy that contains a subset of a repository 22 """Manage a subversion working copy that contains a subset of a repository
49 logging.info("The working copy in %r doesn't exist yet." 51 logging.info("The working copy in %r doesn't exist yet."
50 " Checking out from %r", localdir, svn_url) 52 " Checking out from %r", localdir, svn_url)
51 subversion.checkout(svn_url, localdir, revision=revision, 53 subversion.checkout(svn_url, localdir, revision=revision,
52 recurse=recurse) 54 recurse=recurse)
53 55
54 def export(self, destdir): 56 def export(self, destdir, url=None):
57 if url is not None:
58 baseurl = url
59 else:
60 baseurl = self.localdir
55 for desc in self.subdirectories: 61 for desc in self.subdirectories:
56 subdir = desc[0] 62 if len(desc) == 2:
57 subversion.export(os.path.join(self.localdir, subdir), 63 subdir, recurse = desc
58 os.path.join(destdir, subdir)) 64 else:
65 subdir = desc[0]
66 recurse = True
67 subversion.export(os.path.join(baseurl, subdir),
68 os.path.join(destdir, subdir),
69 recurse=recurse)
59 70
60 def last_changed_revision(self): 71 def last_changed_revision(self):
61 return max([subversion.last_changed_revision(os.path.join(self.localdir, 72 return max([subversion.last_changed_revision(os.path.join(self.localdir,
62 desc[0])) 73 desc[0]))
63 for desc in self.subdirectories]) 74 for desc in self.subdirectories])
160 class RevisionPackager(treepkg.packager.RevisionPackager): 171 class RevisionPackager(treepkg.packager.RevisionPackager):
161 172
162 source_packager_cls = SourcePackager 173 source_packager_cls = SourcePackager
163 174
164 175
165 class PackageTrack(treepkg.packager.PackageTrack): 176 class PackageTrack(BasePackageTrack):
166
167 extra_config_desc = ["version_template"]
168 177
169 revision_packager_cls = RevisionPackager 178 revision_packager_cls = RevisionPackager
170 179
171 def __init__(self, *args, **kw): 180 def __init__(self, *args, **kw):
172 self.version_template = kw.pop("version_template")
173 svn_url = kw["svn_url"] 181 svn_url = kw["svn_url"]
174 super(PackageTrack, self).__init__(*args, **kw) 182 super(PackageTrack, self).__init__(*args, **kw)
175 self.working_copy = SubversionSubset(svn_url, self.checkout_dir, 183 self.working_copy = SubversionSubset(svn_url, self.checkout_dir,
176 subdirectories= [("", False), 184 subdirectories= [("", False),
177 ("de",), 185 ("de",),
178 ("scripts",)]) 186 ("scripts",)])
187
188 def export_tag(self, tag_url, to_dir):
189 logging.info("Exporting sources from %s to %r",
190 tag_url, to_dir)
191 self.working_copy.export(to_dir, url=tag_url)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)