debian/bin/gencontrol_signed.py: Make valid native version for signed source

dpkg-source strictly enforces that 3.0 (native) packages do not have
Debian revisions in their version strings, i.e. they cannot include
hyphens.

Replace the hyphen from the image binary version with a '+'.

Override this version back to what we want when building the signed
binary packages.
This commit is contained in:
Ben Hutchings 2018-04-07 10:51:22 +02:00
parent 3b3e6ad4cb
commit 9f8aafcd1f
2 changed files with 20 additions and 19 deletions

View File

@ -27,7 +27,6 @@ class Gencontrol(Base):
image_binary_version)
self.abiname = config_entry['abiname']
self.signed_version = re.sub(r'\+b(\d+)$', r'.b\1', image_binary_version)
self.vars = {
'upstreamversion': self.version.linux_upstream,
'version': self.version.linux_version,
@ -35,7 +34,6 @@ class Gencontrol(Base):
'abiname': self.abiname,
'imagebinaryversion': image_binary_version,
'imagesourceversion': self.version.complete,
'signedversion': self.signed_version,
'arch': arch,
}
@ -53,8 +51,8 @@ class Gencontrol(Base):
def do_main_setup(self, vars, makeflags, extra):
makeflags['VERSION'] = self.version.linux_version
makeflags['GENCONTROL_ARGS'] = (
'-DBuilt-Using="linux (= %(imagesourceversion)s)"' % vars)
makeflags['PACKAGE_VERSION'] = self.signed_version
'-v%(imagebinaryversion)s -DBuilt-Using="linux (= %(imagesourceversion)s)"' % vars)
makeflags['PACKAGE_VERSION'] = vars['imagebinaryversion']
def do_main_packages(self, packages, vars, makeflags, extra):
# Assume that arch:all packages do not get binNMU'd
@ -180,27 +178,30 @@ class Gencontrol(Base):
def write_changelog(self):
changelog_text = self.substitute(self.templates['changelog.in'],
self.vars)
# We probably need to insert a new version entry
changelog = Changelog(file=io.StringIO(changelog_text))
if changelog[0].version.complete != self.signed_version:
vars = self.vars.copy()
vars['distribution'] = self.changelog[0].distribution
vars['urgency'] = self.changelog[0].urgency
vars['date'] = time.strftime("%a, %d %b %Y %H:%M:%S +0000",
time.gmtime())
changelog_text = (self.substitute('''\
linux-signed-@arch@ (@signedversion@) @distribution@; urgency=@urgency@
# We need to insert a new version entry.
# Take the distribution and urgency from the linux changelog, and
# the base version from the changelog template.
vars = self.vars.copy()
vars['distribution'] = self.changelog[0].distribution
vars['urgency'] = self.changelog[0].urgency
vars['date'] = time.strftime("%a, %d %b %Y %H:%M:%S +0000",
time.gmtime())
vars['signedsourceversion'] = (changelog[0].version.complete + '+' +
re.sub(r'-', r'+',
vars['imagebinaryversion']))
with codecs.open(self.template_debian_dir + '/changelog', 'w', 'utf-8') as f:
f.write(self.substitute('''\
linux-signed-@arch@ (@signedsourceversion@) @distribution@; urgency=@urgency@
* Update to linux @imagebinaryversion@
-- Debian signing service <ftpmaster@debian.org> @date@
''',
vars) +
changelog_text)
with codecs.open(self.template_debian_dir + '/changelog', 'w', 'utf-8') as f:
vars))
f.write(changelog_text)
def write_files_json(self):

View File

@ -1,4 +1,4 @@
linux-signed-@arch@ (4.15.11-2) unstable; urgency=medium
linux-signed-@arch@ (1) unstable; urgency=medium
* Add template source package for signing