Commit Graph

234 Commits

Author SHA1 Message Date
Ben Hutchings 09f2b8df70 gencontrol: Introduce and use arch/featureset/flavour iterator functions 2019-03-05 19:11:48 +00:00
Ben Hutchings a54c09f109 Fix pycodestyle "line break after binary operator" warnings 2018-12-28 15:35:38 +00:00
Ben Hutchings 32af5cef75 debian/lib/python/debian_linux/debian.py: Fix deprecated import of MutableSet
Python 3.7 warns:

.../debian/lib/python/debian_linux/debian.py:403: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
  class PackageArchitecture(collections.MutableSet):
2018-12-28 15:35:29 +00:00
Ben Hutchings ee1d2b9dff debian/lib/python/debian_linux/config.py: Fix undefined exception type
SchemaItemBoolean and SchemaItemInteger attempt to raise an exception
of type Error when given invalid input, but this type has never been
defined.  Use ValueError instead.
2018-10-01 22:02:33 +01:00
Ben Hutchings 8b0aacdc26 debian/lib/python/debian_linux/gencontrol.py: Delete broken methods
MakeFlags.__repr__ references a "flags" type (probably meant to be
MakeFlags).  Gencontrol.write_config references the "file" type which
was removed in Python 3.  Clearly neither of these methods are
actually used, so delete them.
2018-10-01 21:59:58 +01:00
Ben Hutchings 8cafaf07ae debian/bin, debian/lib/python: Delete write-only vars reported by pyflakes 2018-10-01 21:50:59 +01:00
Ben Hutchings 169ec06045 debian/bin, debian/lib/python: Clean up imports based on pyflakes report
- Add explicit imports for all needed modules, rather than indirectly
  (accidentally!) importing them with "from ... import *"
- Replace all "from ... import *" statements, which inhibit static
  checking, with explicit lists of names to import
- Delete the remaining unneeded imports reported by pyflakes
2018-10-01 21:45:55 +01:00
Ben Hutchings af0098b10a debian/bin, debian/lib/python: Fix most errors reported by pycodestyle
Fix coding style violations reported by pycodestyle.  This is
mostly a matter of reformatting code, particularly to eliminate
over-long lines.  I also rename one variable ("l" is considered
visually ambiguous) and change a bare "except" to explicitly
catch all exceptions.

There are three types of error or warning remaining:

- debian/bin/...: E402 module level import not at top of file
  Scripts in debian/bin need to modify the import path before
  importing from debian/lib/python.
- E127 continuation line over-indented for visual indent
  This seems to be a false positive.  pycodestyle doesn't seem to be
  happy with any level of indent (including 0) on a continuation line
  in a "with" statement.
- debian/lib/python/debian_linux/debian.py:15:2: W291 trailing whitespace
  This is a false positive.  The trailing spaces are in a long
  string and are intentional.
2018-10-01 21:41:23 +01:00
Ben Hutchings db8e7a2186 Add support for specifying build-dependencies in binary package templates
This will allow removing a lot of the repetition introduced in the
preceding commits.
2018-09-11 01:12:58 +01:00
Ben Hutchings 399eeb4b11 debian/lib/python: Use raw strings for all regexes
Several regexes were written as normal strings.  Thankfully it appears
that none of the backslash-escaped sequences in them are parsed in
normal strings, so this shouldn't make any practical difference.
2018-09-11 00:33:40 +01:00
Ben Hutchings fac6a14424 Remove our private patch system, which is no longer needed
I converted the main patch series to quilt format in 3.2.20-1, but
this patch system was still used by genorig.py.  One useful
feature that was not available elsewhere was using patch + unifdef
to exclude only part of a source file.  However no source files
have needed this since 3.16-rc4 and I don't expect this to ever
be needed again.

The preceding changes moved the file removal/exclusion list into
debian/copyright and the disabling of broken features into the
main patch series, so the private patch system isn't doing
anything.

So we can now remove it completely.
2018-08-11 13:27:04 +01:00
Ben Hutchings 6afe0a945a debian/lib/python/debian_linux/debian.py: Let superclass split version string
The Version class already parses the version into upstream and Debian
revision parts.  Match the results of that against two separate
regexps rather than matching the whole version string and potentially
parsing it inconsistently.

As a result we no longer have to explicitly exclude '-' in the
revision_other group.
2018-07-01 19:37:25 +01:00
Ben Hutchings f12a5bd063 debian/lib/python/debian_linux/debian.py: Accept arbitrary revision suffixes
Closes: #898087

We always used to match arbitrary revision suffixes, but in commit
f4dbf1aa82 ".../debian.py: Fix binNMU revision parsing" I excluded
'+' from the revision_other to ensure that it wouldn't match a
binNMU suffix (which is matched separately).

