debian/bin,debian/control,debian/lib/python: Use Python 3

This commit is contained in:
Ben Hutchings 2015-08-29 21:48:39 +01:00
parent 32fff0de75
commit 6b977589fb
10 changed files with 49 additions and 61 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
import sys import sys
sys.path.append(sys.path[0] + "/../lib/python") sys.path.append(sys.path[0] + "/../lib/python")

View File

@ -1,4 +1,4 @@
#!/usr/bin/python #!/usr/bin/python3
import sys import sys
sys.path.append('debian/lib/python') sys.path.append('debian/lib/python')

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
import sys import sys
sys.path.append("debian/lib/python") sys.path.append("debian/lib/python")
@ -160,9 +160,9 @@ class Gencontrol(Base):
if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'): if os.getenv('DEBIAN_KERNEL_DISABLE_INSTALLER'):
if self.changelog[0].distribution == 'UNRELEASED': if self.changelog[0].distribution == 'UNRELEASED':
import warnings import warnings
warnings.warn(u'Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)') warnings.warn('Disable installer modules on request (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else: else:
raise RuntimeError(u'Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)') raise RuntimeError('Unable to disable installer modules in release build (DEBIAN_KERNEL_DISABLE_INSTALLER set)')
else: else:
# Add udebs using kernel-wedge # Add udebs using kernel-wedge
installer_def_dir = 'debian/installer' installer_def_dir = 'debian/installer'
@ -344,10 +344,10 @@ class Gencontrol(Base):
if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'): if os.getenv('DEBIAN_KERNEL_DISABLE_DEBUG'):
if self.changelog[0].distribution == 'UNRELEASED': if self.changelog[0].distribution == 'UNRELEASED':
import warnings import warnings
warnings.warn(u'Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)') warnings.warn('Disable debug infos on request (DEBIAN_KERNEL_DISABLE_DEBUG set)')
build_debug = False build_debug = False
else: else:
raise RuntimeError(u'Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)') raise RuntimeError('Unable to disable debug infos in release build (DEBIAN_KERNEL_DISABLE_DEBUG set)')
if build_debug: if build_debug:
makeflags['DEBUG'] = True makeflags['DEBUG'] = True

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
import sys import sys
sys.path.append("debian/lib/python") sys.path.append("debian/lib/python")

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3
import optparse import optparse
import os.path import os.path

1
debian/changelog vendored
View File

@ -14,6 +14,7 @@ linux (4.2~rc8-1~exp2) UNRELEASED; urgency=medium
are redundant with sparc64 and neither is an official port are redundant with sparc64 and neither is an official port
* Fix last issue that prevents a reproducible build (Closes: #769844): * Fix last issue that prevents a reproducible build (Closes: #769844):
- DocBook: Use a fixed encoding for output - DocBook: Use a fixed encoding for output
* debian/bin,debian/control,debian/lib/python: Use Python 3
-- Ben Hutchings <ben@decadent.org.uk> Tue, 25 Aug 2015 18:50:57 +0100 -- Ben Hutchings <ben@decadent.org.uk> Tue, 25 Aug 2015 18:50:57 +0100

View File

@ -1,8 +1,6 @@
import collections import collections
import os.path import os.path
import re import re
import six
import six.moves
from . import utils from . import utils
@ -36,10 +34,7 @@ class Changelog(list):
def __init__(self, dir='', version=None): def __init__(self, dir='', version=None):
if version is None: if version is None:
version = Version version = Version
if six.PY3: f = open(os.path.join(dir, "debian/changelog"), encoding="UTF-8")
f = open(os.path.join(dir, "debian/changelog"), encoding="UTF-8")
else:
f = open(os.path.join(dir, "debian/changelog"))
while True: while True:
line = f.readline() line = f.readline()
if not line: if not line:
@ -88,7 +83,6 @@ $
def __str__(self): def __str__(self):
return self.complete return self.complete
__unicode__ = __str__
@property @property
def complete(self): def complete(self):
@ -164,7 +158,7 @@ $
self.linux_version = d['version'] self.linux_version = d['version']
if d['modifier'] is not None: if d['modifier'] is not None:
assert not d['update'] assert not d['update']
self.linux_upstream = u'-'.join((d['version'], d['modifier'])) self.linux_upstream = '-'.join((d['version'], d['modifier']))
else: else:
self.linux_upstream = d['version'] self.linux_upstream = d['version']
self.linux_upstream_full = self.linux_upstream + d['update'] self.linux_upstream_full = self.linux_upstream + d['update']
@ -193,8 +187,7 @@ class PackageArchitecture(collections.MutableSet):
return self._data.__len__() return self._data.__len__()
def __str__(self): def __str__(self):
return u' '.join(sorted(self)) return ' '.join(sorted(self))
__unicode__ = __str__
def add(self, value): def add(self, value):
self._data.add(value) self._data.add(value)
@ -203,7 +196,7 @@ class PackageArchitecture(collections.MutableSet):
self._data.discard(value) self._data.discard(value)
def extend(self, value): def extend(self, value):
if isinstance(value, six.string_types): if isinstance(value, str):
for i in re.split('\s', value.strip()): for i in re.split('\s', value.strip()):
self.add(i) self.add(i)
else: else:
@ -223,13 +216,12 @@ class PackageDescription(object):
def __str__(self): def __str__(self):
wrap = utils.TextWrapper(width=74, fix_sentence_endings=True).wrap wrap = utils.TextWrapper(width=74, fix_sentence_endings=True).wrap
short = u', '.join(self.short) short = ', '.join(self.short)
long_pars = [] long_pars = []
for i in self.long: for i in self.long:
long_pars.append(wrap(i)) long_pars.append(wrap(i))
long = u'\n .\n '.join([u'\n '.join(i) for i in long_pars]) long = '\n .\n '.join(['\n '.join(i) for i in long_pars])
return short + u'\n ' + long return short + '\n ' + long
__unicode__ = __str__
def append(self, str): def append(self, str):
str = str.strip() str = str.strip()
@ -255,8 +247,7 @@ class PackageRelation(list):
self.extend(value, override_arches) self.extend(value, override_arches)
def __str__(self): def __str__(self):
return u', '.join(six.text_type(i) for i in self) return ', '.join(str(i) for i in self)
__unicode__ = __str__
def _search_value(self, value): def _search_value(self, value):
for i in self: for i in self:
@ -265,7 +256,7 @@ class PackageRelation(list):
return None return None
def append(self, value, override_arches=None): def append(self, value, override_arches=None):
if isinstance(value, six.string_types): if isinstance(value, str):
value = PackageRelationGroup(value, override_arches) value = PackageRelationGroup(value, override_arches)
elif not isinstance(value, PackageRelationGroup): elif not isinstance(value, PackageRelationGroup):
raise ValueError(u"got %s" % type(value)) raise ValueError(u"got %s" % type(value))
@ -276,8 +267,8 @@ class PackageRelation(list):
super(PackageRelation, self).append(value) super(PackageRelation, self).append(value)
def extend(self, value, override_arches=None): def extend(self, value, override_arches=None):
if isinstance(value, six.string_types): if isinstance(value, str):
value = (j.strip() for j in re.split(u',', value.strip())) value = (j.strip() for j in re.split(',', value.strip()))
for i in value: for i in value:
self.append(i, override_arches) self.append(i, override_arches)
@ -288,31 +279,30 @@ class PackageRelationGroup(list):
self.extend(value, override_arches) self.extend(value, override_arches)
def __str__(self): def __str__(self):
return u' | '.join(six.text_type(i) for i in self) return ' | '.join(str(i) for i in self)
__unicode__ = __str__
def _search_value(self, value): def _search_value(self, value):
for i, j in six.moves.zip(self, value): for i, j in zip(self, value):
if i.name != j.name or i.version != j.version: if i.name != j.name or i.version != j.version:
return None return None
return self return self
def _update_arches(self, value): def _update_arches(self, value):
for i, j in six.moves.zip(self, value): for i, j in zip(self, value):
if i.arches: if i.arches:
for arch in j.arches: for arch in j.arches:
if arch not in i.arches: if arch not in i.arches:
i.arches.append(arch) i.arches.append(arch)
def append(self, value, override_arches=None): def append(self, value, override_arches=None):
if isinstance(value, six.string_types): if isinstance(value, str):
value = PackageRelationEntry(value, override_arches) value = PackageRelationEntry(value, override_arches)
elif not isinstance(value, PackageRelationEntry): elif not isinstance(value, PackageRelationEntry):
raise ValueError raise ValueError
super(PackageRelationGroup, self).append(value) super(PackageRelationGroup, self).append(value)
def extend(self, value, override_arches=None): def extend(self, value, override_arches=None):
if isinstance(value, six.string_types): if isinstance(value, str):
value = (j.strip() for j in re.split('\|', value.strip())) value = (j.strip() for j in re.split('\|', value.strip()))
for i in value: for i in value:
self.append(i, override_arches) self.append(i, override_arches)
@ -332,12 +322,12 @@ class PackageRelationEntry(object):
OP_GT = 6 OP_GT = 6
operators = { operators = {
u'<<': OP_LT, '<<': OP_LT,
u'<=': OP_LE, '<=': OP_LE,
u'=': OP_EQ, '=': OP_EQ,
u'!=': OP_NE, '!=': OP_NE,
u'>=': OP_GE, '>=': OP_GE,
u'>>': OP_GT, '>>': OP_GT,
} }
operators_neg = { operators_neg = {
@ -361,10 +351,9 @@ class PackageRelationEntry(object):
def __str__(self): def __str__(self):
return self.operators_text[self._op] return self.operators_text[self._op]
__unicode__ = __str__
def __init__(self, value=None, override_arches=None): def __init__(self, value=None, override_arches=None):
if not isinstance(value, six.string_types): if not isinstance(value, str):
raise ValueError raise ValueError
self.parse(value) self.parse(value)
@ -375,11 +364,10 @@ class PackageRelationEntry(object):
def __str__(self): def __str__(self):
ret = [self.name] ret = [self.name]
if self.operator is not None and self.version is not None: if self.operator is not None and self.version is not None:
ret.extend((u' (', six.text_type(self.operator), u' ', self.version, u')')) ret.extend((' (', str(self.operator), ' ', self.version, ')'))
if self.arches: if self.arches:
ret.extend((u' [', u' '.join(self.arches), u']')) ret.extend((' [', ' '.join(self.arches), ']'))
return u''.join(ret) return ''.join(ret)
__unicode__ = __str__
def parse(self, value): def parse(self, value):
match = self._re.match(value) match = self._re.match(value)
@ -400,14 +388,14 @@ class PackageRelationEntry(object):
class Package(dict): class Package(dict):
_fields = collections.OrderedDict(( _fields = collections.OrderedDict((
('Package', six.text_type), ('Package', str),
('Source', six.text_type), ('Source', str),
('Architecture', PackageArchitecture), ('Architecture', PackageArchitecture),
('Section', six.text_type), ('Section', str),
('Priority', six.text_type), ('Priority', str),
('Maintainer', six.text_type), ('Maintainer', str),
('Uploaders', six.text_type), ('Uploaders', str),
('Standards-Version', six.text_type), ('Standards-Version', str),
('Build-Depends', PackageRelation), ('Build-Depends', PackageRelation),
('Build-Depends-Indep', PackageRelation), ('Build-Depends-Indep', PackageRelation),
('Provides', PackageRelation), ('Provides', PackageRelation),

View File

@ -1,5 +1,4 @@
import codecs import codecs
import six
from collections import OrderedDict from collections import OrderedDict
from .debian import * from .debian import *
@ -141,7 +140,7 @@ class Gencontrol(object):
cmds = [] cmds = []
for i in extra_arches[arch]: for i in extra_arches[arch]:
cmds.append("$(MAKE) -f debian/rules.real install-dummy ARCH='%s' DH_OPTIONS='-p%s'" % (arch, i['Package'])) cmds.append("$(MAKE) -f debian/rules.real install-dummy ARCH='%s' DH_OPTIONS='-p%s'" % (arch, i['Package']))
makefile.add('binary-arch_%s' % arch, [u'binary-arch_%s_extra' % arch]) makefile.add('binary-arch_%s' % arch, ['binary-arch_%s_extra' % arch])
makefile.add("binary-arch_%s_extra" % arch, cmds = cmds) makefile.add("binary-arch_%s_extra" % arch, cmds = cmds)
def do_arch(self, packages, makefile, arch, vars, makeflags, extra): def do_arch(self, packages, makefile, arch, vars, makeflags, extra):
@ -275,7 +274,7 @@ class Gencontrol(object):
def subst(match): def subst(match):
return vars[match.group(1)] return vars[match.group(1)]
return re.sub(r'@([-_a-z0-9]+)@', subst, six.text_type(s)) return re.sub(r'@([-_a-z0-9]+)@', subst, str(s))
def write(self, packages, makefile): def write(self, packages, makefile):
self.write_control(packages.values()) self.write_control(packages.values())
@ -298,4 +297,4 @@ class Gencontrol(object):
for entry in list: for entry in list:
for key, value in entry.iteritems(): for key, value in entry.iteritems():
f.write(u"%s: %s\n" % (key, value)) f.write(u"%s: %s\n" % (key, value))
f.write(u'\n') f.write('\n')

View File

@ -58,11 +58,11 @@ def read_control(f):
break break
if line[0] in ' \t': if line[0] in ' \t':
if not last: if not last:
raise ValueError(u'Continuation line seen before first header') raise ValueError('Continuation line seen before first header')
lines.append(line.lstrip()) lines.append(line.lstrip())
continue continue
if last: if last:
e[last] = u'\n'.join(lines) e[last] = '\n'.join(lines)
i = line.find(':') i = line.find(':')
if i < 0: if i < 0:
raise ValueError(u"Not a header, not a continuation: ``%s''" % line) raise ValueError(u"Not a header, not a continuation: ``%s''" % line)

View File

@ -3,7 +3,7 @@ Priority: optional
Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org> Maintainer: Debian Kernel Team <debian-kernel@lists.debian.org>
Uploaders: Bastian Blank <waldi@debian.org>, maximilian attems <maks@debian.org>, Ben Hutchings <ben@decadent.org.uk> Uploaders: Bastian Blank <waldi@debian.org>, maximilian attems <maks@debian.org>, Ben Hutchings <ben@decadent.org.uk>
Standards-Version: 3.9.5 Standards-Version: 3.9.5
Build-Depends: debhelper, cpio, kmod, python, python-six, xz-utils, kernel-wedge, quilt, patchutils, bc Build-Depends: debhelper, cpio, kmod, python3, xz-utils, kernel-wedge, quilt, patchutils, bc
Build-Depends-Indep: xmlto Build-Depends-Indep: xmlto
Vcs-Git: https://anonscm.debian.org/git/kernel/linux.git Vcs-Git: https://anonscm.debian.org/git/kernel/linux.git
Vcs-Browser: https://anonscm.debian.org/cgit/kernel/linux.git Vcs-Browser: https://anonscm.debian.org/cgit/kernel/linux.git