annotate recipes/kde_enterprise_3_5/kdepim.py @ 265:9c0131d2e0e1

Add automatic detection and builds of svn tags for the kdepim enterprise4 packages. Doesn't work for kde-l10n yet.
author Bernhard Herzog <bh@intevation.de>
date Wed, 29 Apr 2009 16:53:00 +0000
parents 710538908609
children 12facd1b5f19
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
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
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 class SourcePackager(treepkg.packager.SourcePackager):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 pkg_basename = "kdepim"
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 def __init__(self, *args, **kw):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 super(SourcePackager, self).__init__(*args, **kw)
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 + "." + str(self.revision))
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 def kdepim_version(self, directory):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29 """Determine the kdepim version.
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 The version is taken from the kdepim.lsm file.
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 return treepkg.util.extract_lsm_version(os.path.join(directory,
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34 "kdepim.lsm"))
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
36 def determine_package_version(self, directory):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
37 enterprise_version = self.enterprise_version
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
38 kdepimversion = self.kdepim_version(directory)
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
39 version_template = "%(kdepimversion)s.enterprise.0.%(enterprise_version)s"
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
40 return version_template % locals()
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42 def update_version_numbers(self, pkgbasedir):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43 """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
44 """
159
3f2ec4314855 Changed matching string enterprise->enterprise35, so it matches
Bernhard Reiter <bernhard@intevation.de>
parents: 132
diff changeset
45 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
46 failed = []
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
47 for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp",
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
48 "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
49 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
50 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 "\(enterprise35 ([^)]*)\)",
710538908609 kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents: 159
diff changeset
52 versionstring):
710538908609 kdepim recipe: raise an error if not all version replacements could be done
Bernhard Herzog <bh@intevation.de>
parents: 159
diff changeset
53 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
54 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
55 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
56 % (", ".join(failed),))
4
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 def do_package(self):
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
59 pkgbaseversion, pkgbasedir = self.export_sources()
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
60 self.update_version_numbers(pkgbasedir)
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
61
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
62 pkgbasename = "kdepim_" + pkgbaseversion
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63 origtargz = os.path.join(self.work_dir,
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64 pkgbasename + ".orig.tar.gz")
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 self.create_tarball(origtargz, self.work_dir,
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66 os.path.basename(pkgbasedir))
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
67
159
3f2ec4314855 Changed matching string enterprise->enterprise35, so it matches
Bernhard Reiter <bernhard@intevation.de>
parents: 132
diff changeset
68 changemsg = ("Update to SVN enterprise35 branch rev. %d"
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
69 % (self.revision,))
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
70 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
71 changemsg)
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 self.create_source_package(pkgbasedir, origtargz)
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
74 self.move_source_package(pkgbasename)
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
75
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 class RevisionPackager(treepkg.packager.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 source_packager_cls = SourcePackager
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
80
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
81
52
78cf5f6778ec Rename 'packagel ine' -> 'package track'
Bernhard Herzog <bh@intevation.de>
parents: 8
diff changeset
82 class PackageTrack(treepkg.packager.PackageTrack):
4
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
83
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
84 revision_packager_cls = RevisionPackager
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
85
fee641fec94e Separate the kolab specific parts.
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
86 svn_external_subdirs = ["admin"]
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)