annotate recipes/kde_enterprise_4/kdepim.py @ 204:e868c6818f8c

Add recipes for KDEPIM enterprise 4 packages
author Bernhard Herzog <bh@intevation.de>
date Fri, 05 Sep 2008 19:43:59 +0000
parents
children 4307e25d2afe
rev   line source
204
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2007, 2008 by Intevation GmbH
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
4 #
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 # This program is free software under the GPL (>=v2)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # Read the file COPYING coming with the software for details.
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8 """Packager that builds KDE-PIM debian packages from the enterprise35 branch.
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9 """
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import os
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import time
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13 import re
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15 import treepkg.util
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16 import treepkg.packager
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 class SourcePackager(treepkg.packager.SourcePackager):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 pkg_basename = "kdepim"
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 def __init__(self, *args, **kw):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 super(SourcePackager, self).__init__(*args, **kw)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 + "." + str(self.revision))
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 def determine_package_version(self, directory):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 enterprise_version = self.enterprise_version
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 return self.track.version_template % locals()
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32 def update_version_numbers(self, pkgbasedir):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 """Overrides the inherited method to update version numbers in the code
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34 """
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35 return
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
36 versionstring = "(enterprise35 %s)" % self.enterprise_version
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
37 failed = []
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
38 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp",
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
39 "korganizer/version.h"]:
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
40 if not treepkg.util.replace_in_file(os.path.join(pkgbasedir,
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41 versionfile),
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42 "\(enterprise35 ([^)]*)\)",
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43 versionstring):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
44 failed.append(versionfile)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
45 if failed:
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
46 raise RuntimeError("kdepim: failed to update version numbers in %s"
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
47 % (", ".join(failed),))
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
48
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
49 def do_package(self):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
50 pkgbaseversion, pkgbasedir = self.export_sources()
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
51 self.update_version_numbers(pkgbasedir)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
52
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
53 pkgbasename = "kdepim_" + pkgbaseversion
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
54 origtargz = os.path.join(self.work_dir,
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
55 pkgbasename + ".orig.tar.gz")
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
56 self.create_tarball(origtargz, self.work_dir,
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
57 os.path.basename(pkgbasedir))
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
58
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
59 changemsg = ("Update to SVN enterprise35 branch rev. %d"
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
60 % (self.revision,))
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
61 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
62 changemsg)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64 self.create_source_package(pkgbasedir, origtargz)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 self.move_source_package(pkgbasename)
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
67
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
68 class RevisionPackager(treepkg.packager.RevisionPackager):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
69
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
70 source_packager_cls = SourcePackager
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
71
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
72
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
73 class PackageTrack(treepkg.packager.PackageTrack):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
74
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
75 extra_config_desc = ["version_template"]
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
76
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
77 revision_packager_cls = RevisionPackager
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
78
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
79 def __init__(self, *args, **kw):
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
80 self.version_template = kw.pop("version_template")
e868c6818f8c Add recipes for KDEPIM enterprise 4 packages
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
81 super(PackageTrack, self).__init__(*args, **kw)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)