~ubuntu-branches/ubuntu/utopic/dogtail/utopic

« back to all changes in this revision

Viewing changes to dogtail/distro.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2006-12-21 13:33:47 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 5.
  • Revision ID: james.westby@ubuntu.com-20061221133347-xo9jg11afp5plcka
Tags: upstream-0.6.1
ImportĀ upstreamĀ versionĀ 0.6.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
__author__ = "Dave Malcolm <dmalcolm@redhat.com>, Zack Cerza <zcerza@redhat.com>"
5
5
 
6
6
import os
 
7
import re
7
8
from version import Version
8
 
 
 
9
from logging import debugLogger as logger
9
10
 
10
11
class DistributionNotSupportedError(Exception):
11
 
        """
12
 
        This distribution is not supported.
13
 
 
14
 
        Arguments:
15
 
                distro: the distribution that is not supported.
16
 
        """
17
 
        PATCH_MESSAGE = "Please send patches to dogtail-devel-list@gnome.org"
18
 
 
19
 
        def __init__(self, distro):
20
 
                self.distro = distro
21
 
 
22
 
        def __str__(self):
23
 
                return self.distro + ". " + DistributionNotSupportedError.PATCH_MESSAGE
 
12
    """
 
13
    This distribution is not supported.
 
14
 
 
15
    Arguments:
 
16
            distro: the distribution that is not supported.
 
17
    """
 
18
    PATCH_MESSAGE = "Please send patches to dogtail-devel-list@gnome.org"
 
19
 
 
20
    def __init__(self, distro):
 
21
        self.distro = distro
 
22
 
 
23
    def __str__(self):
 
24
        return self.distro + ". " + DistributionNotSupportedError.PATCH_MESSAGE
24
25
 
25
26
class PackageNotFoundError(Exception):
26
 
        """
27
 
        Error finding the requested package.
28
 
        """
29
 
        pass
 
27
    """
 
28
    Error finding the requested package.
 
29
    """
 
30
    pass
30
31
 
31
32
global packageDb
32
33
global distro
33
34
 
34
35
class PackageDb:
35
 
        """
36
 
        Class to abstract the details of whatever software package database is in use (RPM, APT, etc)
37
 
        """
38
 
        def __init__(self):
39
 
                self.prefix = '/usr'
40
 
                self.localePrefixes = [self.prefix + '/share/locale']
41
 
 
42
 
        def getVersion(self, packageName):
43
 
                """
44
 
                Method to get the version of an installed package as a Version instance (or raise an exception if not found)
45
 
                Note: does not know about distributions' internal revision numbers.
46
 
                """
47
 
                raise NotImplementedError
48
 
 
49
 
        def getFiles(self, packageName):
50
 
                """
51
 
                Method to get a list of filenames owned by the package, or raise an exception if not found.
52
 
                """
53
 
                raise NotImplementedError
54
 
 
55
 
        def getMoFiles(self, locale = None):
56
 
                """
57
 
                Method to get a list of all .mo files on the system, optionally for a specific locale.
58
 
                """
59
 
                moFiles = {}
60
 
 
61
 
                def appendIfMoFile(moFiles, dirName, fNames):
62
 
                        import re
63
 
                        for fName in fNames:
64
 
                                if re.match('(.*)\\.mo', fName):
65
 
                                        moFiles[dirName + '/' + fName] = None
66
 
                
67
 
                for localePrefix in self.localePrefixes:
68
 
                        if locale: localePrefix = localePrefix + '/' + locale
69
 
                        os.path.walk(localePrefix, appendIfMoFile, moFiles)
70
 
 
71
 
                return moFiles.keys()
72
 
 
73
 
        def getDependencies(self, packageName):
74
 
                """
75
 
                Method to get a list of unique package names that this package 
76
 
                is dependent on, or raise an exception if the package is not 
77
 
                found.
78
 
                """
79
 
                raise NotImplementedError
 
36
    """
 
37
    Class to abstract the details of whatever software package database is in use (RPM, APT, etc)
 
38
    """
 
39
    def __init__(self):
 
40
        self.prefix = '/usr'
 
41
        self.localePrefixes = [self.prefix + '/share/locale']
 
42
 
 
43
    def getVersion(self, packageName):
 
