1 '''A concrete apport.PackageInfo class implementation for PLD.
3 Copyright (C) 2007 PLD Linux team
4 Author: Patryk Zawadzki <patrys@pld-linux.org>
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 2 of the License, or (at your
9 option) any later version. See http://www.gnu.org/copyleft/gpl.html for
10 the full text of the license.
13 from packaging_rpm import RPMPackageInfo
14 from rpmUtils.miscutils import compareEVR, stringToVersion
16 class __PLDPackageInfo(RPMPackageInfo):
17 '''Concrete apport.PackageInfo class implementation for PLD Linux.'''
19 # A list of ids of official keys used by the project
20 official_keylist = ('e64e7bf7')
22 def is_distro_package(self, package):
23 '''Check if a package is a genuine distro package (True) or comes from
24 a third-party source.'''
25 if RPMPackageInfo.is_distro_package(self,package):
28 # GPG key check failed.
29 hdr = RPMPackageInfo._get_header(self,package)
31 if hdr['vendor'] == "PLD" and \
32 hdr['distribution'].startswith("PLD"):
36 def get_available_version(self, package):
37 '''Return the latest available version of a package.'''
38 # used in report.py, which is used by the frontends
39 (epoch, name, ver, rel, arch) = self._split_envra(package)
40 package_ver = '%s-%s' % (ver,rel)
42 package_ver = "%s:%s" % (epoch, package_ver)
46 def get_source_tree(self, srcpackage, dir, version=None):
47 '''Download given source package and unpack it into dir (which should
50 This also has to care about applying patches etc., so that dir will
51 eventually contain the actually compiled source.
53 If version is given, this particular version will be retrieved.
54 Otherwise this will fetch the latest available version.
56 Return the directory that contains the actual source root directory
57 (which might be a subdirectory of dir). Return None if the source is
59 # Used only by apport-retrace.
63 def compare_versions(self, ver1, ver2):
64 '''Compare two package versions.
66 Return -1 for ver < ver2, 0 for ver1 == ver2, and 1 for ver1 > ver2.'''
67 # Used by crashdb.py (i.e. the frontends)
68 return compareEVR(stringToVersion(ver1),stringToVersion(ver2))
70 impl = __PLDPackageInfo()