comparison recipes/kde_enterprise_3_5/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 c0cbd133b607
comparison
equal deleted inserted replaced
273:4b700b39c32f 274:2676abfc0e1d
15 import treepkg.subversion 15 import treepkg.subversion
16 16
17 17
18 class BaseSourcePackager(treepkg.packager.SourcePackager): 18 class BaseSourcePackager(treepkg.packager.SourcePackager):
19 19
20 changemsg_template = None
21
22 def __init__(self, *args, **kw): 20 def __init__(self, *args, **kw):
23 super(BaseSourcePackager, self).__init__(*args, **kw) 21 super(BaseSourcePackager, self).__init__(*args, **kw)
24 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \ 22 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
25 + "." + str(self.revision)) 23 + "." + str(self.revision))
26 24
27 def determine_package_version(self, directory): 25 def determine_package_version(self, directory):
28 enterprise_version = self.enterprise_version 26 enterprise_version = self.enterprise_version
29 return self.track.version_template % locals() 27 return self.track.version_template % locals()
30 28
31 def do_package(self): 29 def prepare_sources_for_tarball(self, pkgbasedir):
32 pkgbaseversion, pkgbasedir = self.export_sources()
33 self.update_version_numbers(pkgbasedir) 30 self.update_version_numbers(pkgbasedir)
34 31
35 pkgbasename = self.pkg_basename + "_" + pkgbaseversion 32 def update_version_numbers(self, pkgbasedir):
36 origtargz = os.path.join(self.work_dir, 33 """Updates the version numbers in the code in pkgbasedir.
37 pkgbasename + ".orig.tar.gz") 34 The default implementation does nothing. Derived classes should
38 self.create_tarball(origtargz, self.work_dir, 35 override this method if necessary.
39 os.path.basename(pkgbasedir)) 36 """
40
41 changemsg = self.changemsg_template % dict(revision=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 37
48 38
49 class BasePackageTrack(treepkg.packager.PackageTrack): 39 class BasePackageTrack(treepkg.packager.PackageTrack):
50 40
51 extra_config_desc = [("version_template", str, "%(enterprise_version)s"), 41 extra_config_desc = [("version_template", str, "%(enterprise_version)s"),
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)