Mercurial > treepkg
comparison recipes/kde_enterprise_4/base.py @ 274:2676abfc0e1d
Refactoring: Implement do_package in treepkg.packager.SourcePackager.
The actual implementation in the derived classes is almost identical in
all cases so it's better to have as much of the implementation in the
base class. The update_version_numbers method is not called directly by
the base class code so is removed from the base class. OTOH,
prepare_sources_for_tarball has been added as a more general variant of
update_version_numbers that is actually called by the default
implementation of do_package.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Thu, 07 May 2009 15:19:15 +0000 |
parents | 4b700b39c32f |
children | f3dee156e3e3 |
comparison
equal
deleted
inserted
replaced
273:4b700b39c32f | 274:2676abfc0e1d |
---|---|
16 import treepkg.subversion | 16 import treepkg.subversion |
17 | 17 |
18 | 18 |
19 class BaseSourcePackager(treepkg.packager.SourcePackager): | 19 class BaseSourcePackager(treepkg.packager.SourcePackager): |
20 | 20 |
21 changemsg_template = "Update to SVN enterprise4 branch rev. %(revision)d" | |
22 | |
21 def __init__(self, *args, **kw): | 23 def __init__(self, *args, **kw): |
22 super(BaseSourcePackager, self).__init__(*args, **kw) | 24 super(BaseSourcePackager, self).__init__(*args, **kw) |
23 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \ | 25 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \ |
24 + "." + str(self.revision)) | 26 + "." + str(self.revision)) |
25 | 27 |
26 def determine_package_version(self, directory): | 28 def determine_package_version(self, directory): |
27 enterprise_version = self.enterprise_version | 29 enterprise_version = self.enterprise_version |
28 return self.track.version_template % locals() | 30 return self.track.version_template % locals() |
29 | 31 |
30 def do_package(self): | 32 def prepare_sources_for_tarball(self, pkgbasedir): |
31 pkgbaseversion, pkgbasedir = self.export_sources() | |
32 self.update_version_numbers(pkgbasedir) | 33 self.update_version_numbers(pkgbasedir) |
33 | 34 |
34 pkgbasename = self.pkg_basename + "_" + pkgbaseversion | 35 def update_version_numbers(self, pkgbasedir): |
35 origtargz = os.path.join(self.work_dir, | 36 """Updates the version numbers in the code in pkgbasedir. |
36 pkgbasename + ".orig.tar.gz") | 37 The default implementation does nothing. Derived classes should |
37 self.create_tarball(origtargz, self.work_dir, | 38 override this method if necessary. |
38 os.path.basename(pkgbasedir)) | 39 """ |
39 | |
40 changemsg = ("Update to SVN enterprise4 branch rev. %d" | |
41 % (self.revision,)) | |
42 self.copy_debian_directory(pkgbasedir, pkgbaseversion, | |
43 changemsg) | |
44 | |
45 self.create_source_package(pkgbasedir, origtargz) | |
46 self.move_source_package(pkgbasename) | |
47 | 40 |
48 | 41 |
49 class BasePackageTrack(treepkg.packager.PackageTrack): | 42 class BasePackageTrack(treepkg.packager.PackageTrack): |
50 | 43 |
51 extra_config_desc = ["version_template", | 44 extra_config_desc = ["version_template", |