flake8 is broken on 24.04, this outright fails:
$ flake8 --ignore=E501 release-tools
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/flake8/plugins/finder.py", line 296, in _load_plugin
obj = plugin.entry_point.load()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/metadata/__init__.py", line 202, in load
module = import_module(match.group('module'))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/usr/lib/python3/dist-packages/flake8/plugins/pycodestyle.py", line 25, in <module>
from pycodestyle import missing_whitespace_around_operator as _missing_whitespace_around_operator # noqa: E501
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ImportError: cannot import name 'missing_whitespace_around_operator' from 'pycodestyle' (/usr/lib/python3/dist-packages/pycodestyle.py)
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
* release-tools: add support for NEWS.md changelog.py
* release-tools: add flake8 test and fix flake8 issue
* tests: add flake8/python3-bs4 to build-deps for the unit tests
* run-tests: do not write __pycache__ dir
Thanks to Maciej for sorting out the right format here, as we were using an
incorrect or inconsistent format for the past few releases, likely cargo
culting the first incorrect format that was introduced last year.
Also we should just always use UTC for this, so we can simplify the code
slightly.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
Somehow, on my system the %z format string was empty, resulting in the empty
string being used for the timezone, which does not match the expected format
for the opensuse changelog spec file. In this case, if we detect that there is
no timezone, use utc time and use the +0000 as the timezone.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
The LP bug for the release is different for every new major release, so we need
to specify this when generating the changelog.
We could eventually figure out what it should be for minor releases, but for
now just make it mandatory to specify it in the arguments to the script.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This just basically adds a basic templated header to the changelog entries and
makes the changelog entries align with proper markdown lists etc.
Eventually it would be super nice to be able to use the GitHub API to actually
create the release after it has been tagged and pushed, etc. with this included
automatically, but that will require an API key and also code, so it is left as
a future improvement.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
Use a more general regular expression with a capturing group to enable
modifying just the version number we need to change without needing the hackish
manual whitespace bits inserted as part of the version number to replace. This
also enables us to confirm that only one version modification was made to the
file whereas previously we could be accidentally modifying more than one line
without realizing it.
Also optimizing the reading and writing of files so we only read each file we
need once, modify it in a memory buffer, then write it back out once. This
should make the script faster and less likely to fail with half modified files
where only the version number was changed but not the changelog itself for
example with the Fedora spec file.
Thanks to Maciej for all the suggestions!
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This prevents us from accidentally writing partially incorrect changelog
entries if the changelog entry file is in the wrong format.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This is what all the cool python kids are doing these days :-)
Also make the signature for rewriteVersionNumberFile more obvious and add an
extra sanity check for the lines in the changelog entry.
Thanks to Alberto for the suggestions.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This script takes the new version number of snapd and a file which contains the
output from snappy-dch (most likely edited by hand to account for typos,
duplicated lines or weird messages due to squash merged prs) and will write out
the required changelog entries for ubuntu, debian, fedora, opensuse, and arch
in the packaging dir of snapd.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
The multipass bridge has an IP address we can use to tell virtual
machines where they can reach the packaging proxy. The query has been
improved based on feedback from additional environments.
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>