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