44
        """
 
45
        Method to get the version of an installed package as a Version instance (or raise an exception if not found)
 
46
        Note: does not know about distributions' internal revision numbers.
 
47
        """
 
48
        raise NotImplementedError
 
49
 
 
50
    def getFiles(self, packageName):
 
51
        """
 
52
        Method to get a list of filenames owned by the package, or raise an exception if not found.
 
53
        """
 
54
        raise NotImplementedError
 
55
 
 
56
    def getMoFiles(self, locale = None):
 
57
        """
 
58
        Method to get a list of all .mo files on the system, optionally for a specific locale.
 
59
        """
 
60
        moFiles = {}
 
61
 
 
62
        def appendIfMoFile(moFiles, dirName, fNames):
 
63
            import re
 
64
            for fName in fNames:
 
65
                if re.match('(.*)\\.mo', fName):
 
66
                    moFiles[dirName + '/' + fName] = None
 
67
 
 
68
        for localePrefix in self.localePrefixes:
 
69
            if locale: localePrefix = localePrefix + '/' + locale
 
70
            os.path.walk(localePrefix, appendIfMoFile, moFiles)
 
71
 
 
72
        return moFiles.keys()
 
73
 
 
74
    def getDependencies(self, packageName):
 
75
        """
 
76
        Method to get a list of unique package names that this package
 
77
        is dependent on, or raise an exception if the package is not
 
78
        found.
 
79
        """
 
80
        raise NotImplementedError
80
81
 
81
82
class _RpmPackageDb(PackageDb):
82
 
        def __init__(self):
83
 
                PackageDb.__init__(self)
84
 
 
85
 
        def getVersion(self, packageName):
86
 
                import rpm
87
 
                ts = rpm.TransactionSet()
88
 
                for header in ts.dbMatch("name", packageName):
89
 
                        return Version.fromString(header["version"])
90
 
                raise PackageNotFoundError, packageName
91
 
 
92
 
        def getFiles(self, packageName):
93
 
                import rpm
94
 
                ts = rpm.TransactionSet()
95
 
                for header in ts.dbMatch("name", packageName):
96
 
                        return header["filenames"]
97
 
                raise PackageNotFoundError, packageName
98
 
 
99
 
        def getDependencies(self, packageName):
100
 
                import rpm
101
 
                ts = rpm.TransactionSet()
102
 
                for header in ts.dbMatch("name", packageName):
103
 
                        # Simulate a set using a hash (to a dummy value);
104
 
                        # sets were only added in Python 2.4
105
 
                        result = {}
106
 
 
107
 
                        # Get the list of requirements; these are 
108
 
                        # sometimes package names, but can also be
109
 
                        # so-names of libraries, and invented virtual 
110
 
                        # ids
111
 
                        for requirement in header[rpm.RPMTAG_REQUIRES]:
112
 
                                # Get the name of the package providing
113
 
                                # this requirement:
114
 
                                for depPackageHeader in ts.dbMatch("provides", requirement):
115
 
                                        depName = depPackageHeader['name']
116
 
                                        if depName!=packageName:
117
 
                                                # Add to the Hash with a dummy value
118
 
                                                result[depName]=None
119
 
                        return result.keys()
120
 
                raise PackageNotFoundError, packageName
 
83
    def __init__(self):
 
84
        PackageDb.__init__(self)
 
85
 
 
86
    def getVersion(self, packageName):
 
87
        import rpm
 
88
        ts = rpm.TransactionSet()
 
89
        for header in ts.dbMatch("name", packageName):
 
90
            return Version.fromString(header["version"])
 
91
        raise PackageNotFoundError, packageName
 
92
 
 
93
    def getFiles(self, packageName):
 
94
        import rpm
 
95
        ts = rpm.TransactionSet()
 
96
        for header in ts.dbMatch("name", packageName):
 
97
            return header["filenames"]
 
98
        raise PackageNotFoundError, packageName
 
99
 
 
100
    def getDependencies(self, packageName):
 
101
        import rpm
 
102
        ts = rpm.TransactionSet()
 
103
        for header in ts.dbMatch("name", packageName):
 
104
            # Simulate a set using a hash (to a dummy value);
 
105
            # sets were only added in Python 2.4
 
106
            result = {}
 
107
 
 
108
            # Get the list of requirements; these are
 
109
            # sometimes package names, but can also be
 
110
            # so-names of libraries, and invented virtual
 
