bh@315: # Copyright (C) 2007, 2008, 2009 by Intevation GmbH bh@315: # Authors: bh@315: # Bernhard Herzog bh@315: # bh@315: # This program is free software under the GPL (>=v2) bh@315: # Read the file COPYING coming with the software for details. bh@315: bh@315: """Packager that builds KDE-PIM debian packages from the enterprise35 branch. bh@315: """ bh@315: bh@315: import os bh@315: import time bh@315: import re bh@315: bh@315: import treepkg.util bh@315: import treepkg.packager bh@315: bh@315: import recipes.kde.enterprise.generic as generic bh@315: bh@315: bh@315: class SourcePackager(generic.SourcePackager): bh@315: bh@315: def kdepim_version(self, directory): bh@315: """Determine the kdepim version. bh@315: bh@315: The version is taken from the kdepim.lsm file. bh@315: """ bh@315: return treepkg.util.extract_lsm_version(os.path.join(directory, bh@315: "kdepim.lsm")) bh@315: bh@315: def determine_package_version(self, directory): bh@315: enterprise_version = self.enterprise_version bh@315: kdepimversion = self.kdepim_version(directory) bh@315: version_template = \ bh@315: "%(kdepimversion)s.enterprise.0.%(enterprise_version)s" bh@315: return version_template % locals() bh@315: bh@315: def update_version_numbers(self, pkgbasedir): bh@315: """Overrides the inherited method to update version numbers in the code bh@315: """ bh@315: versionstring = "(enterprise35 %s)" % self.enterprise_version bh@315: failed = [] bh@315: for versionfile in ["kmail/kmversion.h", "kontact/src/main.cpp", bh@315: "korganizer/version.h"]: bh@315: if not treepkg.util.replace_in_file(os.path.join(pkgbasedir, bh@315: versionfile), bh@315: "\(enterprise35 ([^)]*)\)", bh@315: versionstring): bh@315: failed.append(versionfile) bh@315: if failed: bh@315: raise RuntimeError("kdepim: failed to update version numbers in %s" bh@315: % (", ".join(failed),)) bh@315: bh@315: bh@315: class RevisionPackager(generic.RevisionPackager): bh@315: bh@315: source_packager_cls = SourcePackager bh@315: bh@315: bh@315: class PackageTrack(generic.PackageTrack): bh@315: bh@315: revision_packager_cls = RevisionPackager