comparison recipes/kde_enterprise_4/base.py @ 216:89ca9ba349e5

New module with code common to almost all kdepim enterprise 4 recipes
author Bernhard Herzog <bh@intevation.de>
date Tue, 06 Jan 2009 16:01:11 +0000
parents
children 9c0131d2e0e1
comparison
equal deleted inserted replaced
215:c14c8ca06ddf 216:89ca9ba349e5
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
2 # Authors:
3 # Bernhard Herzog <bh@intevation.de>
4 #
5 # This program is free software under the GPL (>=v2)
6 # Read the file COPYING coming with the software for details.
7
8 """Base classes for all kdepim packagers"""
9
10 import os
11 import time
12 import inspect
13
14 import treepkg.packager
15
16
17 class BaseSourcePackager(treepkg.packager.SourcePackager):
18
19 def __init__(self, *args, **kw):
20 super(BaseSourcePackager, self).__init__(*args, **kw)
21 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
22 + "." + str(self.revision))
23
24 def determine_package_version(self, directory):
25 enterprise_version = self.enterprise_version
26 return self.track.version_template % locals()
27
28 def do_package(self):
29 pkgbaseversion, pkgbasedir = self.export_sources()
30 self.update_version_numbers(pkgbasedir)
31
32 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
33 origtargz = os.path.join(self.work_dir,
34 pkgbasename + ".orig.tar.gz")
35 self.create_tarball(origtargz, self.work_dir,
36 os.path.basename(pkgbasedir))
37
38 changemsg = ("Update to SVN enterprise4 branch rev. %d"
39 % (self.revision,))
40 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
41 changemsg)
42
43 self.create_source_package(pkgbasedir, origtargz)
44 self.move_source_package(pkgbasename)
45
46
47 class BasePackageTrack(treepkg.packager.PackageTrack):
48
49 extra_config_desc = ["version_template"]
50
51 def __init__(self, *args, **kw):
52 self.version_template = kw.pop("version_template")
53 super(BasePackageTrack, self).__init__(*args, **kw)
54
55
56 def define_kdepim_packager(basename=None, external_subdirs=None):
57
58 caller_globals = inspect.currentframe().f_back.f_globals
59
60 SourcePackager = caller_globals.get("SourcePackager")
61 if SourcePackager is None:
62 class SourcePackager(BaseSourcePackager):
63 pkg_basename = basename
64
65 class RevisionPackager(treepkg.packager.RevisionPackager):
66 source_packager_cls = SourcePackager
67
68 class PackageTrack(BasePackageTrack):
69 revision_packager_cls = RevisionPackager
70
71 if external_subdirs is not None:
72 svn_external_subdirs = external_subdirs
73
74 caller_globals["PackageTrack"] = PackageTrack
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)