Mercurial > treepkg
annotate enterprise/kdepim.py @ 130:84a1716827f8
Fix typo in comment in demo.cfg
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Fri, 23 May 2008 16:42:52 +0000 |
parents | 7f6fb8103db0 |
children |
rev | line source |
---|---|
111
7f6fb8103db0
Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
52
diff
changeset
|
1 # Copyright (C) 2007, 2008 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 |
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"]: |
111
7f6fb8103db0
Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
52
diff
changeset
|
47 treepkg.util.replace_in_file(os.path.join(pkgbasedir, versionfile), |
7f6fb8103db0
Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
52
diff
changeset
|
48 "\(enterprise ([^)]*)\)", |
7f6fb8103db0
Move the sed-like replacement code from enterprise/kdepim.py to treepkg/util.py
Bernhard Herzog <bh@intevation.de>
parents:
52
diff
changeset
|
49 versionstring) |
4
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
50 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
51 def do_package(self): |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
52 pkgbaseversion, pkgbasedir = self.export_sources() |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
53 self.update_version_numbers(pkgbasedir) |
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 pkgbasename = "kdepim_" + pkgbaseversion |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
56 origtargz = os.path.join(self.work_dir, |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
57 pkgbasename + ".orig.tar.gz") |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
58 self.create_tarball(origtargz, self.work_dir, |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
59 os.path.basename(pkgbasedir)) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
60 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
61 changemsg = ("Update to SVN enterprise branch rev. %d" |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
62 % (self.revision,)) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
63 self.copy_debian_directory(pkgbasedir, pkgbaseversion, |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
64 changemsg) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
65 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
66 self.create_source_package(pkgbasedir, origtargz) |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
67 self.move_source_package(pkgbasename) |
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 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
70 class RevisionPackager(treepkg.packager.RevisionPackager): |
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 source_packager_cls = SourcePackager |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
73 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
74 |
52
78cf5f6778ec
Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents:
8
diff
changeset
|
75 class PackageTrack(treepkg.packager.PackageTrack): |
4
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 revision_packager_cls = RevisionPackager |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
78 |
fee641fec94e
Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
79 svn_external_subdirs = ["admin"] |