111
            # ids
 
112
            for requirement in header[rpm.RPMTAG_REQUIRES]:
 
113
                # Get the name of the package providing
 
114
                # this requirement:
 
115
                for depPackageHeader in ts.dbMatch("provides", requirement):
 
116
                    depName = depPackageHeader['name']
 
117
                    if depName!=packageName:
 
118
                        # Add to the Hash with a dummy value
 
119
                        result[depName]=None
 
120
            return result.keys()
 
121
        raise PackageNotFoundError, packageName
121
122
 
122
123
class _AptPackageDb(PackageDb):
123
 
        def __init__(self):
124
 
                PackageDb.__init__(self)
125
 
                self.cache = None
126
 
        
127
 
        def getVersion(self, packageName):
128
 
                if not self.cache:
129
 
                        import apt_pkg
130
 
                        apt_pkg.init()
131
 
                        self.cache = apt_pkg.GetCache()
132
 
                packages = self.cache.Packages
133
 
                for package in packages:
134
 
                        if package.Name == packageName:
135
 
                                import re
136
 
                                verString = re.match('.*Ver:\'(.*)-.*\' Section:', str(package.CurrentVer)).group(1)
137
 
                                return Version.fromString(verString)
138
 
                raise PackageNotFoundError, packageName
139
 
 
140
 
        def getFiles(self, packageName):
141
 
                files = []
142
 
                list = os.popen('dpkg -L %s' % packageName).readlines()
143
 
                if not list:
144
 
                        raise PackageNotFoundError, packageName
145
 
                else:
146
 
                        for line in list:
147
 
                                file = line.strip()
148
 
                                if file: files.append(file)
149
 
                        return files
150
 
        
151
 
        def getDependencies(self, packageName):
152
 
                # Simulate a set using a hash (to a dummy value);
153
 
                # sets were only added in Python 2.4
154
 
                result = {}
155
 
                if not self.cache:
156
 
                        import apt_pkg
157
 
                        apt_pkg.init()
158
 
                        self.cache = apt_pkg.GetCache()
159
 
                packages = self.cache.Packages
160
 
                for package in packages:
161
 
                        if package.Name == packageName:
162
 
                                current = package.CurrentVer
163
 
                                if not current:
164
 
                                        raise PackageNotFoundError, packageName
165
 
                                depends = current.DependsList
166
 
                                list = depends['Depends']
167
 
                                for dependency in list:
168
 
                                        name = dependency[0].TargetPkg.Name
169
 
                                        # Add to the hash using a dummy value
170
 
                                        result[name] = None
171
 
                return result.keys()
 
124
    def __init__(self):
 
125
        PackageDb.__init__(self)
 
126
        self.cache = None
 
127
 
 
128
    def getVersion(self, packageName):
 
129
        if not self.cache:
 
130
            import apt_pkg
 
131
            apt_pkg.init()
 
132
            self.cache = apt_pkg.GetCache()
 
133
        packages = self.cache.Packages
 
134
        for package in packages:
 
135
            if package.Name == packageName:
 
136
                import re
 
137
                verString = re.match('.*Ver:\'(.*)-.*\' Section:', str(package.CurrentVer)).group(1)
 
138
                return Version.fromString(verString)
 
139
        raise PackageNotFoundError, packageName
 
140
 
 
141
    def getFiles(self, packageName):
 
142
        files = []
 
143
        list = os.popen('dpkg -L %s' % packageName).readlines()
 
144
        if not list:
 
145
            raise PackageNotFoundError, packageName
 
146
        else:
 
147
            for line in list:
 
148
                file = line.strip()
 
149
                if file: files.append(file)
 
150
            return files
 
151
 
 
152
    def getDependencies(self, packageName):
 
153
        # Simulate a set using a hash (to a dummy value);
 
154
        # sets were only added in Python 2.4
 
155
        result = {}
 
156
        if not self.cache:
 
157
            import apt_pkg
 
158
            apt_pkg.init()
 
159
            self.cache = apt_pkg.GetCache()
 
160
        packages = self.cache.Packages
 
161
        for package in packages:
 
162
            if package.Name == packageName:
 
163
                current = package.CurrentVer
 
164
                if not current:
 
165
                    raise PackageNotFoundError, packageName
 
166
                depends = current.DependsList
 
167
                list = depends['Depends']
 
