comparison enterprise/kdei18n.py @ 5:5ea8e9b67395

Add a packager for the enterprise branch localizations
author Bernhard Herzog <bh@intevation.de>
date Fri, 09 Mar 2007 12:28:59 +0100
parents
children 574506a022f6
comparison
equal deleted inserted replaced
4:fee641fec94e 5:5ea8e9b67395
1 # Copyright (C) 2007 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.packager
14 import treepkg.util
15 import treepkg.run as run
16
17
18 class SourcePackager(treepkg.packager.SourcePackager):
19
20 """Creates the debian source package for the i18n files
21
22 This is quite complicated. The orig.tar.gz file of the debian
23 source package contains one .tar.bz2 file for every language. Those
24 .tar.bz files are the kde-18n-<lang> files released by the KDE
25 project. For now, we only have the German localization in the
26 enterprise source package, so the orig.tar.gz file will have the
27 following contents:
28
29 kde-i18n-<version>/
30 kde-i18n-<version>/kde-i18n-de-<version>.tar.bz2
31
32 <version> is the same everywhere.
33
34 The kde-i18n-de tarball contains the localization files for the
35 entire KDE project, including KDE-PIM. The SVN enterprise branch
36 only contains the localizations for KDE-PIM, though, so we have to
37 assemble a new .tar.bz2 from an original
38 kde-i18n-de-<version>.tar.bz and the new files from the enterprise
39 branch.
40 """
41
42 pkg_basename = "kde-i18n"
43
44 def determine_package_version(self, directory):
45 enterprise_version = (time.strftime("%Y%m%d", time.localtime()) \
46 + "." + str(self.revision))
47 kdepimversion = "3.5.5"
48 version_template = "%(kdepimversion)s.enterprise.0.%(enterprise_version)s"
49 return version_template % locals()
50
51 def unpack_orig_tarball(self):
52 orig_tarball = self.plant.orig_tarball
53 run.call(["tar", "xjf", orig_tarball, "-C", self.work_dir])
54 tarbasename = os.path.basename(orig_tarball)
55 splitext = os.path.splitext
56 return os.path.join(self.work_dir,
57 splitext(splitext(tarbasename)[0])[0])
58
59 def create_i18n_de_tarball(self, pkgbasedir, pkgbaseversion):
60 """Creates a new kde-i18n-de tarball and returns its filename
61
62 This is the tarball as it would be released by KDE. It is not
63 yet the tarball that will become the .orig.tar.gz for the debian
64 package.
65 """
66 logging.info("Creating kde-i18n-de tarball")
67 untarred_dir = self.unpack_orig_tarball()
68 new_de_dir = os.path.join(pkgbasedir, "new-de")
69 de_dir = os.path.join(pkgbasedir, "de")
70 os.rename(de_dir, new_de_dir)
71 treepkg.util.copytree(untarred_dir, de_dir)
72 treepkg.util.copytree(new_de_dir, de_dir)
73 logging.info("Running scripts/autogen.sh for kde-i18n-de tarball")
74 run.call(["/bin/sh", "scripts/autogen.sh", "de"], cwd=pkgbasedir,
75 suppress_output=True)
76
77 tarballdir = "kde-i18n-de-" + pkgbaseversion
78 os.rename(de_dir, os.path.join(pkgbasedir, tarballdir))
79
80 tarball = os.path.join(os.path.dirname(pkgbasedir),
81 tarballdir + ".tar.bz2")
82 run.call(["tar", "cjf", tarball, "-C", pkgbasedir, tarballdir])
83 logging.info("Created kde-i18n-de tarball")
84 return tarball
85
86 def do_package(self):
87 pkgbaseversion, pkgbasedir = self.export_sources()
88 tarball = self.create_i18n_de_tarball(pkgbasedir, pkgbaseversion)
89
90 shutil.rmtree(pkgbasedir)
91 os.mkdir(pkgbasedir)
92
93 pkgbasename = self.pkg_basename + "_" + pkgbaseversion
94 origtargz = os.path.join(self.work_dir,
95 pkgbasename + ".orig.tar.gz")
96 os.rename(tarball, os.path.join(pkgbasedir,
97 os.path.basename(tarball)))
98 self.create_tarball(origtargz, self.work_dir,
99 os.path.basename(pkgbasedir))
100
101 changemsg = ("Update to SVN enterprise branch rev. %d"
102 % (self.revision,))
103 self.copy_debian_directory(pkgbasedir, pkgbaseversion,
104 changemsg)
105
106 self.create_source_package(pkgbasedir, origtargz)
107 self.move_source_package(pkgbasename)
108
109
110 class RevisionPackager(treepkg.packager.RevisionPackager):
111
112 source_packager_cls = SourcePackager
113
114
115 class AssemblyLine(treepkg.packager.AssemblyLine):
116
117 revision_packager_cls = RevisionPackager
118
119 svn_external_subdirs = ["scripts", "scripts/admin"]
120
121 extra_config_desc = ["orig_tarball"]
122
123 def __init__(self, *args, **kw):
124 self.orig_tarball = kw.pop("orig_tarball")
125 super(AssemblyLine, self).__init__(*args, **kw)
126
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)