diff 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
line wrap: on
line diff
--- a/recipes/kde_enterprise_4/base.py	Thu May 07 14:25:10 2009 +0000
+++ b/recipes/kde_enterprise_4/base.py	Thu May 07 15:19:15 2009 +0000
@@ -18,6 +18,8 @@
 
 class BaseSourcePackager(treepkg.packager.SourcePackager):
 
+    changemsg_template = "Update to SVN enterprise4 branch rev. %(revision)d"
+
     def __init__(self, *args, **kw):
         super(BaseSourcePackager, self).__init__(*args, **kw)
         self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
@@ -27,23 +29,14 @@
         enterprise_version = self.enterprise_version
         return self.track.version_template % locals()
 
-    def do_package(self):
-        pkgbaseversion, pkgbasedir = self.export_sources()
+    def prepare_sources_for_tarball(self, pkgbasedir):
         self.update_version_numbers(pkgbasedir)
 
-        pkgbasename = self.pkg_basename + "_" + pkgbaseversion
-        origtargz = os.path.join(self.work_dir,
-                                 pkgbasename + ".orig.tar.gz")
-        self.create_tarball(origtargz, self.work_dir,
-                            os.path.basename(pkgbasedir))
-
-        changemsg = ("Update to SVN enterprise4 branch rev. %d"
-                     % (self.revision,))
-        self.copy_debian_directory(pkgbasedir, pkgbaseversion,
-                                   changemsg)
-
-        self.create_source_package(pkgbasedir, origtargz)
-        self.move_source_package(pkgbasename)
+    def update_version_numbers(self, pkgbasedir):
+        """Updates the version numbers in the code in pkgbasedir.
+        The default implementation does nothing.  Derived classes should
+        override this method if necessary.
+        """
 
 
 class BasePackageTrack(treepkg.packager.PackageTrack):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)