168
                for dependency in list:
 
169
                    name = dependency[0].TargetPkg.Name
 
170
                    # Add to the hash using a dummy value
 
171
                    result[name] = None
 
172
        return result.keys()
172
173
 
173
174
class _UbuntuAptPackageDb(_AptPackageDb):
174
 
        def __init__(self):
175
 
                _AptPackageDb.__init__(self)
176
 
                self.localePrefixes.append(self.prefix + '/share/locale-langpack')
 
175
    def __init__(self):
 
176
        _AptPackageDb.__init__(self)
 
177
        self.localePrefixes.append(self.prefix + '/share/locale-langpack')
177
178
 
178
179
class _PortagePackageDb(PackageDb):
179
 
        def __init__(self):
180
 
                PackageDb.__init__(self)
 
180
    def __init__(self):
 
181
        PackageDb.__init__(self)
181
182
 
182
 
        def getVersion(self, packageName):
183
 
                # the portage utilities are almost always going to be in /usr/lib/portage/pym
184
 
                import sys
185
 
                sys.path.append ('/usr/lib/portage/pym')
186
 
                import portage
187
 
                # FIXME: this takes the first package returned in the list, in the case that there are
188
 
                # slotted packages, and removes the leading category such as 'sys-apps'
189
 
                gentooPackageName = portage.db["/"]["vartree"].dbapi.match(packageName)[0].split('/')[1];
190
 
                # this removes the distribution specific versioning returning only the upstream version
191
 
                upstreamVersion = portage.pkgsplit(gentooPackageName)[1]
192
 
                #print "Version of package is: " + upstreamVersion
193
 
                return Version.fromString(upstreamVersion);
 
183
    def getVersion(self, packageName):
 
184
        # the portage utilities are almost always going to be in /usr/lib/portage/pym
 
185
        import sys
 
186
        sys.path.append ('/usr/lib/portage/pym')
 
187
        import portage
 
188
        # FIXME: this takes the first package returned in the list, in the case that there are
 
189
        # slotted packages, and removes the leading category such as 'sys-apps'
 
190
        gentooPackageName = portage.db["/"]["vartree"].dbapi.match(packageName)[0].split('/')[1];
 
191
        # this removes the distribution specific versioning returning only the upstream version
 
192
        upstreamVersion = portage.pkgsplit(gentooPackageName)[1]
 
193
        #print "Version of package is: " + upstreamVersion
 
194
        return Version.fromString(upstreamVersion);
194
195
 
195
196
class _ConaryPackageDb(PackageDb):
196
 
        def __init__(self):
197
 
                PackageDb.__init__(self)
198
 
 
199
 
        def getVersion(self, packageName):
200
 
                import conary
201
 
                from conaryclient import ConaryClient
202
 
                client = ConaryClient()
203
 
                dbVersions = client.db.getTroveVersionList(packageName)
204
 
                if not len(dbVersions):
205
 
                        raise PackageNotFoundError, packageName
206
 
                return dbVersions[0].trailingRevision().asString().split("-")[0]
 
197
    def __init__(self):
 
198
        PackageDb.__init__(self)
 
199
 
 
200
    def getVersion(self, packageName):
 
201
        import conary
 
202
        from conaryclient import ConaryClient
 
203
        client = ConaryClient()
 
204
        dbVersions = client.db.getTroveVersionList(packageName)
 
205
        if not len(dbVersions):
 
206
            raise PackageNotFoundError, packageName
 
207
        return dbVersions[0].trailingRevision().asString().split("-")[0]
 
208
 
 
209
# getVersion not implemented because on Solaris multiple modules are installed
 
210
# in single packages, so it is hard to tell what version number of a specific
 
211
# module.
 
212
#
 
213
class _SolarisPackageDb(PackageDb):
 
214
    def __init__(self):
 
215
        PackageDb.__init__(self)
207
216
 
208
217
class JhBuildPackageDb(PackageDb):
209
 
        def __init__(self):
210
 
                PackageDb.__init__(self)
211
 
                prefixes = []
212
 
                prefixes.append(os.environ['LD_LIBRARY_PATH'])
213
 
                prefixes.append(os.environ['XDG_CONFIG_DIRS'])
214
 
                prefixes.append(os.environ['PKG_CONFIG_PATH'])
