annotate recipes/kde_enterprise_4/base.py @ 256:8052aabada8b

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