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