annotate recipes/kde/enterprise/kde_l10n.py @ 450:5c06e0a0d329

Enable more variables to be used in the version template.
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 11 Aug 2010 07:45:26 +0000
parents 51c447a6792e
children d85af9a6c93a
rev   line source
381
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
1 # Copyright (C) 2007 - 2010 by Intevation GmbH
316
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
2 # Authors:
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
3 # Bernhard Herzog <bh@intevation.de>
381
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
4 # Bjoern Ricks <bjoern.ricks@intevation.de>
316
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
5 #
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
6 # This program is free software under the GPL (>=v2)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
7 # Read the file COPYING coming with the software for details.
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
8
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
9 import os
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
10 import logging
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
11 import shutil
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
12 import time
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
13
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
14 import treepkg.util
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
15
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
16 import recipes.kde.enterprise.generic as generic
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
17
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
18
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
19 class SourcePackager(generic.SourcePackager):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
20
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
21 """Creates the debian source package for the l10n files
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
22
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
23 This is a bit more complicated than for other packages. The
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
24 orig.tar.gz file of the debian source package contains one .tar.bz2
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
25 file for every language. Those .tar.bz files are the kde-18n-<lang>
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
26 files released by the KDE project. For now, we only have the German
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
27 localization in the enterprise source package, so the orig.tar.gz
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
28 file will have the following contents:
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
29
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
30 kde-l10n-<version>/
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
31 kde-l10n-<version>/kde-l10n-de-<version>.tar.bz2
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
32
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
33 <version> is the same everywhere.
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
34 """
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
35
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
36 createtarball_script = """\
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
37 #! /bin/bash
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
38 set -e
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
39
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
40 apt-get --assume-yes --force-yes install %(builddeps)s
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
41
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
42 # copy the source tree to a directory that's under pbuilder control so
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
43 # that it gets removed along with the build environment. Otherwise we
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
44 # end up with a directory containing files that cannot be removed by
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
45 # treepkg
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
46 workdir=/tmp/work
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
47 cp -a %(basedir)s $workdir
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
48 cd $workdir
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
49
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
50 # only handle the de subdirectory
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
51 echo de > subdirs
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
52
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
53 # create the CMakeFiles
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
54 ./scripts/autogen.sh
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
55 mv de kde-l10n-de-%(version)s
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
56 tar cjf %(tarball)s kde-l10n-de-%(version)s
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
57 """
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
58
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
59
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
60 def __init__(self, *args, **kw):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
61 super(SourcePackager, self).__init__(*args, **kw)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
62 self.enterprise_version = (time.strftime("%Y%m%d", time.localtime())
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
63 + "." + str(self.revision))
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
64
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
65 def determine_package_version(self, directory):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
66 enterprise_version = self.enterprise_version
381
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
67 revision = self.revision
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
68 rules_revision = self.parent.rules_revision
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
69 pkg_revision = self.parent.pkg_revision
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
70 pkg_date = self.parent.pkg_date
51c447a6792e merged maemo packager into enterprise packager
Bjoern Ricks <bricks@intevation.de>
parents: 371
diff changeset
71
316
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
72 return self.track.version_template % locals()
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
73
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
74 def create_l10n_de_tarball(self, pkgbasedir, pkgbaseversion):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
75 logging.info("Creating kde-l10n-de tarball")
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
76 de_tarball = os.path.join(self.work_dir,
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
77 "kde-l10n-de-" + pkgbaseversion + ".tar.bz2")
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
78 # xutils-dev is needed for the revpath script used by
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
79 # scripts/autogen.sh
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
80 script = (self.createtarball_script
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
81 % dict(builddeps="xutils-dev", tarball=de_tarball,
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
82 basedir=pkgbasedir, version=pkgbaseversion))
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
83 script_name = os.path.join(self.work_dir, "createtarball")
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
84 treepkg.util.writefile(script_name, script, 0755)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
85 treepkg.util.ensure_directory(self.src_dir)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
86 treepkg.util.ensure_directory(self.log_dir)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
87 self.track.builder.run_script([script_name],
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
88 logfile=os.path.join(self.log_dir,
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
89 "tarball_log.txt"),
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
90 bindmounts=[self.work_dir])
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
91 return de_tarball
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
92
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
93 def prepare_sources_for_tarball(self, pkgbasedir, pkgbaseversion):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
94 de_tarball = self.create_l10n_de_tarball(pkgbasedir, pkgbaseversion)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
95 shutil.rmtree(pkgbasedir)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
96 os.mkdir(pkgbasedir)
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
97 os.rename(de_tarball,
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
98 os.path.join(pkgbasedir, os.path.basename(de_tarball)))
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
99
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
100
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
101 class RevisionPackager(generic.RevisionPackager):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
102
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
103 source_packager_cls = SourcePackager
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
104
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
105
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
106 class PackageTrack(generic.PackageTrack):
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
107
ff24648050cf Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff changeset
108 revision_packager_cls = RevisionPackager
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)