Mercurial > treepkg
annotate recipes/kde/enterprise/branch_3_5/kdepim.py @ 578:bccd69dedbe5
shlex.split all config parameters that may contain a command
Return the command as list and use @ operator for the variable in cmdexpand
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Sat, 03 Sep 2011 11:53:12 +0000 |
parents | 57034905ac4c |
children |
rev | line source |
---|---|
315
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
2 # Authors: |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
3 # Bernhard Herzog <bh@intevation.de> |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
4 # |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # This program is free software under the GPL (>=v2) |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
6 # Read the file COPYING coming with the software for details. |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
7 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 """Packager that builds KDE-PIM debian packages from the enterprise35 branch. |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
9 """ |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 import os |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 import time |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 import re |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 import treepkg.util |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
16 import treepkg.packager |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
17 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
18 import recipes.kde.enterprise.generic as generic |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
21 class SourcePackager(generic.SourcePackager): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
22 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
23 def kdepim_version(self, directory): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
24 """Determine the kdepim version. |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
25 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
26 The version is taken from the kdepim.lsm file. |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
27 """ |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
28 return treepkg.util.extract_lsm_version(os.path.join(directory, |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
29 "kdepim.lsm")) |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
30 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
31 def determine_package_version(self, directory): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
32 enterprise_version = self.enterprise_version |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 kdepimversion = self.kdepim_version(directory) |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
34 version_template = \ |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
35 "%(kdepimversion)s.enterprise.0.%(enterprise_version)s" |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 return version_template % locals() |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
37 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
38 def update_version_numbers(self, pkgbasedir): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 """Overrides the inherited method to update version numbers in the code |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
40 """ |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
41 versionstring = "(enterprise35 %s)" % self.enterprise_version |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
42 failed = [] |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
43 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp", |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
44 "korganizer/version.h"]: |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
45 if not treepkg.util.replace_in_file(os.path.join(pkgbasedir, |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
46 versionfile), |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
47 "\(enterprise35 ([^)]*)\)", |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
48 versionstring): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
49 failed.append(versionfile) |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
50 if failed: |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
51 raise RuntimeError("kdepim: failed to update version numbers in %s" |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
52 % (", ".join(failed),)) |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
53 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
54 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
55 class RevisionPackager(generic.RevisionPackager): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
56 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
57 source_packager_cls = SourcePackager |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
58 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
59 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
60 class PackageTrack(generic.PackageTrack): |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
61 |
57034905ac4c
Copy the enterprise 3.5 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
62 revision_packager_cls = RevisionPackager |