bricks@381: # Copyright (C) 2007 - 2010 by Intevation GmbH bh@316: # Authors: bh@316: # Bernhard Herzog bricks@381: # Bjoern Ricks bh@316: # bh@316: # This program is free software under the GPL (>=v2) bh@316: # Read the file COPYING coming with the software for details. bh@316: bh@316: import os bh@316: import logging bh@316: import shutil bh@316: import time bh@316: bh@316: import treepkg.util bh@316: bricks@371: import recipes.kde.enterprise.tags as tags bricks@500: import recipes.kde.enterprise.generic as enterprise bh@316: bricks@500: class SourcePackager(enterprise.SourcePackager): bh@316: bh@316: """Creates the debian source package for the l10n files bh@316: bh@316: This is a bit more complicated than for other packages. The bh@316: orig.tar.gz file of the debian source package contains one .tar.bz2 bh@316: file for every language. Those .tar.bz files are the kde-18n- bh@316: files released by the KDE project. For now, we only have the German bh@316: localization in the enterprise source package, so the orig.tar.gz bh@316: file will have the following contents: bh@316: bh@316: kde-l10n-/ bh@316: kde-l10n-/kde-l10n-de-.tar.bz2 bh@316: bh@316: is the same everywhere. bh@316: """ bh@316: bh@316: createtarball_script = """\ bh@316: #! /bin/bash bh@316: set -e bh@316: bh@316: apt-get --assume-yes --force-yes install %(builddeps)s bh@316: bh@316: # copy the source tree to a directory that's under pbuilder control so bh@316: # that it gets removed along with the build environment. Otherwise we bh@316: # end up with a directory containing files that cannot be removed by bh@316: # treepkg bricks@381: workdir=/tmp/work-tags bh@316: cp -a %(basedir)s $workdir bh@316: cd $workdir bh@316: bh@316: # only handle the de subdirectory bh@316: echo de > subdirs bh@316: bh@316: # create the CMakeFiles bh@316: ./scripts/autogen.sh bh@316: mv de kde-l10n-de-%(version)s bh@316: tar cjf %(tarball)s kde-l10n-de-%(version)s bh@316: """ bh@316: bh@316: bh@316: def __init__(self, *args, **kw): bh@316: super(SourcePackager, self).__init__(*args, **kw) bh@316: bh@316: def create_l10n_de_tarball(self, pkgbasedir, pkgbaseversion): bh@316: logging.info("Creating kde-l10n-de tarball") bh@316: de_tarball = os.path.join(self.work_dir, bh@316: "kde-l10n-de-" + pkgbaseversion + ".tar.bz2") bh@316: # xutils-dev is needed for the revpath script used by bh@316: # scripts/autogen.sh bh@316: script = (self.createtarball_script bh@316: % dict(builddeps="xutils-dev", tarball=de_tarball, bh@316: basedir=pkgbasedir, version=pkgbaseversion)) bh@316: script_name = os.path.join(self.work_dir, "createtarball") bh@316: treepkg.util.writefile(script_name, script, 0755) bh@316: treepkg.util.ensure_directory(self.src_dir) bh@316: treepkg.util.ensure_directory(self.log_dir) bh@316: self.track.builder.run_script([script_name], bh@316: logfile=os.path.join(self.log_dir, bh@316: "tarball_log.txt"), bh@316: bindmounts=[self.work_dir]) bh@316: return de_tarball bh@316: bh@316: def prepare_sources_for_tarball(self, pkgbasedir, pkgbaseversion): bh@316: de_tarball = self.create_l10n_de_tarball(pkgbasedir, pkgbaseversion) bh@316: shutil.rmtree(pkgbasedir) bh@316: os.mkdir(pkgbasedir) bh@316: os.rename(de_tarball, bh@316: os.path.join(pkgbasedir, os.path.basename(de_tarball))) bh@316: bh@316: bricks@500: class RevisionPackager(enterprise.RevisionPackager): bh@316: bh@316: source_packager_cls = SourcePackager bh@316: bh@316: bricks@371: class PackageTrack(tags.PackageTrack): bh@316: bh@316: revision_packager_cls = RevisionPackager