Mercurial > treepkg
comparison enterprise/kdepim.py @ 4:fee641fec94e
Separate the kolab specific parts.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Fri, 09 Mar 2007 12:26:01 +0100 |
parents | |
children | 574506a022f6 |
comparison
equal
deleted
inserted
replaced
3:7e9db903ba16 | 4:fee641fec94e |
---|---|
1 # Copyright (C) 2007 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 """Packager that builds KDE-PIM debian packages from the enterprise branch""" | |
9 | |
10 import os | |
11 import time | |
12 import re | |
13 | |
14 import treepkg.util | |
15 import treepkg.packager | |
16 | |
17 | |
18 class SourcePackager(treepkg.packager.SourcePackager): | |
19 | |
20 pkg_basename = "kdepim" | |
21 | |
22 def __init__(self, *args, **kw): | |
23 super(SourcePackager, self).__init__(*args, **kw) | |
24 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \ | |
25 + "." + str(self.revision)) | |
26 | |
27 def kdepim_version(self, directory): | |
28 """Determine the kdepim version. | |
29 | |
30 The version is taken from the kdepim.lsm file. | |
31 """ | |
32 return treepkg.util.extract_lsm_version(os.path.join(directory, | |
33 "kdepim.lsm")) | |
34 | |
35 def determine_package_version(self, directory): | |
36 enterprise_version = self.enterprise_version | |
37 kdepimversion = self.kdepim_version(directory) | |
38 version_template = "%(kdepimversion)s.enterprise.0.%(enterprise_version)s" | |
39 return version_template % locals() | |
40 | |
41 def update_version_numbers(self, pkgbasedir): | |
42 """Overrides the inherited method to update version numbers in the code | |
43 """ | |
44 versionstring = "(enterprise %s)" % self.enterprise_version | |
45 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp", | |
46 "korganizer/version.h"]: | |
47 filename = os.path.join(pkgbasedir, versionfile) | |
48 patched = re.sub("\(enterprise ([^)]*)\)", versionstring, | |
49 open(filename).read()) | |
50 f = open(filename, "w") | |
51 f.write(patched) | |
52 f.close() | |
53 | |
54 def do_package(self): | |
55 pkgbaseversion, pkgbasedir = self.export_sources() | |
56 self.update_version_numbers(pkgbasedir) | |
57 | |
58 pkgbasename = "kdepim_" + pkgbaseversion | |
59 origtargz = os.path.join(self.work_dir, | |
60 pkgbasename + ".orig.tar.gz") | |
61 self.create_tarball(origtargz, self.work_dir, | |
62 os.path.basename(pkgbasedir)) | |
63 | |
64 changemsg = ("Update to SVN enterprise branch rev. %d" | |
65 % (self.revision,)) | |
66 self.copy_debian_directory(pkgbasedir, pkgbaseversion, | |
67 changemsg) | |
68 | |
69 self.create_source_package(pkgbasedir, origtargz) | |
70 self.move_source_package(pkgbasename) | |
71 | |
72 | |
73 class RevisionPackager(treepkg.packager.RevisionPackager): | |
74 | |
75 source_packager_cls = SourcePackager | |
76 | |
77 | |
78 class AssemblyLine(treepkg.packager.AssemblyLine): | |
79 | |
80 revision_packager_cls = RevisionPackager | |
81 | |
82 svn_external_subdirs = ["admin"] |