Mercurial > treepkg
annotate recipes/kde/enterprise/branch_4/kde_l10n.py @ 519:0365b2c7ac00
don't checkout master branch by default for local branch. local would point to the local master and not to origin/master.
add sanity check before git clone
author | Bjoern Ricks <bricks@intevation.de> |
---|---|
date | Wed, 10 Nov 2010 14:53:40 +0000 |
parents | ff24648050cf |
children |
rev | line source |
---|---|
316
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
1 # Copyright (C) 2007, 2008, 2009 by Intevation GmbH |
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> |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
4 # |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
5 # 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
|
6 # 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
|
7 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
8 import os |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
9 import logging |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
10 import shutil |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
11 import time |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
12 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
13 import treepkg.util |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
14 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
15 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
|
16 |
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 class SourcePackager(generic.SourcePackager): |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
19 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
20 """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
|
21 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 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
|
26 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
|
27 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
|
28 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
29 kde-l10n-<version>/ |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
30 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
|
31 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
32 <version> is the same everywhere. |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
33 """ |
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 createtarball_script = """\ |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
36 #! /bin/bash |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
37 set -e |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
38 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
39 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
|
40 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
41 # 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
|
42 # 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
|
43 # 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
|
44 # treepkg |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
45 workdir=/tmp/work |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
46 cp -a %(basedir)s $workdir |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
47 cd $workdir |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
48 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
49 # only handle the de subdirectory |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
50 echo de > subdirs |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
51 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
52 # create the CMakeFiles |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
53 ./scripts/autogen.sh |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
54 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
|
55 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
|
56 """ |
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 def __init__(self, *args, **kw): |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
60 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
|
61 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
|
62 + "." + str(self.revision)) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
63 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
64 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
|
65 enterprise_version = self.enterprise_version |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
66 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
|
67 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
68 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
|
69 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
|
70 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
|
71 "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
|
72 # 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
|
73 # scripts/autogen.sh |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
74 script = (self.createtarball_script |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
75 % 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
|
76 basedir=pkgbasedir, version=pkgbaseversion)) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
77 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
|
78 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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 "tarball_log.txt"), |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
84 bindmounts=[self.work_dir]) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
85 return de_tarball |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
86 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
87 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
|
88 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
|
89 shutil.rmtree(pkgbasedir) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
90 os.mkdir(pkgbasedir) |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
91 os.rename(de_tarball, |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
92 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
|
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 RevisionPackager(generic.RevisionPackager): |
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 source_packager_cls = SourcePackager |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
98 |
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 class PackageTrack(generic.PackageTrack): |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
101 |
ff24648050cf
Copy the enterprise 4 packagers to the refactored kde enterprise
Bernhard Herzog <bh@intevation.de>
parents:
diff
changeset
|
102 revision_packager_cls = RevisionPackager |