215
 
                self.prefix = os.path.commonprefix(prefixes)
216
 
                self.localePrefixes.append(self.prefix + '/share/locale')
217
 
        
218
 
        def getDependencies(self, packageName):
219
 
                result = {}
220
 
                lines = os.popen('jhbuild list ' + packageName).readlines()
221
 
                for line in lines:
222
 
                        if line:
223
 
                                result[line.strip()] = None
224
 
                return result.keys()
 
218
    def __init__(self):
 
219
        PackageDb.__init__(self)
 
220
        prefixes = []
 
221
        prefixes.append(os.environ['LD_LIBRARY_PATH'])
 
222
        prefixes.append(os.environ['XDG_CONFIG_DIRS'])
 
223
        prefixes.append(os.environ['PKG_CONFIG_PATH'])
 
224
        self.prefix = os.path.commonprefix(prefixes)
 
225
        self.localePrefixes.append(self.prefix + '/share/locale')
 
226
 
 
227
    def getDependencies(self, packageName):
 
228
        result = {}
 
229
        lines = os.popen('jhbuild list ' + packageName).readlines()
 
230
        for line in lines:
 
231
            if line:
 
232
                result[line.strip()] = None
 
233
        return result.keys()
225
234
 
226
235
class Distro:
227
 
        """
228
 
        Class representing a distribution.
229
 
        
230
 
        Scripts may want to do arbitrary logic based on whichever distro is in use (e.g. handling differences in names of packages, distribution-specific patches, etc.)
231
 
 
232
 
        We can either create methods in the Distro class to handle these, or we can use constructs like isinstance(distro, Ubuntu) to handle this. We can even create hierarchies of distro subclasses to handle this kind of thing (could get messy fast though)
233
 
        """
 
236
    """
 
237
    Class representing a distribution.
 
238
 
 
239
    Scripts may want to do arbitrary logic based on whichever distro is in use (e.g. handling differences in names of packages, distribution-specific patches, etc.)
 
240
 
 
241
    We can either create methods in the Distro class to handle these, or we can use constructs like isinstance(distro, Ubuntu) to handle this. We can even create hierarchies of distro subclasses to handle this kind of thing (could get messy fast though)
 
242
    """
234
243
 
235
244
class RedHatOrFedora(Distro):
236
 
        """
237
 
        Class representing one of Red Hat Linux, Fedora, Red Hat Enterprise Linux, or one of the rebuild-style derivatives
238
 
        """
239
 
        def __init__(self):
240
 
                self.packageDb = _RpmPackageDb()
 
245
    """
 
246
    Class representing one of Red Hat Linux, Fedora, Red Hat Enterprise Linux, or one of the rebuild-style derivatives
 
247
    """
 
248
    def __init__(self):
 
249
        self.packageDb = _RpmPackageDb()
241
250
 
242
251
class Debian(Distro):
243
 
        """
244
 
        Class representing one of the Debian or Debian-derived distributions
245
 
        """
246
 
        def __init__(self):
247
 
                self.packageDb = _AptPackageDb()
 
252
    """
 
253
    Class representing one of the Debian or Debian-derived distributions
 
254
    """
 
255
    def __init__(self):
 
256
        self.packageDb = _AptPackageDb()
248
257
 
249
258
class Ubuntu(Debian):
250
 
        """
251
 
        Class representing one of the Debian or Debian-derived distributions
252
 
        """
253
 
        def __init__(self):
254
 
                self.packageDb = _UbuntuAptPackageDb()
 
259
    """
 
260
    Class representing one of the Debian or Debian-derived distributions
 
261
    """
 
262
    def __init__(self):
 
263
        self.packageDb = _UbuntuAptPackageDb()
255
264
 
256
265
class Suse(Distro):
257
 
        """
258
 
        Class representing one of the SuSE or SuSE-derived distributions
259
 
        """
 
266
    """
 
267
    Class representing one of the SuSE or SuSE-derived distributions
 
268
    """
 
269
    def __init__(self):
 
270
        self.packageDb = _RpmPackageDb()
260
271
 
261
272
class Gentoo(Distro):
262
 
        """
263
 
        Class representing one of the Gentoo or Gentoo-derived distributions
264
 
        """
265
 
        def __init__(self):
266
 
                self.packageDb = _PortagePackageDb()
 
