~ubuntu-branches/ubuntu/quantal/lsb/quantal-proposed

« back to all changes in this revision

Viewing changes to lsb_release

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-03-10 18:48:17 UTC
  • Revision ID: james.westby@ubuntu.com-20080310184817-7kxrgtuzhy8nnvjr
Tags: 3.2-4ubuntu1
* Merge with Debian; remaining changes:
  - Depend on postfix rather than exim4 as preferred mail-transport-agent
    alternative.
  - Depend on libgl1-mesa-glx rather than libgl1-mesa as preferred libgl1
    alternative.
  - Add Ubuntu logging functions.
  - lsb: Drop the optional lsb-qt4 module to a suggests.
  - Maintainer field set to Ubuntu.
* init-functions: Make functions safe to use with sh -e.

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
    return RELEASE_CODENAME_LOOKUP.get(shortrelease, unknown)
50
50
 
51
51
# LSB compliance packages... may grow eventually
52
 
PACKAGES = 'lsb-core lsb-cxx lsb-graphics lsb-desktop lsb-qt4'
 
52
PACKAGES = 'lsb-core lsb-cxx lsb-graphics lsb-desktop lsb-qt4 lsb-languages lsb-multimedia lsb-printing'
53
53
 
54
 
modnamere = re.compile(r'lsb-(?P<module>[a-z]+)-(?P<arch>[^ ]+)(?: \(= (?P<version>[0-9.]+)\))?')
 
54
modnamere = re.compile(r'lsb-(?P<module>[a-z0-9]+)-(?P<arch>[^ ]+)(?: \(= (?P<version>[0-9.]+)\))?')
55
55
 
56
56
def valid_lsb_versions(version, module):
57
57
    # If a module is ever released that only appears in >= version, deal
63
63
            return ['3.1']
64
64
        else:
65
65
            return ['2.0', '3.0', '3.1']
 
66
    elif version == '3.2':
 
67
        if module == 'desktop':
 
68
            return ['3.1', '3.2']
 
69
        elif module == 'qt4':
 
70
            return ['3.1']
 
71
        elif module in ('printing', 'languages', 'multimedia'):
 
72
            return ['3.2']
 
73
        else:
 
74
            return ['2.0', '3.0', '3.1', '3.2']
66
75
 
67
76
    return [version]
68
77
 
183
192
 
184
193
    distinfo['DESCRIPTION'] = '%(ID)s %(OS)s' % distinfo
185
194
 
 
195
    if os.path.exists('/etc/debian_version'):
 
196
        release = open('/etc/debian_version').read().strip()
 
197
        if not release[0:1].isalpha():
 
198
            # /etc/debian_version should be numeric
 
199
            codename = lookup_codename(release, 'n/a')
 
200
            distinfo.update({ 'RELEASE' : release, 'CODENAME' : codename })
 
201
        else:
 
202
            distinfo['RELEASE'] = release
 
203
            distinfo['CODENAME'] = None
 
204
 
 
205
    # Only use apt information if we did not get the proper information
 
206
    # from /etc/debian_version or if we don't have a codename
 
207
    # (which will happen if /etc/debian_version does not contain a
 
208
    # number but some text like 'testing/unstable' or 'lenny/sid')
 
209
    #
 
210
    # This is slightly faster and less error prone in case the user
 
211
    # has an entry in his /etc/apt/sources.list but has not actually
 
212
    # upgraded the system.
186
213
    rinfo = guess_release_from_apt()
187
 
    if rinfo:
 
214
    if rinfo and not distinfo['CODENAME']:
188
215
        release = rinfo.get('version')
189
216
        if release:
190
217
            codename = lookup_codename(release, 'n/a')
196
223
            else:
197
224
                codename = 'sid'
198
225
        distinfo.update({ 'RELEASE' : release, 'CODENAME' : codename })
199
 
    elif os.path.exists('/etc/debian_version'):
200
 
        release = open('/etc/debian_version').read().strip()
201
 
        if not release[0:1].isalpha():
202
 
            # /etc/debian_version should be numeric
203
 
            codename = lookup_codename(release, 'n/a')
204
 
            distinfo.update({ 'RELEASE' : release, 'CODENAME' : codename })
205
 
        else:
206
 
            distinfo['RELEASE'] = release
207
226
 
208
227
    if 'RELEASE' in distinfo:
209
228
        distinfo['DESCRIPTION'] += ' %(RELEASE)s' % distinfo
220
239
            line = line.strip()
221
240
            if not line:
222
241
                continue
 
242
            # Skip invalid lines
 
243
            if not '=' in line:
 
244
                continue
223
245
            var, arg = line.split('=', 1)
224
246
            if var.startswith('DISTRIB_'):
225
247
                var = var[8:]