def guess_release_from_apt(origin='Debian', component='main',
ignoresuites=('experimental'),
label='Debian',
- alternate_olabels={'Debian Ports':'ftp.debian-ports.org'}):
+ alternate_olabels={'Debian Ports': ('ftp.ports.debian.org', 'ftp.debian-ports.org')}):
releases = parse_apt_policy()
if not releases:
x[1].get('component', '') == component and
x[1].get('label', '') == label) or (
x[1].get('origin', '') in alternate_olabels and
- x[1].get('label', '') == alternate_olabels.get(x[1].get('origin', '')))]
+ x[1].get('label', '') in alternate_olabels.get(x[1].get('origin', '')))]
# Check again to make sure we didn't wipe out all of the releases
if not releases:
release = rinfo.get('version')
# Special case Debian-Ports as their Release file has 'version': '1.0'
- if release == '1.0' and rinfo.get('origin') == 'Debian Ports' and rinfo.get('label') == 'ftp.debian-ports.org':
+ if release == '1.0' and rinfo.get('origin') == 'Debian Ports' and rinfo.get('label') in ('ftp.ports.debian.org', 'ftp.debian-ports.org'):
release = None
rinfo.update({'suite': 'unstable'})
print(' release o=Debian,a=unstable,n=sid,l=Debian,c=main')
print(' origin MirRor-is-not-read')
-if os.environ.get('TEST_APT_CACHE_UNSTABLE_PORTS') == '500':
+if os.environ.get('TEST_APT_CACHE_UNSTABLE_PORTS_OLD') == '500':
print(' 500 http://MirRor_is_not_read/folder-either-debian-ports/ sid/main arch Packages')
print(' release o=Debian Ports,a=unstable,n=sid,l=ftp.debian-ports.org,c=main,v=1.0')
print(' origin MirRor-is-not-read')
+if os.environ.get('TEST_APT_CACHE_UNSTABLE_PORTS') == '500':
+ print(' 500 http://MirRor_is_not_read/folder-either-debian-ports/ sid/main arch Packages')
+ print(' release o=Debian Ports,a=unstable,n=sid,l=ftp.ports.debian.org,c=main,v=1.0')
+ print(' origin MirRor-is-not-read')
+
print('Pinned packages:')
label='l8bel',
component='c0mp0nent',
ignoresuites=('c0mp0nentIgn'),
- alternate_olabels={'P-or1g1n':'P-l8bel'}),
+ alternate_olabels={'P-or1g1n': ('P-l8bel', 'P-l9bel')}),
supposed_output)
os.environ.pop('TEST_APT_CACHE1')
os.environ.pop('TEST_APT_CACHE2')
os.remove(fn)
os.environ.pop('LSB_ETC_DEBIAN_VERSION')
- # Test "unstable releases with Debian Ports" that end in /sid, go read valid apt-cache policy
- os.environ['TEST_APT_CACHE_UNSTABLE_PORTS'] = '500'
distinfo['CODENAME'] = 'sid'
distinfo['RELEASE'] = 'unstable'
distinfo['DESCRIPTION'] = '%(ID)s %(OS)s %(RELEASE)s (%(CODENAME)s)' % distinfo
- for rno in lr.RELEASE_CODENAME_LOOKUP:
- fn = 'test/debian_version_' + rnd_string(5,12)
- f = open(fn,'w')
- f.write(lr.RELEASE_CODENAME_LOOKUP[rno] + '/sid')
- f.close()
- os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
- self.assertEqual(lr.guess_debian_release(),distinfo)
- os.remove(fn)
+
+ for CODE in ('PORTS', 'PORTS_OLD'):
+ # Test "unstable releases with Debian Ports" that end in /sid, go read valid apt-cache policy
+ os.environ['TEST_APT_CACHE_UNSTABLE_' + CODE] = '500'
+ for rno in lr.RELEASE_CODENAME_LOOKUP:
+ fn = 'test/debian_version_' + rnd_string(5,12)
+ f = open(fn,'w')
+ f.write(lr.RELEASE_CODENAME_LOOKUP[rno] + '/sid')
+ f.close()
+ os.environ['LSB_ETC_DEBIAN_VERSION'] = fn
+ self.assertEqual(lr.guess_debian_release(),distinfo)
+ os.remove(fn)
+ os.environ.pop('TEST_APT_CACHE_UNSTABLE_' + CODE)
os.environ.pop('LSB_ETC_DEBIAN_VERSION')
- os.environ.pop('TEST_APT_CACHE_UNSTABLE_PORTS')
os.environ.pop('TEST_APT_CACHE_UNSTABLE')
def test_get_lsb_information(self):