comparison recipes/kde/enterprise/branch_4/kde_l10n.py @ 316:ff24648050cf

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