Store autopkgtest flag in sources

Extend read_sources to store a new AUTOPKGTEST boolean flag, which is true if
the Testsuite: field exists and starts with "autopkgtest" (this covers autodep8
cases like autopkgtest-pkg-perl).

Extend TestData.add() to take a new testsuite argument which specifies the
source's Testsuite: field.
This commit is contained in:
Martin Pitt 2015-07-01 15:49:06 +02:00
parent 6b775c50f3
commit add46d2904
3 changed files with 12 additions and 5 deletions

View File

@ -564,6 +564,7 @@ class Britney(object):
[], [],
get_field('Maintainer'), get_field('Maintainer'),
False, False,
get_field('Testsuite', '').startswith('autopkgtest'),
] ]
return sources return sources

View File

@ -24,6 +24,7 @@ SECTION = 1
BINARIES = 2 BINARIES = 2
MAINTAINER = 3 MAINTAINER = 3
FAKESRC = 4 FAKESRC = 4
AUTOPKGTEST = 5
# binary package # binary package
SOURCE = 2 SOURCE = 2

View File

@ -63,7 +63,7 @@ class TestData:
def __del__(self): def __del__(self):
shutil.rmtree(self.path) shutil.rmtree(self.path)
def add(self, name, unstable, fields={}, add_src=True): def add(self, name, unstable, fields={}, add_src=True, testsuite=None):
'''Add a binary package to the index file. '''Add a binary package to the index file.
You need to specify at least the package name and in which list to put You need to specify at least the package name and in which list to put
@ -73,7 +73,8 @@ class TestData:
fields. fields.
Unless add_src is set to False, this will also automatically create a Unless add_src is set to False, this will also automatically create a
source record, based on fields['Source'] and name. source record, based on fields['Source'] and name. In that case, the
"Testsuite:" field is set to the testsuite argument.
''' '''
assert (name not in self.added_binaries[unstable]) assert (name not in self.added_binaries[unstable])
self.added_binaries[unstable].add(name) self.added_binaries[unstable].add(name)
@ -93,8 +94,11 @@ class TestData:
if add_src: if add_src:
src = fields.get('Source', name) src = fields.get('Source', name)
if src not in self.added_sources[unstable]: if src not in self.added_sources[unstable]:
self.add_src(src, unstable, {'Version': fields['Version'], srcfields = {'Version': fields['Version'],
'Section': fields['Section']}) 'Section': fields['Section']}
if testsuite:
srcfields['Testsuite'] = testsuite
self.add_src(src, unstable, srcfields)
def add_src(self, name, unstable, fields={}): def add_src(self, name, unstable, fields={}):
'''Add a source package to the index file. '''Add a source package to the index file.
@ -102,7 +106,8 @@ class TestData:
You need to specify at least the package name and in which list to put You need to specify at least the package name and in which list to put
it (unstable==True for unstable/proposed, or False for it (unstable==True for unstable/proposed, or False for
testing/release). fields specifies all additional entries, which can be testing/release). fields specifies all additional entries, which can be
Version (default: 1), Section (default: devel), and Extra-Source-Only. Version (default: 1), Section (default: devel), Testsuite (default:
none), and Extra-Source-Only.
''' '''
assert (name not in self.added_sources[unstable]) assert (name not in self.added_sources[unstable])
self.added_sources[unstable].add(name) self.added_sources[unstable].add(name)