bh@316: # Copyright (C) 2007, 2008, 2009 by Intevation GmbH
bh@316: # Authors:
bh@316: # Bernhard Herzog <bh@intevation.de>
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: """Build kdepim debian packages from the kdepim/enterprise4 branch.
bh@316: """
bh@316: 
bh@316: import os
bh@316: 
bh@316: import treepkg.util
bh@316: 
bh@316: import recipes.kde.enterprise.generic as generic
bh@316: 
bh@316: 
bh@317: class SourcePackager(generic.SourcePackager):
bh@316: 
bh@316:     def update_version_numbers(self, pkgbasedir):
bh@316:         """Overrides the inherited method to update version numbers in the code
bh@316:         """
bh@316:         versionstring = "(enterprise4 %s)" % self.enterprise_version
bh@316:         failed = []
bh@316:         for versionfile in ["kaddressbook/kabcore.cpp",
bh@316:                             "kmail/kmversion.h",
bh@316:                             "kontact/src/main.cpp",
bh@316:                             "korganizer/version.h"]:
bh@316:             if not treepkg.util.replace_in_file(os.path.join(pkgbasedir,
bh@316:                                                              versionfile),
bh@316:                                                 "\(enterprise4 ([^)]*)\)",
bh@316:                                                 versionstring):
bh@316:                 failed.append(versionfile)
bh@316:         if failed:
bh@316:             raise RuntimeError("kdepim: failed to update version numbers in %s"
bh@316:                                % (", ".join(failed),))
bh@316: 
bh@316: 
bh@316: class RevisionPackager(generic.RevisionPackager):
bh@316: 
bh@316:     source_packager_cls = SourcePackager
bh@316: 
bh@316: 
bh@316: class PackageTrack(generic.PackageTrack):
bh@316: 
bh@316:     revision_packager_cls = RevisionPackager