]> git.pld-linux.org Git - packages/apport.git/blob - apport-backend-pld.py
- release 2 (fix qt dep)
[packages/apport.git] / apport-backend-pld.py
1 '''A concrete apport.PackageInfo class implementation for PLD.
2
3 Copyright (C) 2007 PLD Linux team
4 Author: Patryk Zawadzki <patrys@pld-linux.org>
5
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.
11 '''
12
13 from packaging_rpm import RPMPackageInfo
14 from rpmUtils.miscutils import compareEVR, stringToVersion
15
16 class __PLDPackageInfo(RPMPackageInfo):
17     '''Concrete apport.PackageInfo class implementation for PLD Linux.'''
18
19     # A list of ids of official keys used by the project
20     official_keylist = ('e64e7bf7')
21
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):
26             return True
27         else:
28             # GPG key check failed.
29             hdr = RPMPackageInfo._get_header(self,package)
30
31             if hdr['vendor'] == "PLD" and \
32                hdr['distribution'].startswith("PLD"):
33                 return True
34         return False
35
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)
41         if epoch: 
42             package_ver = "%s:%s" % (epoch, package_ver)
43         # FIXME STUB
44         return package_ver
45
46     def get_source_tree(self, srcpackage, dir, version=None):
47         '''Download given source package and unpack it into dir (which should
48         be empty).
49
50         This also has to care about applying patches etc., so that dir will
51         eventually contain the actually compiled source.
52
53         If version is given, this particular version will be retrieved.
54         Otherwise this will fetch the latest available version.
55
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
58         not available.'''
59         # Used only by apport-retrace.
60         # FIXME STUB
61         return None
62
63     def compare_versions(self, ver1, ver2):
64         '''Compare two package versions.
65
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)) 
69
70 impl = __PLDPackageInfo()
This page took 0.063545 seconds and 3 git commands to generate.