Stop excluding '+' from the revision_other group, and change the
repetition to non-greedy so that any binNMU suffix will still match
the following group.
2018-07-01 04:35:00 +01:00
Ben Hutchings 6f7e87ee67 debian/lib/python/debian_linux/debian.py: More test cases for VersionLinux
Add test case for #898087 and for the earlier bug whose fix caused it.
2018-07-01 04:25:24 +01:00
Ben Hutchings 92a23c728d debian/lib/python/debian_linux/debian.py: Fix VersionLinux self-test failures
The revision_security group matched either +debXuY or ~debXuY but not
both.
2018-07-01 04:03:53 +01:00
Ben Hutchings 343b328ed0 debian/lib/python/debian_linux/debian.py: Add unit tests for VersionLinux class
Two of these currently fail and will be fixed in the next commit.
2018-07-01 04:03:53 +01:00
Ben Hutchings 1102f36c49 debian/lib/python/debian_linux/debian.py: Fix Version self-test failures
We didn't check for invalid characters in the upstream or revision
parts.  Tighten the regexps for those parts.

Also, failure to match the epoch or revision groups caused
those parts to be treated as part of the upstream version.
Split out the three parts and match them against separate
regexps.
2018-07-01 03:49:54 +01:00
Ben Hutchings ed60e27410 debian/lib/python/debian_linux/debian.py: Add unit tests for Version class
Three of these currently fail and will be fixed in the next commit.
2018-07-01 03:49:54 +01:00
Ben Hutchings f4dbf1aa82 debian/lib/python/debian_linux/debian.py: Fix binNMU revision parsing
In VersionLinux, any binNMU version will currently match the
revision_other group in the regexp and therefore never be recognised
as an experimental, security, or backport version.  This is probably
harmless in practice because:

- binNMUs don't happen in those suites
- Only debian/bin/gencontrol.py cares about the linux_revision_other
  attribute, and it won't be run for a binNMU version

But let's fix it by matching the binNMU suffix separately.
2018-04-24 20:40:27 +01:00
Ben Hutchings 90f09743ec debian/lib/python/debian_linux/debian.py: Fix binNMU changelog parsing
I incorrectly added a requirement of a newline after urgency in the
changelog entry top line as part of
"debian/lib/python/debian_linux/debian.py: Parse bottom lines of
changelog entries".  For a binNMU, there will be ", binary-only=yes"
after the urgency.  Since we don't currently care about any fields
after urgency, allow either a comma or newline.
2018-04-24 20:20:47 +01:00
Ben Hutchings a7e85cb155 debian/lib/python/debian_linux/debian.py: Parse bottom lines of changelog entries
Changelog doesn't currently provide access to the maintainer
name/address and date.  We need this when updating the signed template
changelog.

