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