273
    """
 
274
    Class representing one of the Gentoo or Gentoo-derived distributions
 
275
    """
 
276
    def __init__(self):
 
277
        self.packageDb = _PortagePackageDb()
267
278
 
268
279
class Conary(Distro):
269
 
        """
270
 
        Class representing a Conary-based distribution
271
 
        """
272
 
        def __init__(self):
273
 
                self.packageDb = _ConaryPackageDb()
 
280
    """
 
281
    Class representing a Conary-based distribution
 
282
    """
 
283
    def __init__(self):
 
284
        self.packageDb = _ConaryPackageDb()
 
285
 
 
286
class Solaris(Distro):
 
287
    """
 
288
    Class representing a Solaris distribution
 
289
    """
 
290
    def __init__(self):
 
291
        self.packageDb = _SolarisPackageDb()
274
292
 
275
293
class JHBuild(Distro):
276
 
        """
277
 
        Class representing a JHBuild environment
278
 
        """
279
 
        def __init__(self):
280
 
                self.packageDb = JhBuildPackageDb()
 
294
    """
 
295
    Class representing a JHBuild environment
 
296
    """
 
297
    def __init__(self):
 
298
        self.packageDb = JhBuildPackageDb()
281
299
 
282
 
print "Detecting distribution:",
 
300
message = "Detecting distribution: "
283
301
if os.environ.get("CERTIFIED_GNOMIE", "no") == "yes":
284
 
        print "JHBuild environment"
285
 
        distro = JHBuild()
 
302
    logger.log(message + "JHBuild environment")
 
303
    distro = JHBuild()
 
304
elif os.path.exists ("/etc/SuSE-release"):
 
305
    logger.log(message + "SuSE (or derived distribution)")
 
306
    distro = Suse()
 
307
elif os.path.exists ("/etc/fedora-release"):
 
308
    logger.log(message + "Fedora (or derived distribution)")
 
309
    distro = RedHatOrFedora()
286
310
elif os.path.exists ("/etc/redhat-release"):
287
 
        print "Red Hat/Fedora/derived distribution"
288
 
        distro = RedHatOrFedora()
289
 
elif os.path.exists ("/etc/SuSE-release"):
290
 
        print "SuSE (or derived distribution)"
291
 
elif os.path.exists ("/etc/fedora-release"): 
292
 
        print "Fedora (or derived distribution)"
293
 
        distro = RedHatOrFedora()
 
311
    logger.log(message + "Red Hat/Fedora/derived distribution")
 
312
    distro = RedHatOrFedora()
294
313
elif os.path.exists ("/usr/share/doc/ubuntu-minimal"):
295
 
        print "Ubuntu (or derived distribution)"
296
 
        distro = Ubuntu()
 
314
    logger.log(message + "Ubuntu (or derived distribution)")
 
315
    distro = Ubuntu()
297
316
elif os.path.exists ("/etc/debian_version"):
298
 
        print "Debian (or derived distribution)"
299
 
        distro = Debian()
 
317
    logger.log(message + "Debian (or derived distribution)")
 
318
    distro = Debian()
300
319
elif os.path.exists ("/etc/gentoo-release"):
301
 
        print "Gentoo (or derived distribution)"
302
 
        distro = Gentoo()
 
320
    logger.log(message + "Gentoo (or derived distribution)")
 
321
    distro = Gentoo()
303
322
elif os.path.exists ("/etc/slackware-version"):
304
 
        print "Slackware"
305
 
        raise DistributionNotSupportedError("Slackware")
 
323
    logger.log(message + "Slackware")
 
324
    raise DistributionNotSupportedError("Slackware")
306
325
elif os.path.exists ("/var/lib/conarydb/conarydb"):
307
 
        print "Conary-based distribution"
308
 
        distro = Conary()
 
326
    logger.log(message + "Conary-based distribution")
 
327
    distro = Conary()
 
328
elif os.path.exists ("/etc/release") and \
 
329
        re.match (".*Solaris", open ("/etc/release").readline()):
 
330
    print "Solaris distribution"
 
331
    distro = Solaris()
309
332
else:
310
 
        print "Unknown"
311
 
        raise DistributionNotSupportedError("Unknown")
 
333
    logger.log(message + "Unknown")
 
334
    raise DistributionNotSupportedError("Unknown")
312
335
 
313
336
packageDb = distro.packageDb