While we're at it, make sure we don't ignore any important lines.
Anything beginning with exactly zero or one spaces is a top or bottom
line, respectively; anything else is internal text we can ignore.
2018-04-08 10:31:20 +02:00
Ben Hutchings 1d4211ef97 debian/lib/python/debian_linux/gencontrol.py: Don't override source name
We set the source package name from debian/changelog, which is not
appropriate when generating a source package template for a signed image
package.  Only set the source package name if it's not in the control
template.
2018-04-08 10:31:19 +02:00
Ben Hutchings 354e9c4806 debian/lib/python/debian_linux/debian.py: Allow parsing any file as changelog 2018-04-08 10:31:19 +02:00
Ben Hutchings 09697cfec7 debian/lib/python/debian_linux/debian.py: Close changelog after parsing 2018-04-08 10:31:19 +02:00
Ben Hutchings e120f06587 debian/lib/python/debian_linux/gencontrol.py: Allow overriding output filenames 2018-04-08 10:31:19 +02:00
Ben Hutchings 06c36b3662 debian/control: Move many build dependencies to Build-Depends-Arch field 2017-09-30 14:09:54 +01:00
Ben Hutchings 9747655f89 Make the pickled config (config.defines.dump) reproducible 2017-01-07 18:25:56 +00:00
Ben Hutchings 3cfb537922 debian_linux.config: Drop import fallback for Python 2 compatibility 2017-01-07 18:06:06 +00:00
Ben Hutchings 48f370b3c2 debian_linux.gencontrol: Add support for arch-indep per-featureset packages 2016-12-01 19:49:59 +00:00
Ben Hutchings 619cd907a8 debian/lib/python/debian_linux/debian.py: Handle packages with only short descriptions 2016-07-14 11:41:47 +01:00
Ben Hutchings fb5d796272 Move merge_packages function from debian/bin/gencontrol.py to gencontrol module
linux-signed will use this function in future.
2016-06-08 23:24:07 +01:00
Ben Hutchings 581d83dbf0 debian_linux.utils._read_rfc822: Parse and ignore comments 2016-05-14 19:54:34 +01:00
Ben Hutchings d25555f798 debian_linux.debian: Add urgency attribute to Changelog.Entry objects 2016-05-06 21:33:06 +01:00
Ben Hutchings 7b9f22feef debian_linux.gencontrol: Allow variable substitutions in control.source.in
linux-signed may need this feature.
2016-04-04 10:41:48 +01:00
Ben Hutchings db948006fc debian.py: Really implement stable order of fields not in the predefined order 2016-01-08 12:15:30 +00:00
Ben Hutchings dc3b21cc1a debian.py: Implement stable order of fields in debian/tests/control
Move the field ordering control from the Package class to a new
superclass of Package and TestsControl.
2016-01-08 12:08:28 +00:00
Ben Hutchings 3d3a4891f7 debian/lib/python: Add support for package relation restrictions 2015-11-10 13:34:39 +00:00
Ben Hutchings f87229e26d debian/lib/python: Never merge package relations with a different version operator
This doesn't currently make any difference, but it's obviously wrong
to ignore the operator.
2015-11-10 13:34:00 +00:00
Ben Hutchings 5c869ad70b debian_linux.{debian,utils}: Support templates for debian/tests/control 2015-10-31 22:04:13 +00:00
Ben Hutchings 9c8d371306 debian_linux.utils: Support templates for RFC822 files other than debian/control 2015-10-31 22:04:13 +00:00
Ben Hutchings 0b7b6d7a62 debian/control: Make field ordering consistent again
This regressed when switching to Python 3 and not consistently
replacing use of iter*() methods.
2015-10-31 22:04:13 +00:00
Ben Hutchings 3d1b880497 debian/bin/kconfig.py: Adjust for compatibility with Python 3
Use open() instead of file().
Use dict.items() instead of .iteritems().
Use collections.OrderedDict.items() instead of .iteritems().
2015-08-30 21:43:02 +01:00
Ben Hutchings 6b977589fb debian/bin,debian/control,debian/lib/python: Use Python 3 2015-08-29 21:48:39 +01:00
Ben Hutchings d0824f1862 Add security update versions to regex and distribution/version sanity checks
Currently we don't allow versions like 3.16.7-ckt9-3~deb8u1~bpo7+1 in
*-backports, but we should!  Add the security suffix as an option
before the backports suffix.

We also don't check that an upload to *-security or *-lts includes the
expected suffix and nothing else.  Add a check for that.

svn path=/dists/trunk/linux/; revision=22539
2015-04-27 19:44:59 +00:00
Ben Hutchings e16e503620 Fix regex for the bpo version suffix
The Debian release is now identified by only the major version so
there need not be 2 digits directly after ~bpo.  Eventually the
major version will grow to 2 digits itself, so allow 1 or more
digits after the ~bpo.

svn path=/dists/trunk/linux/; revision=22538
2015-04-27 19:33:39 +00:00
Ben Hutchings ae85b67cf6 Add integer type to config schema
svn path=/dists/trunk/linux/; revision=22182
2014-12-10 16:37:07 +00:00
Ben Hutchings 86a13b0457 Add support for -ckt stable updates
svn path=/dists/sid/linux/; revision=22057
2014-11-08 15:41:20 +00:00
Ben Hutchings 6ceeb0fb7b Revert "Make version in package name independant of internal abi"
Unfortunately it is not sufficient to provide virtual packages
that exactly match the ABI name.  For example, 'reportbug kernel'
doesn't find the virtual package, and neither do dpkg commands
such as 'dpkg -l linux-image-$(uname -r)'.

svn path=/dists/sid/linux/; revision=22034
2014-11-04 04:47:19 +00:00
Bastian Blank cb080a3167 Make version in package name independant of internal abi
* debian/bin/gencontrol.py: Export internal ABI.
* debian/lib/python/debian_linux/debian.py: Export three-part version.
* debian/rules.real
  - Provide more variables.
  - Make udeb generation easier.
  - Use internal ABI for files.
* debian/templates/control.*: Provide name with internal ABI.
* debian/templates/image.plain.*: Use internal ABI.

svn path=/dists/sid/linux/; revision=22017
2014-11-01 19:20:16 +00:00
Bastian Blank f23e810882 debian/lib/python/debian_linux/gencontrol.py:
Allow numbers in templates.

svn path=/dists/sid/linux/; revision=22007
2014-10-31 15:05:54 +00:00