Mercurial > treepkg
annotate recipes/kde_enterprise_3_5/kdepim.py @ 271:12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
a simple port of the implementation for the enterprise 4 branch.
This change leads to a lot of duplicated code that needs to be refactored.
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Thu, 07 May 2009 13:51:21 +0000 |
parents | 710538908609 |
children | c0cbd133b607 |
rev | line source |
---|---|
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
161
diff
changeset
|
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
4
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 |
159
3f2ec4314855
Changed matching string enterprise->enterprise35, so it matches
Bernhard Reiter <bernhard@intevation.de>
parents:
132
diff
changeset
|
8 """Packager that builds KDE-PIM debian packages from the enterprise35 branch. |
3f2ec4314855
Changed matching string enterprise->enterprise35, so it matches
Bernhard Reiter <bernhard@intevation.de>
parents:
132
diff
changeset
|
9 """ |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 import os |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 import time |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 import re |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 import treepkg.util |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
16 import treepkg.packager |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
17 |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
161
diff
changeset
|
18 import base |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
161
diff
changeset
|
20 class SourcePackager(base.BaseSourcePackager): |
4
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 pkg_basename = "kdepim" |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
161
diff
changeset
|
23 changemsg_template = "Update to SVN enterprise35 branch rev. %(revision)d" |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
24 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
25 def kdepim_version(self, directory): |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
26 """Determine the kdepim version. |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
27 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
28 The version is taken from the kdepim.lsm file. |
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 return treepkg.util.extract_lsm_version(os.path.join(directory, |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
31 "kdepim.lsm")) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
32 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 def determine_package_version(self, directory): |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
34 enterprise_version = self.enterprise_version |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
35 kdepimversion = self.kdepim_version(directory) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 version_template = "%(kdepimversion)s.enterprise.0.%(enterprise_version)s" |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
37 return version_template % locals() |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
38 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 def update_version_numbers(self, pkgbasedir): |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 """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
|
41 """ |
159
3f2ec4314855
Changed matching string enterprise->enterprise35, so it matches
Bernhard Reiter <bernhard@intevation.de>
parents:
132
diff
changeset
|
42 versionstring = "(enterprise35 %s)" % self.enterprise_version |
161
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
43 failed = [] |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
44 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp", |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
45 "korganizer/version.h"]: |
161
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
46 if not treepkg.util.replace_in_file(os.path.join(pkgbasedir, |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
47 versionfile), |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
48 "\(enterprise35 ([^)]*)\)", |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
49 versionstring): |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
50 failed.append(versionfile) |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
51 if failed: |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
52 raise RuntimeError("kdepim: failed to update version numbers in %s" |
710538908609
kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents:
159
diff
changeset
|
53 % (", ".join(failed),)) |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
54 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
55 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
56 class RevisionPackager(treepkg.packager.RevisionPackager): |
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 source_packager_cls = SourcePackager |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
59 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
60 |
271
12facd1b5f19
Implement tag detection for the KDEPIM enterprise 3.5 packages. This is
Bernhard Herzog <bh@intevation.de>
parents:
161
diff
changeset
|
61 class PackageTrack(base.BasePackageTrack): |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
62 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
63 revision_packager_cls = RevisionPackager |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
64 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
65 svn_external_subdirs = ["admin"] |