Mercurial > treepkg
annotate recipes/kde/enterprise/kde_l10n.py @ 557:9824e409388b
Refactor git branching
If a checkout is already available and the branch is changed in
the config git command would always fail because it doesn't know
the branch to track. Therefore always check if the branch is
locally available and if not checkout the remote branch
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Fri, 02 Sep 2011 08:45:28 +0000 |
parents | e44c9c3f69f8 |
children |
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 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
63 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
|
64 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
|
65 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
|
66 "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
|
67 # 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
|
68 # scripts/autogen.sh |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
69 script = (self.createtarball_script |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
70 % 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
|
71 basedir=pkgbasedir, version=pkgbaseversion)) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
72 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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 "tarball_log.txt"), |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
79 bindmounts=[self.work_dir]) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
80 return de_tarball |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
81 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
82 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
|
83 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
|
84 shutil.rmtree(pkgbasedir) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
85 os.mkdir(pkgbasedir) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
86 os.rename(de_tarball, |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
87 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
|
88 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
89 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
90 class RevisionPackager(generic.RevisionPackager): |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
91 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
92 source_packager_cls = SourcePackager |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
93 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
94 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
95 class PackageTrack(generic.PackageTrack): |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
96 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
97 revision_packager_cls = RevisionPackager |