Remove patman from the U-Boot tree
cover Remove patman from the U-Boot tree
patman is now maintained as a standalone 'patch-manager' package, so remove it from the tree. The command becomes a stub that tells people to run 'pip install patch-manager'.
buildman still imports the shared modules commit and patchstream (along with their dependencies), so this series leaves those in place. It drops the tool's code, tests, CI hooks and packaging, and cuts the in-tree documentation down to a stub that points at the package. It also moves setuptools to u_boot_pylib, since pylibfdt needs it to build and patman's requirements currently supply it.
More could be done here: commit and patchstream (and their dependencies series, get_maintainer and settings) only remain because buildman still imports them. A follow-up could move those into u_boot_pylib (or buildman itself) and drop the rest, leaving tools/patman as just the stub.
Simon Glass (9):
patman: Replace the tool with a stub for patch-manager
patman: Remove the test suite
patman: Remove the patch-management code
u_boot_pylib: Require setuptools for building pylibfdt
patman: Replace the documentation with a stub
CI: Stop building and testing patman
tools: docker: Drop patman from the CI image
tools: Stop packaging patman as a pip module
test: Stop running the patman tests
.azure-pipelines.yml | 5 +- .gitlab-ci.yml | 7 +- Makefile | 1 - doc/develop/driver-model/spi-howto.rst | 5 +- doc/develop/patman.rst | 15 +- doc/develop/sending_patches.rst | 4 +- doc/develop/testing.rst | 2 +- scripts/make_pip.sh | 10 +- test/run | 1 - tools/binman/pyproject.toml | 2 +- tools/docker/Dockerfile | 2 - tools/patman/README.rst | 1 - tools/patman/__init__.py | 5 +- tools/patman/__main__.py | 68 +- tools/patman/checkpatch.py | 287 -- tools/patman/cmdline.py | 516 --- tools/patman/control.py | 333 -- tools/patman/cser_helper.py | 1524 ------- tools/patman/cseries.py | 1165 ------ tools/patman/database.py | 823 ---- tools/patman/func_test.py | 1342 ------ tools/patman/patchwork.py | 852 ---- tools/patman/patman.rst | 1023 ----- tools/patman/project.py | 27 - tools/patman/pyproject.toml | 29 - tools/patman/pytest.ini | 2 - tools/patman/requirements.txt | 6 - tools/patman/send.py | 197 - tools/patman/setup.py | 11 - tools/patman/status.py | 405 -- tools/patman/test/0000-cover-letter.patch | 23 - .../0001-pci-Correct-cast-for-sandbox.patch | 51 - ...-for-sandbox-in-fdtdec_setup_mem_siz.patch | 85 - tools/patman/test/test01.txt | 72 - tools/patman/test_checkpatch.py | 526 --- tools/patman/test_common.py | 254 -- tools/patman/test_cseries.py | 3684 ----------------- tools/patman/test_settings.py | 67 - tools/u_boot_pylib/requirements.txt | 2 + 39 files changed, 55 insertions(+), 13379 deletions(-) mode change 120000 => 100644 doc/develop/patman.rst delete mode 120000 tools/patman/README.rst delete mode 100644 tools/patman/checkpatch.py delete mode 100644 tools/patman/cmdline.py delete mode 100644 tools/patman/control.py delete mode 100644 tools/patman/cser_helper.py delete mode 100644 tools/patman/cseries.py delete mode 100644 tools/patman/database.py delete mode 100644 tools/patman/func_test.py delete mode 100644 tools/patman/patchwork.py delete mode 100644 tools/patman/patman.rst delete mode 100644 tools/patman/project.py delete mode 100644 tools/patman/pyproject.toml delete mode 100644 tools/patman/pytest.ini delete mode 100644 tools/patman/requirements.txt delete mode 100644 tools/patman/send.py delete mode 100644 tools/patman/setup.py delete mode 100644 tools/patman/status.py delete mode 100644 tools/patman/test/0000-cover-letter.patch delete mode 100644 tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch delete mode 100644 tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch delete mode 100644 tools/patman/test/test01.txt delete mode 100644 tools/patman/test_checkpatch.py delete mode 100644 tools/patman/test_common.py delete mode 100644 tools/patman/test_cseries.py delete mode 100644 tools/patman/test_settings.py
---
base-commit: 7c290d20cd8a9f3ae1700a0707c774e9b83f7f27
branch: patm
Signature · 1 line
2.43.0
PATCH 1/9 patman: Replace the tool with a stub for patch-manager
patman is now maintained as a standalone 'patch-manager' package, rather than in the U-Boot tree. Replace the command with a small stub which tells people how to install it.
buildman still uses the shared modules commit and patchstream (and their dependencies), so leave those in place; the patches that follow remove the patch-management code itself.
---
tools/patman/__main__.py | 68 +++++++++++++--------------------------- 1 file changed, 21 insertions(+), 47 deletions(-)
tools/patman/__main__.py +21 -47
@@ -4,56 +4,30 @@ # Copyright (c) 2011 The Chromium OS Authors. # -"""See README for more information""" +"""Stub for the former in-tree patman tool -import os -import sys - -# Allow 'from patman import xxx to work' -# pylint: disable=C0413 -our_path = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(our_path, '..')) - -# Our modules -from u_boot_pylib import test_util -from u_boot_pylib import tout -from patman import cmdline -from patman import control - - -def run_patman(): - """Run patamn +patman is now maintained as a standalone 'patch-manager' package, rather +than living in the U-Boot tree. This stub just tells the user how to get +it. +""" - This is the main program. It collects arguments and runs either the tests or - the control module. - """ - args = cmdline.parse_args() - - if not args.debug: - sys.tracebacklimit = 0 - - tout.init(tout.INFO if args.verbose else tout.WARNING) - - # Run our reasonably good tests - if args.cmd == 'test': - # pylint: disable=C0415 - from patman import func_test - from patman import test_checkpatch - from patman import test_cseries +import sys - to_run = args.testname if args.testname not in [None, 'test'] else None - result = test_util.run_test_suites( - 'patman', False, args.verbose, args.no_capture, - args.test_preserve_dirs, None, to_run, None, - [test_checkpatch.TestPatch, func_test.TestFunctional, 'settings', - test_cseries.TestCseries]) - sys.exit(0 if result.wasSuccessful() else 1) - # Process commits, produce patches files, check them, email them - else: - exit_code = control.do_patman(args) - sys.exit(exit_code) +def main(): + """Print instructions for installing the patch-manager package""" + print( + 'patman is no longer part of U-Boot. It is now maintained as a\n' + "separate package called 'patch-manager'.\n" + '\n' + 'Install it with:\n' + '\n' + ' pip install patch-manager\n' + '\n' + 'Documentation: https://deinde.dev/patman\n', + file=sys.stderr) + return 1 -if __name__ == "__main__": - sys.exit(run_patman()) +if __name__ == '__main__': + sys.exit(main())
Signature · 1 line
2.43.0
Re: [PATCH 1/9] patman: Replace the tool with a stub for patch-manager
Quoted 9 lines · Simon Glass
patman is now maintained as a standalone 'patch-manager' package, rather than in the U-Boot tree. Replace the command with a small stub which tells people how to install it.
buildman still uses the shared modules commit and patchstream (and their dependencies), so leave those in place; the patches that follow remove the patch-management code itself.
Signed-off-by Simon Glass <[email protected]>
We shouldn't keep a stub here, we will tell people in the announcement where it's going and give existing users time to migrate.
Signature · 1 line
Tom
PATCH 2/9 patman: Remove the test suite
In reply to Simon GlassThese tests cover the patch-management functionality, which is being removed from the tree in favour of the standalone patch-manager package. Drop the tests and their data files.
---
tools/patman/func_test.py | 1342 ------ tools/patman/pytest.ini | 2 - tools/patman/test/0000-cover-letter.patch | 23 - .../0001-pci-Correct-cast-for-sandbox.patch | 51 - ...-for-sandbox-in-fdtdec_setup_mem_siz.patch | 85 - tools/patman/test/test01.txt | 72 - tools/patman/test_checkpatch.py | 526 --- tools/patman/test_common.py | 254 -- tools/patman/test_cseries.py | 3684 ----------------- tools/patman/test_settings.py | 67 - 10 files changed, 6106 deletions(-) delete mode 100644 tools/patman/func_test.py delete mode 100644 tools/patman/pytest.ini delete mode 100644 tools/patman/test/0000-cover-letter.patch delete mode 100644 tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch delete mode 100644 tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch delete mode 100644 tools/patman/test/test01.txt delete mode 100644 tools/patman/test_checkpatch.py delete mode 100644 tools/patman/test_common.py delete mode 100644 tools/patman/test_cseries.py delete mode 100644 tools/patman/test_settings.py
tools/patman/func_test.py deleted +0 -1342
@@ -1,1342 +0,0 @@ -# -*- coding: utf-8 -*- -# SPDX-License-Identifier: GPL-2.0+ -# -# Copyright 2017 Google, Inc -# - -"""Functional tests for checking that patman behaves correctly""" - -import asyncio -import contextlib -import os -import pathlib -import re -import shutil -import sys -import unittest - -import pygit2 - -from u_boot_pylib import command -from u_boot_pylib import gitutil -from u_boot_pylib import terminal -from u_boot_pylib import tools - -from patman.commit import Commit -from patman import control -from patman import patchstream -from patman.patchstream import PatchStream -from patman import patchwork -from patman import send -from patman.series import Series -from patman import status -from patman.test_common import TestCommon - -PATMAN_DIR = pathlib.Path(__file__).parent -TEST_DATA_DIR = PATMAN_DIR / 'test/' - - [email protected] -def directory_excursion(directory): - """Change directory to `directory` for a limited to the context block.""" - current = os.getcwd() - try: - os.chdir(directory) - yield - finally: - os.chdir(current) - - -class TestFunctional(unittest.TestCase, TestCommon): - """Functional tests for checking that patman behaves correctly""" - fred = 'Fred Bloggs <[email protected]>' - joe = 'Joe Bloggs <[email protected]>' - mary = 'Mary Bloggs <[email protected]>' - commits = None - patches = None - - def setUp(self): - TestCommon.setUp(self) - self.repo = None - self._patman_pathname = sys.argv[0] - self._patman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) - - def tearDown(self): - TestCommon.tearDown(self) - - @staticmethod - def _get_path(fname): - """Get the path to a test file - - Args: - fname (str): Filename to obtain - - Returns: - str: Full path to file in the test directory - """ - return TEST_DATA_DIR / fname - - @classmethod - def _get_text(cls, fname): - """Read a file as text - - Args: - fname (str): Filename to read - - Returns: - str: Contents of file - """ - return open(cls._get_path(fname), encoding='utf-8').read() - - @classmethod - def _get_patch_name(cls, subject): - """Get the filename of a patch given its subject - - Args: - subject (str): Patch subject - - Returns: - str: Filename for that patch - """ - fname = re.sub('[ :]', '-', subject) - return fname.replace('--', '-') - - def _create_patches_for_test(self, series): - """Create patch files for use by tests - - This copies patch files from the test directory as needed by the series - - Args: - series (Series): Series containing commits to convert - - Returns: - tuple: - str: Cover-letter filename, or None if none - fname_list: list of str, each a patch filename - """ - cover_fname = None - fname_list = [] - for i, commit in enumerate(series.commits): - clean_subject = self._get_patch_name(commit.subject) - src_fname = '%04d-%s.patch' % (i + 1, clean_subject[:52]) - fname = os.path.join(self.tmpdir, src_fname) - shutil.copy(self._get_path(src_fname), fname) - fname_list.append(fname) - if series.get('cover'): - src_fname = '0000-cover-letter.patch' - cover_fname = os.path.join(self.tmpdir, src_fname) - fname = os.path.join(self.tmpdir, src_fname) - shutil.copy(self._get_path(src_fname), fname) - - return cover_fname, fname_list - - def test_basic(self): - """Tests the basic flow of patman - - This creates a series from some hard-coded patches build from a simple - tree with the following metadata in the top commit: - - Series-to: u-boot - Series-prefix: RFC - Series-postfix: some-branch - Series-cc: Stefan Brüns <[email protected]> - Cover-letter-cc: Lord Mëlchett <[email protected]> - Series-version: 3 - Patch-cc: fred - Series-process-log: sort, uniq - Series-changes: 4 - - Some changes - - Multi - line - change - - Commit-changes: 2 - - Changes only for this commit - - Cover-changes: 4 - - Some notes for the cover letter - - Cover-letter: - test: A test patch series - This is a test of how the cover - letter - works - END - - and this in the first commit: - - Commit-changes: 2 - - second revision change - - Series-notes: - some notes - about some things - from the first commit - END - - Commit-notes: - Some notes about - the first commit - END - - with the following commands: - - git log -n2 --reverse >/path/to/tools/patman/test/test01.txt - git format-patch --subject-prefix RFC --cover-letter HEAD~2 - mv 00* /path/to/tools/patman/test - - It checks these aspects: - - git log can be processed by patchstream - - emailing patches uses the correct command - - CC file has information on each commit - - cover letter has the expected text and subject - - each patch has the correct subject - - dry-run information prints out correctly - - unicode is handled correctly - - Series-to, Series-cc, Series-prefix, Series-postfix, Cover-letter - - Cover-letter-cc, Series-version, Series-changes, Series-notes - - Commit-notes - """ - process_tags = True - ignore_bad_tags = False - stefan = (b'Stefan Br\xc3\xbcns <[email protected]>' - .decode('utf-8')) - rick = 'Richard III <[email protected]>' - mel = b'Lord M\xc3\xablchett <[email protected]>'.decode('utf-8') - add_maintainers = [stefan, rick] - dry_run = True - in_reply_to = mel - count = 2 - alias = { - 'fdt': ['simon'], - 'u-boot': ['[email protected]'], - 'simon': [self.leb], - 'fred': [self.fred], - 'joe': [self.joe], - } - - text = self._get_text('test01.txt') - series = patchstream.get_metadata_for_test(text) - series.base_commit = Commit('1a44532') - series.branch = 'mybranch' - cover_fname, args = self._create_patches_for_test(series) - get_maintainer_script = str(pathlib.Path(__file__).parent.parent.parent - / 'get_maintainer.pl') + ' --norolestats' - with terminal.capture() as out: - patchstream.fix_patches(series, args) - if cover_fname and series.get('cover'): - patchstream.insert_cover_letter(cover_fname, series, count) - series.DoChecks() - cc_file = series.MakeCcFile(process_tags, cover_fname, - not ignore_bad_tags, add_maintainers, - None, get_maintainer_script, alias) - cmd = gitutil.email_patches( - series, cover_fname, args, dry_run, not ignore_bad_tags, - cc_file, alias, in_reply_to=in_reply_to, thread=None) - series.ShowActions(args, cmd, process_tags, alias) - cc_lines = tools.read_file(cc_file, binary=False).splitlines() - os.remove(cc_file) - - itr = iter(out[0].getvalue().splitlines()) - self.assertEqual('Cleaned %s patches' % len(series.commits), - next(itr)) - self.assertEqual('Change log missing for v2', next(itr)) - self.assertEqual('Change log missing for v3', next(itr)) - self.assertEqual('Change log for unknown version v4', next(itr)) - self.assertEqual("Alias 'pci' not found", next(itr)) - while next(itr) != 'Cc processing complete': - pass - self.assertIn('Dry run', next(itr)) - self.assertEqual('', next(itr)) - self.assertIn('Send a total of %d patches' % count, next(itr)) - prev = next(itr) - for i in range(len(series.commits)): - self.assertEqual(' %s' % args[i], prev) - while True: - prev = next(itr) - if 'Cc:' not in prev: - break - self.assertEqual('To: [email protected]', prev) - self.assertEqual('Cc: %s' % stefan, next(itr)) - self.assertEqual('Version: 3', next(itr)) - self.assertEqual('Prefix:\t RFC', next(itr)) - self.assertEqual('Postfix:\t some-branch', next(itr)) - self.assertEqual('Cover: 4 lines', next(itr)) - self.assertEqual(' Cc: %s' % self.fred, next(itr)) - self.assertEqual(' Cc: %s' % self.joe, next(itr)) - self.assertEqual(' Cc: %s' % self.leb, - next(itr)) - self.assertEqual(' Cc: %s' % mel, next(itr)) - self.assertEqual(' Cc: %s' % rick, next(itr)) - expected = ('Git command: git send-email --annotate ' - '--in-reply-to="%s" --to [email protected] ' - '--cc "%s" --cc-cmd "%s send --cc-cmd %s" %s %s' - % (in_reply_to, stefan, sys.argv[0], cc_file, cover_fname, - ' '.join(args))) - self.assertEqual(expected, next(itr)) - - self.assertEqual(('%s %s\0%s' % (args[0], rick, stefan)), cc_lines[0]) - self.assertEqual( - '%s %s\0%s\0%s\0%s\0%s' % (args[1], self.fred, self.joe, self.leb, - rick, stefan), - cc_lines[1]) - - expected = ''' -This is a test of how the cover -letter -works - -some notes -about some things -from the first commit - -Changes in v4: -- Multi - line - change -- Some changes -- Some notes for the cover letter -- fdt: Correct cast for sandbox in fdtdec_setup_mem_size_base() - -Simon Glass (2): - pci: Correct cast for sandbox - fdt: Correct cast for sandbox in fdtdec_setup_mem_size_base() - - cmd/pci.c | 3 ++- - fs/fat/fat.c | 1 + - lib/efi_loader/efi_memory.c | 1 + - lib/fdtdec.c | 3 ++- - 4 files changed, 6 insertions(+), 2 deletions(-) - ---\x20 -2.7.4 - -base-commit: 1a44532 -branch: mybranch -''' - lines = tools.read_file(cover_fname, binary=False).splitlines() - self.assertEqual( - 'Subject: [RFC PATCH some-branch v3 0/2] test: A test patch series', - lines[3]) - self.assertEqual(expected.splitlines(), lines[7:]) - - for i, fname in enumerate(args): - lines = tools.read_file(fname, binary=False).splitlines() - subject = [line for line in lines if line.startswith('Subject')] - self.assertEqual('Subject: [RFC %d/%d]' % (i + 1, count), - subject[0][:18]) - - # Check that we got our commit notes - start = 0 - expected = '' - - if i == 0: - start = 17 - expected = '''--- -Some notes about -the first commit - -(no changes since v2) - -Changes in v2: -- second revision change''' - elif i == 1: - start = 17 - expected = '''--- - -Changes in v4: -- Multi - line - change -- New -- Some changes - -Changes in v2: -- Changes only for this commit''' - - if expected: - expected = expected.splitlines() - self.assertEqual(expected, lines[start:(start+len(expected))]) - - def test_base_commit(self): - """Test adding a base commit with no cover letter""" - orig_text = self._get_text('test01.txt') - pos = orig_text.index( - 'commit 5ab48490f03051875ab13d288a4bf32b507d76fd') - text = orig_text[:pos] - series = patchstream.get_metadata_for_test(text) - series.base_commit = Commit('1a44532') - series.branch = 'mybranch' - cover_fname, args = self._create_patches_for_test(series) - self.assertFalse(cover_fname) - with terminal.capture() as out: - patchstream.fix_patches(series, args, insert_base_commit=True) - self.assertEqual('Cleaned 1 patch\n', out[0].getvalue()) - lines = tools.read_file(args[0], binary=False).splitlines() - pos = lines.index('-- ') - - # We expect these lines at the end: - # -- (with trailing space) - # 2.7.4 - # (empty) - # base-commit: xxx - # branch: xxx - self.assertEqual('base-commit: 1a44532', lines[pos + 3]) - self.assertEqual('branch: mybranch', lines[pos + 4]) - - def test_branch(self): - """Test creating patches from a branch""" - repo = self.make_git_tree() - target = repo.lookup_reference('refs/heads/first') - # pylint doesn't seem to find this - # pylint: disable=E1101 - self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) - control.setup() - orig_dir = os.getcwd() - try: - os.chdir(self.tmpdir) - - # Check that it can detect the current branch - self.assertEqual(2, gitutil.count_commits_to_branch(None)) - col = terminal.Color() - with terminal.capture() as _: - _, cover_fname, patch_files = send.prepare_patches( - col, branch=None, count=-1, start=0, end=0, - ignore_binary=False, signoff=True) - self.assertIsNone(cover_fname) - self.assertEqual(2, len(patch_files)) - - # Check that it can detect a different branch - self.assertEqual(3, gitutil.count_commits_to_branch('second')) - with terminal.capture() as _: - _, cover_fname, patch_files = send.prepare_patches( - col, branch='second', count=-1, start=0, end=0, - ignore_binary=False, signoff=True) - self.assertIsNotNone(cover_fname) - self.assertEqual(3, len(patch_files)) - - cover = tools.read_file(cover_fname, binary=False) - lines = cover.splitlines()[-2:] - base = repo.lookup_reference('refs/heads/base').target - self.assertEqual(f'base-commit: {base}', lines[0]) - self.assertEqual('branch: second', lines[1]) - - # Make sure that the base-commit is not present when it is in the - # cover letter - for fname in patch_files: - self.assertNotIn(b'base-commit:', tools.read_file(fname)) - - # Check that it can skip patches at the end - with terminal.capture() as _: - _, cover_fname, patch_files = send.prepare_patches( - col, branch='second', count=-1, start=0, end=1, - ignore_binary=False, signoff=True) - self.assertIsNotNone(cover_fname) - self.assertEqual(2, len(patch_files)) - - cover = tools.read_file(cover_fname, binary=False) - lines = cover.splitlines()[-2:] - base2 = repo.lookup_reference('refs/heads/second') - ref = base2.peel(pygit2.GIT_OBJ_COMMIT).parents[0].parents[0].id - self.assertEqual(f'base-commit: {ref}', lines[0]) - self.assertEqual('branch: second', lines[1]) - finally: - os.chdir(orig_dir) - - def test_custom_get_maintainer_script(self): - """Validate that a custom get_maintainer script gets used.""" - self.make_git_tree() - with directory_excursion(self.tmpdir): - # Setup git. - os.environ['GIT_CONFIG_GLOBAL'] = '/dev/null' - os.environ['GIT_CONFIG_SYSTEM'] = '/dev/null' - tools.run('git', 'config', 'user.name', 'Dummy') - tools.run('git', 'config', 'user.email', '[email protected]') - tools.run('git', 'branch', 'upstream') - tools.run('git', 'branch', '--set-upstream-to=upstream') - - # Setup patman configuration. - tools.write_file('.patman', '[settings]\n' - 'get_maintainer_script: dummy-script.sh\n' - 'check_patch: False\n' - 'add_maintainers: True\n', binary=False) - tools.write_file('dummy-script.sh', - '#!/usr/bin/env python3\n' - 'print("[email protected]")\n', binary=False) - os.chmod('dummy-script.sh', 0x555) - tools.run('git', 'add', '.') - tools.run('git', 'commit', '-m', 'new commit') - - # Finally, do the test - with terminal.capture(): - output = tools.run(PATMAN_DIR / 'patman', '--dry-run') - # Assert the email address is part of the dry-run - # output. - self.assertIn('[email protected]', output) - - def test_tags(self): - """Test collection of tags in a patchstream""" - text = '''This is a patch - -Signed-off-by: Terminator -Reviewed-by: %s -Reviewed-by: %s -Tested-by: %s -''' % (self.joe, self.mary, self.leb) - pstrm = PatchStream.process_text(text) - self.assertEqual(pstrm.commit.rtags, { - 'Reviewed-by': {self.joe, self.mary}, - 'Tested-by': {self.leb}}) - - def test_invalid_tag(self): - """Test invalid tag in a patchstream""" - text = '''This is a patch - -Serie-version: 2 -''' - with self.assertRaises(ValueError) as exc: - PatchStream.process_text(text) - self.assertEqual("Line 3: Invalid tag = 'Serie-version: 2'", - str(exc.exception)) - - def test_missing_end(self): - """Test a missing END tag""" - text = '''This is a patch - -Cover-letter: -This is the title -missing END after this line -Signed-off-by: Fred -''' - pstrm = PatchStream.process_text(text) - self.assertEqual(["Missing 'END' in section 'cover'"], - pstrm.commit.warn) - - def test_missing_blank_line(self): - """Test a missing blank line after a tag""" - text = '''This is a patch - -Series-changes: 2 -- First line of changes -- Missing blank line after this line -Signed-off-by: Fred -''' - pstrm = PatchStream.process_text(text) - self.assertEqual(["Missing 'blank line' in section 'Series-changes'"], - pstrm.commit.warn) - - def test_invalid_commit_tag(self): - """Test an invalid Commit-xxx tag""" - text = '''This is a patch - -Commit-fred: testing -''' - pstrm = PatchStream.process_text(text) - self.assertEqual(["Line 3: Ignoring Commit-fred"], pstrm.commit.warn) - - def test_self_test(self): - """Test a tested by tag by this user""" - test_line = 'Tested-by: %[email protected]' % os.getenv('USER') - text = '''This is a patch - -%s -''' % test_line - pstrm = PatchStream.process_text(text) - self.assertEqual(["Ignoring '%s'" % test_line], pstrm.commit.warn) - - def test_space_before_tab(self): - """Test a space before a tab""" - text = '''This is a patch - -+ \tSomething -''' - pstrm = PatchStream.process_text(text) - self.assertEqual(["Line 3/0 has space before tab"], pstrm.commit.warn) - - def test_lines_after_test(self): - """Test detecting lines after TEST= line""" - text = '''This is a patch - -TEST=sometest -more lines -here -''' - pstrm = PatchStream.process_text(text) - self.assertEqual(["Found 2 lines after TEST="], pstrm.commit.warn) - - def test_blank_line_at_end(self): - """Test detecting a blank line at the end of a file""" - text = '''This is a patch - -diff --git a/lib/fdtdec.c b/lib/fdtdec.c -index c072e54..942244f 100644 ---- a/lib/fdtdec.c -+++ b/lib/fdtdec.c -@@ -1200,7 +1200,8 @@ int fdtdec_setup_mem_size_base(void) - \t} - - \tgd->ram_size = (phys_size_t)(res.end - res.start + 1); -- debug("%s: Initial DRAM size %llx\n", __func__, (u64)gd->ram_size); -+ debug("%s: Initial DRAM size %llx\n", __func__, -+ (unsigned long long)gd->ram_size); -+ -diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c - --- -2.7.4 - - ''' - pstrm = PatchStream.process_text(text) - self.assertEqual( - ["Found possible blank line(s) at end of file 'lib/fdtdec.c'"], - pstrm.commit.warn) - - def test_no_upstream(self): - """Test CountCommitsToBranch when there is no upstream""" - repo = self.make_git_tree() - target = repo.lookup_reference('refs/heads/base') - # pylint doesn't seem to find this - # pylint: disable=E1101 - self.repo.checkout(target, strategy=pygit2.GIT_CHECKOUT_FORCE) - - # Check that it can detect the current branch - orig_dir = os.getcwd() - try: - os.chdir(self.gitdir) - with self.assertRaises(ValueError) as exc: - gitutil.count_commits_to_branch(None) - self.assertIn( - "Failed to determine upstream: fatal: no upstream configured for branch 'base'", - str(exc.exception)) - finally: - os.chdir(orig_dir) - - def run_patman(self, *args): - """Run patman using the provided arguments - - This runs the patman executable from scratch, as opposed to calling - the control.do_patman() function. - - Args: - args (list of str): Arguments to pass (excluding argv[0]) - - Return: - CommandResult: Result of execution - """ - all_args = [self._patman_pathname] + list(args) - return command.run_one(*all_args, capture=True, capture_stderr=True) - - def test_full_help(self): - """Test getting full help""" - command.TEST_RESULT = None - result = self.run_patman('-H') - help_file = os.path.join(self._patman_dir, 'README.rst') - # Remove possible extraneous strings - extra = '::::::::::::::\n' + help_file + '\n::::::::::::::\n' - gothelp = result.stdout.replace(extra, '') - self.assertEqual(len(gothelp), os.path.getsize(help_file)) - self.assertEqual(0, len(result.stderr)) - self.assertEqual(0, result.return_code) - - def test_help(self): - """Test getting help with commands and arguments""" - command.TEST_RESULT = None - result = self.run_patman('-h') - self.assertTrue(len(result.stdout) > 1000) - self.assertEqual(0, len(result.stderr)) - self.assertEqual(0, result.return_code) - - @staticmethod - def _fake_patchwork(subpath): - """Fake Patchwork server for the function below - - This handles accessing a series, providing a list consisting of a - single patch - - Args: - subpath (str): URL subpath to use - """ - re_series = re.match(r'series/(\d*)/$', subpath) - if re_series: - series_num = re_series.group(1) - if series_num == '1234': - return {'patches': [ - {'id': '1', 'name': 'Some patch'}]} - raise ValueError('Fake Patchwork does not understand: %s' % subpath) - - def test_status_mismatch(self): - """Test Patchwork patches not matching the series""" - pwork = patchwork.Patchwork.for_testing(self._fake_patchwork) - with terminal.capture() as (_, err): - loop = asyncio.get_event_loop() - _, patches = loop.run_until_complete(status.check_status(1234, - pwork)) - status.check_patch_count(0, len(patches)) - self.assertIn('Warning: Patchwork reports 1 patches, series has 0', - err.getvalue()) - - def test_status_read_patch(self): - """Test handling a single patch in Patchwork""" - pwork = patchwork.Patchwork.for_testing(self._fake_patchwork) - loop = asyncio.get_event_loop() - _, patches = loop.run_until_complete(status.check_status(1234, pwork)) - self.assertEqual(1, len(patches)) - patch = patches[0] - self.assertEqual('1', patch.id) - self.assertEqual('Some patch', patch.raw_subject) - - def test_parse_subject(self): - """Test parsing of the patch subject""" - patch = patchwork.Patch('1') - - # Simple patch not in a series - patch.parse_subject('Testing') - self.assertEqual('Testing', patch.raw_subject) - self.assertEqual('Testing', patch.subject) - self.assertEqual(1, patch.seq) - self.assertEqual(1, patch.count) - self.assertEqual(None, patch.prefix) - self.assertEqual(None, patch.version) - - # First patch in a series - patch.parse_subject('[1/2] Testing') - self.assertEqual('[1/2] Testing', patch.raw_subject) - self.assertEqual('Testing', patch.subject) - self.assertEqual(1, patch.seq) - self.assertEqual(2, patch.count) - self.assertEqual(None, patch.prefix) - self.assertEqual(None, patch.version) - - # Second patch in a series - patch.parse_subject('[2/2] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(2, patch.seq) - self.assertEqual(2, patch.count) - self.assertEqual(None, patch.prefix) - self.assertEqual(None, patch.version) - - # With PATCH prefix - patch.parse_subject('[PATCH,2/5] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(2, patch.seq) - self.assertEqual(5, patch.count) - self.assertEqual('PATCH', patch.prefix) - self.assertEqual(None, patch.version) - - # RFC patch - patch.parse_subject('[RFC,3/7] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(3, patch.seq) - self.assertEqual(7, patch.count) - self.assertEqual('RFC', patch.prefix) - self.assertEqual(None, patch.version) - - # Version patch - patch.parse_subject('[v2,3/7] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(3, patch.seq) - self.assertEqual(7, patch.count) - self.assertEqual(None, patch.prefix) - self.assertEqual('v2', patch.version) - - # All fields - patch.parse_subject('[RESEND,v2,3/7] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(3, patch.seq) - self.assertEqual(7, patch.count) - self.assertEqual('RESEND', patch.prefix) - self.assertEqual('v2', patch.version) - - # RFC only - patch.parse_subject('[RESEND] Testing') - self.assertEqual('Testing', patch.subject) - self.assertEqual(1, patch.seq) - self.assertEqual(1, patch.count) - self.assertEqual('RESEND', patch.prefix) - self.assertEqual(None, patch.version) - - def test_compare_series(self): - """Test operation of compare_with_series()""" - commit1 = Commit('abcd') - commit1.subject = 'Subject 1' - commit2 = Commit('ef12') - commit2.subject = 'Subject 2' - commit3 = Commit('3456') - commit3.subject = 'Subject 2' - - patch1 = patchwork.Patch('1') - patch1.subject = 'Subject 1' - patch2 = patchwork.Patch('2') - patch2.subject = 'Subject 2' - patch3 = patchwork.Patch('3') - patch3.subject = 'Subject 2' - - series = Series() - series.commits = [commit1] - patches = [patch1] - patch_for_commit, commit_for_patch, warnings = ( - status.compare_with_series(series, patches)) - self.assertEqual(1, len(patch_for_commit)) - self.assertEqual(patch1, patch_for_commit[0]) - self.assertEqual(1, len(commit_for_patch)) - self.assertEqual(commit1, commit_for_patch[0]) - - series.commits = [commit1] - patches = [patch1, patch2] - patch_for_commit, commit_for_patch, warnings = ( - status.compare_with_series(series, patches)) - self.assertEqual(1, len(patch_for_commit)) - self.assertEqual(patch1, patch_for_commit[0]) - self.assertEqual(1, len(commit_for_patch)) - self.assertEqual(commit1, commit_for_patch[0]) - self.assertEqual(["Cannot find commit for patch 2 ('Subject 2')"], - warnings) - - series.commits = [commit1, commit2] - patches = [patch1] - patch_for_commit, commit_for_patch, warnings = ( - status.compare_with_series(series, patches)) - self.assertEqual(1, len(patch_for_commit)) - self.assertEqual(patch1, patch_for_commit[0]) - self.assertEqual(1, len(commit_for_patch)) - self.assertEqual(commit1, commit_for_patch[0]) - self.assertEqual(["Cannot find patch for commit 2 ('Subject 2')"], - warnings) - - series.commits = [commit1, commit2, commit3] - patches = [patch1, patch2] - patch_for_commit, commit_for_patch, warnings = ( - status.compare_with_series(series, patches)) - self.assertEqual(2, len(patch_for_commit)) - self.assertEqual(patch1, patch_for_commit[0]) - self.assertEqual(patch2, patch_for_commit[1]) - self.assertEqual(1, len(commit_for_patch)) - self.assertEqual(commit1, commit_for_patch[0]) - self.assertEqual(["Cannot find patch for commit 3 ('Subject 2')", - "Multiple commits match patch 2 ('Subject 2'):\n" - ' Subject 2\n Subject 2'], - warnings) - - series.commits = [commit1, commit2] - patches = [patch1, patch2, patch3] - patch_for_commit, commit_for_patch, warnings = ( - status.compare_with_series(series, patches)) - self.assertEqual(1, len(patch_for_commit)) - self.assertEqual(patch1, patch_for_commit[0]) - self.assertEqual(2, len(commit_for_patch)) - self.assertEqual(commit1, commit_for_patch[0]) - self.assertEqual(["Multiple patches match commit 2 ('Subject 2'):\n" - ' Subject 2\n Subject 2', - "Cannot find commit for patch 3 ('Subject 2')"], - warnings) - - def _fake_patchwork2(self, subpath): - """Fake Patchwork server for the function below - - This handles accessing series, patches and comments, providing the data - in self.patches to the caller - - Args: - subpath (str): URL subpath to use - """ - re_series = re.match(r'series/(\d*)/$', subpath) - re_patch = re.match(r'patches/(\d*)/$', subpath) - re_comments = re.match(r'patches/(\d*)/comments/$', subpath) - if re_series: - series_num = re_series.group(1) - if series_num == '1234': - return {'patches': self.patches} - elif re_patch: - patch_num = int(re_patch.group(1)) - patch = self.patches[patch_num - 1] - return patch - elif re_comments: - patch_num = int(re_comments.group(1)) - patch = self.patches[patch_num - 1] - return patch.comments - raise ValueError('Fake Patchwork does not understand: %s' % subpath) - - def test_find_new_responses(self): - """Test operation of find_new_responses()""" - commit1 = Commit('abcd') - commit1.subject = 'Subject 1' - commit2 = Commit('ef12') - commit2.subject = 'Subject 2' - - patch1 = patchwork.Patch('1') - patch1.parse_subject('[1/2] Subject 1') - patch1.name = patch1.raw_subject - patch1.content = 'This is my patch content' - comment1a = {'content': 'Reviewed-by: %s\n' % self.joe} - - patch1.comments = [comment1a] - - patch2 = patchwork.Patch('2') - patch2.parse_subject('[2/2] Subject 2') - patch2.name = patch2.raw_subject - patch2.content = 'Some other patch content' - comment2a = { - 'content': 'Reviewed-by: %s\nTested-by: %s\n' % - (self.mary, self.leb)} - comment2b = {'content': 'Reviewed-by: %s' % self.fred} - patch2.comments = [comment2a, comment2b] - - # This test works by setting up commits and patch for use by the fake - # Rest API function _fake_patchwork2(). It calls various functions in - # the status module after setting up tags in the commits, checking that - # things behaves as expected - self.commits = [commit1, commit2] - self.patches = [patch1, patch2] - - # Check that the tags are picked up on the first patch - new_rtags, _ = status.process_reviews(patch1.content, patch1.comments, - commit1.rtags) - self.assertEqual(new_rtags, {'Reviewed-by': {self.joe}}) - - # Now the second patch - new_rtags, _ = status.process_reviews(patch2.content, patch2.comments, - commit2.rtags) - self.assertEqual(new_rtags, { - 'Reviewed-by': {self.mary, self.fred}, - 'Tested-by': {self.leb}}) - - # Now add some tags to the commit, which means they should not appear as - # 'new' tags when scanning comments - commit1.rtags = {'Reviewed-by': {self.joe}} - new_rtags, _ = status.process_reviews(patch1.content, patch1.comments, - commit1.rtags) - self.assertEqual(new_rtags, {}) - - # For the second commit, add Ed and Fred, so only Mary should be left - commit2.rtags = { - 'Tested-by': {self.leb}, - 'Reviewed-by': {self.fred}} - new_rtags, _ = status.process_reviews(patch2.content, patch2.comments, - commit2.rtags) - self.assertEqual(new_rtags, {'Reviewed-by': {self.mary}}) - - # Check that the output patches expectations: - # 1 Subject 1 - # Reviewed-by: Joe Bloggs <[email protected]> - # 2 Subject 2 - # Tested-by: Lord Edmund Blackaddër <[email protected]> - # Reviewed-by: Fred Bloggs <[email protected]> - # + Reviewed-by: Mary Bloggs <[email protected]> - # 1 new response available in patchwork - - series = Series() - series.commits = [commit1, commit2] - terminal.set_print_test_mode() - pwork = patchwork.Patchwork.for_testing(self._fake_patchwork2) - status.check_and_show_status(series, '1234', None, None, False, False, - False, pwork) - itr = iter(terminal.get_print_test_lines()) - col = terminal.Color() - self.assertEqual(terminal.PrintLine(' 1 Subject 1', col.YELLOW), - next(itr)) - self.assertEqual( - terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, - bright=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.joe, col.WHITE, bright=False), - next(itr)) - - self.assertEqual(terminal.PrintLine(' 2 Subject 2', col.YELLOW), - next(itr)) - self.assertEqual( - terminal.PrintLine(' Reviewed-by: ', col.GREEN, newline=False, - bright=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.fred, col.WHITE, - bright=False), next(itr)) - self.assertEqual( - terminal.PrintLine(' Tested-by: ', col.GREEN, newline=False, - bright=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.leb, col.WHITE, bright=False), - next(itr)) - self.assertEqual( - terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.mary, col.WHITE), - next(itr)) - self.assertEqual(terminal.PrintLine( - '1 new response available in patchwork (use -d to write them to a new branch)', - None), next(itr)) - - def _fake_patchwork3(self, subpath): - """Fake Patchwork server for the function below - - This handles accessing series, patches and comments, providing the data - in self.patches to the caller - - Args: - subpath (str): URL subpath to use - """ - re_series = re.match(r'series/(\d*)/$', subpath) - re_patch = re.match(r'patches/(\d*)/$', subpath) - re_comments = re.match(r'patches/(\d*)/comments/$', subpath) - if re_series: - series_num = re_series.group(1) - if series_num == '1234': - return {'patches': self.patches} - elif re_patch: - patch_num = int(re_patch.group(1)) - patch = self.patches[patch_num - 1] - return patch - elif re_comments: - patch_num = int(re_comments.group(1)) - patch = self.patches[patch_num - 1] - return patch.comments - raise ValueError('Fake Patchwork does not understand: %s' % subpath) - - def test_create_branch(self): - """Test operation of create_branch()""" - repo = self.make_git_tree() - branch = 'first' - dest_branch = 'first2' - count = 2 - gitdir = self.gitdir - - # Set up the test git tree. We use branch 'first' which has two commits - # in it - series = patchstream.get_metadata_for_list(branch, gitdir, count) - self.assertEqual(2, len(series.commits)) - - patch1 = patchwork.Patch('1') - patch1.parse_subject('[1/2] %s' % series.commits[0].subject) - patch1.name = patch1.raw_subject - patch1.content = 'This is my patch content' - comment1a = {'content': 'Reviewed-by: %s\n' % self.joe} - - patch1.comments = [comment1a] - - patch2 = patchwork.Patch('2') - patch2.parse_subject('[2/2] %s' % series.commits[1].subject) - patch2.name = patch2.raw_subject - patch2.content = 'Some other patch content' - comment2a = { - 'content': 'Reviewed-by: %s\nTested-by: %s\n' % - (self.mary, self.leb)} - comment2b = { - 'content': 'Reviewed-by: %s' % self.fred} - patch2.comments = [comment2a, comment2b] - - # This test works by setting up patches for use by the fake Rest API - # function _fake_patchwork3(). The fake patch comments above should - # result in new review tags that are collected and added to the commits - # created in the destination branch. - self.patches = [patch1, patch2] - count = 2 - - # Expected output: - # 1 i2c: I2C things - # + Reviewed-by: Joe Bloggs <[email protected]> - # 2 spi: SPI fixes - # + Reviewed-by: Fred Bloggs <[email protected]> - # + Reviewed-by: Mary Bloggs <[email protected]> - # + Tested-by: Lord Edmund Blackaddër <[email protected]> - # 4 new responses available in patchwork - # 4 responses added from patchwork into new branch 'first2' - # <unittest.result.TestResult run=8 errors=0 failures=0> - - terminal.set_print_test_mode() - pwork = patchwork.Patchwork.for_testing(self._fake_patchwork3) - status.check_and_show_status( - series, '1234', branch, dest_branch, False, False, False, pwork, - repo) - lines = terminal.get_print_test_lines() - self.assertEqual(12, len(lines)) - self.assertEqual( - "4 responses added from patchwork into new branch 'first2'", - lines[11].text) - - # Check that the destination branch has the new tags - new_series = patchstream.get_metadata_for_list(dest_branch, gitdir, - count) - self.assertEqual( - {'Reviewed-by': {self.joe}}, - new_series.commits[0].rtags) - self.assertEqual( - {'Tested-by': {self.leb}, - 'Reviewed-by': {self.fred, self.mary}}, - new_series.commits[1].rtags) - - # Now check the actual test of the first commit message. We expect to - # see the new tags immediately below the old ones. - stdout = patchstream.get_list(dest_branch, count=count, git_dir=gitdir) - itr = iter([line.strip() for line in stdout.splitlines() - if '-by:' in line]) - - # First patch should have the review tag - self.assertEqual('Reviewed-by: %s' % self.joe, next(itr)) - - # Second patch should have the sign-off then the tested-by and two - # reviewed-by tags - self.assertEqual('Signed-off-by: %s' % self.leb, next(itr)) - self.assertEqual('Reviewed-by: %s' % self.fred, next(itr)) - self.assertEqual('Reviewed-by: %s' % self.mary, next(itr)) - self.assertEqual('Tested-by: %s' % self.leb, next(itr)) - - def test_parse_snippets(self): - """Test parsing of review snippets""" - text = '''Hi Fred, - -This is a comment from someone. - -Something else - -On some recent date, Fred wrote: -> This is why I wrote the patch -> so here it is - -Now a comment about the commit message -A little more to say - -Even more - -> diff --git a/file.c b/file.c -> Some more code -> Code line 2 -> Code line 3 -> Code line 4 -> Code line 5 -> Code line 6 -> Code line 7 -> Code line 8 -> Code line 9 - -And another comment - -> @@ -153,8 +143,13 @@ def check_patch(fname, show_types=False): -> further down on the file -> and more code -> +Addition here -> +Another addition here -> codey -> more codey - -and another thing in same file - -> @@ -253,8 +243,13 @@ -> with no function context - -one more thing - -> diff --git a/tools/patman/main.py b/tools/patman/main.py -> +line of code -now a very long comment in a different file -line2 -line3 -line4 -line5 -line6 -line7 -line8 -''' - pstrm = PatchStream.process_text(text, True) - self.assertEqual([], pstrm.commit.warn) - - # We expect to the filename and up to 5 lines of code context before - # each comment. The 'On xxx wrote:' bit should be removed. - self.assertEqual( - [['Hi Fred,', - 'This is a comment from someone.', - 'Something else'], - ['> This is why I wrote the patch', - '> so here it is', - 'Now a comment about the commit message', - 'A little more to say', 'Even more'], - ['> File: file.c', '> Code line 5', '> Code line 6', - '> Code line 7', '> Code line 8', '> Code line 9', - 'And another comment'], - ['> File: file.c', - '> Line: 153 / 143: def check_patch(fname, show_types=False):', - '> and more code', '> +Addition here', - '> +Another addition here', '> codey', '> more codey', - 'and another thing in same file'], - ['> File: file.c', '> Line: 253 / 243', - '> with no function context', 'one more thing'], - ['> File: tools/patman/main.py', '> +line of code', - 'now a very long comment in a different file', - 'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']], - pstrm.snippets) - - def test_review_snippets(self): - """Test showing of review snippets""" - def _to_submitter(who): - m_who = re.match('(.*) <(.*)>', who) - return { - 'name': m_who.group(1), - 'email': m_who.group(2) - } - - commit1 = Commit('abcd') - commit1.subject = 'Subject 1' - commit2 = Commit('ef12') - commit2.subject = 'Subject 2' - - patch1 = patchwork.Patch('1') - patch1.parse_subject('[1/2] Subject 1') - patch1.name = patch1.raw_subject - patch1.content = 'This is my patch content' - comment1a = {'submitter': _to_submitter(self.joe), - 'content': '''Hi Fred, - -On some date Fred wrote: - -> diff --git a/file.c b/file.c -> Some code -> and more code - -Here is my comment above the above... - - -Reviewed-by: %s -''' % self.joe} - - patch1.comments = [comment1a] - - patch2 = patchwork.Patch('2') - patch2.parse_subject('[2/2] Subject 2') - patch2.name = patch2.raw_subject - patch2.content = 'Some other patch content' - comment2a = { - 'content': 'Reviewed-by: %s\nTested-by: %s\n' % - (self.mary, self.leb)} - comment2b = {'submitter': _to_submitter(self.fred), - 'content': '''Hi Fred, - -On some date Fred wrote: - -> diff --git a/tools/patman/commit.py b/tools/patman/commit.py -> @@ -41,6 +41,9 @@ class Commit: -> self.rtags = collections.defaultdict(set) -> self.warn = [] -> -> + def __str__(self): -> + return self.subject -> + -> def add_change(self, version, info): -> """Add a new change line to the change list for a version. -> -A comment - -Reviewed-by: %s -''' % self.fred} - patch2.comments = [comment2a, comment2b] - - # This test works by setting up commits and patch for use by the fake - # Rest API function _fake_patchwork2(). It calls various functions in - # the status module after setting up tags in the commits, checking that - # things behaves as expected - self.commits = [commit1, commit2] - self.patches = [patch1, patch2] - - # Check that the output patches expectations: - # 1 Subject 1 - # Reviewed-by: Joe Bloggs <[email protected]> - # 2 Subject 2 - # Tested-by: Lord Edmund Blackaddër <[email protected]> - # Reviewed-by: Fred Bloggs <[email protected]> - # + Reviewed-by: Mary Bloggs <[email protected]> - # 1 new response available in patchwork - - series = Series() - series.commits = [commit1, commit2] - terminal.set_print_test_mode() - pwork = patchwork.Patchwork.for_testing(self._fake_patchwork2) - status.check_and_show_status( - series, '1234', None, None, False, True, False, pwork) - itr = iter(terminal.get_print_test_lines()) - col = terminal.Color() - self.assertEqual(terminal.PrintLine(' 1 Subject 1', col.YELLOW), - next(itr)) - self.assertEqual( - terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.joe, col.WHITE), next(itr)) - - self.assertEqual(terminal.PrintLine('Review: %s' % self.joe, col.RED), - next(itr)) - self.assertEqual(terminal.PrintLine(' Hi Fred,', None), next(itr)) - self.assertEqual(terminal.PrintLine('', None), next(itr)) - self.assertEqual(terminal.PrintLine(' > File: file.c', col.MAGENTA), - next(itr)) - self.assertEqual(terminal.PrintLine(' > Some code', col.MAGENTA), - next(itr)) - self.assertEqual(terminal.PrintLine(' > and more code', - col.MAGENTA), - next(itr)) - self.assertEqual(terminal.PrintLine( - ' Here is my comment above the above...', None), next(itr)) - self.assertEqual(terminal.PrintLine('', None), next(itr)) - - self.assertEqual(terminal.PrintLine(' 2 Subject 2', col.YELLOW), - next(itr)) - self.assertEqual( - terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.fred, col.WHITE), - next(itr)) - self.assertEqual( - terminal.PrintLine(' + Reviewed-by: ', col.GREEN, newline=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.mary, col.WHITE), - next(itr)) - self.assertEqual( - terminal.PrintLine(' + Tested-by: ', col.GREEN, newline=False), - next(itr)) - self.assertEqual(terminal.PrintLine(self.leb, col.WHITE), - next(itr)) - - self.assertEqual(terminal.PrintLine('Review: %s' % self.fred, col.RED), - next(itr)) - self.assertEqual(terminal.PrintLine(' Hi Fred,', None), next(itr)) - self.assertEqual(terminal.PrintLine('', None), next(itr)) - self.assertEqual(terminal.PrintLine( - ' > File: tools/patman/commit.py', col.MAGENTA), next(itr)) - self.assertEqual(terminal.PrintLine( - ' > Line: 41 / 41: class Commit:', col.MAGENTA), next(itr)) - self.assertEqual(terminal.PrintLine( - ' > + return self.subject', col.MAGENTA), next(itr)) - self.assertEqual(terminal.PrintLine( - ' > +', col.MAGENTA), next(itr)) - self.assertEqual( - terminal.PrintLine( - ' > def add_change(self, version, info):', - col.MAGENTA), - next(itr)) - self.assertEqual(terminal.PrintLine( - ' > """Add a new change line to the change list for a version.', - col.MAGENTA), next(itr)) - self.assertEqual(terminal.PrintLine( - ' >', col.MAGENTA), next(itr)) - self.assertEqual(terminal.PrintLine( - ' A comment', None), next(itr)) - self.assertEqual(terminal.PrintLine('', None), next(itr)) - - self.assertEqual(terminal.PrintLine( - '4 new responses available in patchwork (use -d to write them to a new branch)', - None), next(itr)) - - def test_insert_tags(self): - """Test inserting of review tags""" - msg = '''first line -second line.''' - tags = [ - 'Reviewed-by: Bin Meng <[email protected]>', - 'Tested-by: Bin Meng <[email protected]>' - ] - signoff = 'Signed-off-by: Simon Glass <[email protected]>' - tag_str = '\n'.join(tags) - - new_msg = patchstream.insert_tags(msg, tags) - self.assertEqual(msg + '\n\n' + tag_str, new_msg) - - new_msg = patchstream.insert_tags(msg + '\n', tags) - self.assertEqual(msg + '\n\n' + tag_str, new_msg) - - msg += '\n\n' + signoff - new_msg = patchstream.insert_tags(msg, tags) - self.assertEqual(msg + '\n' + tag_str, new_msg)
tools/patman/pytest.ini deleted +0 -2
@@ -1,2 +0,0 @@ -[pytest] -addopts = --doctest-modules
tools/patman/test/0000-cover-letter.patch deleted +0 -23
@@ -1,23 +0,0 @@ -From 5ab48490f03051875ab13d288a4bf32b507d76fd Mon Sep 17 00:00:00 2001 -From: Simon Glass <[email protected]> -Date: Sat, 27 May 2017 20:52:11 -0600 -Subject: [RFC 0/2] *** SUBJECT HERE *** -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -*** BLURB HERE *** - -Simon Glass (2): - pci: Correct cast for sandbox - fdt: Correct cast for sandbox in fdtdec_setup_mem_size_base() - - cmd/pci.c | 3 ++- - fs/fat/fat.c | 1 + - lib/efi_loader/efi_memory.c | 1 + - lib/fdtdec.c | 3 ++- - 4 files changed, 6 insertions(+), 2 deletions(-) - --- -2.7.4 -
tools/patman/test/0001-pci-Correct-cast-for-sandbox.patch deleted +0 -51
51 lines not on this page · raw message
tools/patman/test/0002-fdt-Correct-cast-for-sandbox-in-fdtdec_setup_mem_siz.patch deleted +0 -85
85 lines not on this page · raw message
tools/patman/test/test01.txt deleted +0 -72
72 lines not on this page · raw message
tools/patman/test_checkpatch.py deleted +0 -526
526 lines not on this page · raw message
tools/patman/test_common.py deleted +0 -254
254 lines not on this page · raw message
tools/patman/test_cseries.py deleted +0 -3684
645 lines not on this page · raw message
tools/patman/test_settings.py deleted +0 -67
67 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH 3/9 patman: Remove the patch-management code
In reply to Simon GlassDelete the command-line tool and its supporting modules, now that this functionality lives in the standalone patch-manager package.
Keep the modules that buildman still imports (commit and patchstream, plus their dependencies series, get_maintainer and settings), along with the stub command. Trim __init__.py to match.
---
tools/patman/__init__.py | 5 +- tools/patman/checkpatch.py | 287 ------- tools/patman/cmdline.py | 516 ------------ tools/patman/control.py | 333 -------- tools/patman/cser_helper.py | 1524 ----------------------------------- tools/patman/cseries.py | 1165 -------------------------- tools/patman/database.py | 823 ------------------- tools/patman/patchwork.py | 852 -------------------- tools/patman/project.py | 27 - tools/patman/send.py | 197 ----- tools/patman/status.py | 405 ---------- 11 files changed, 1 insertion(+), 6133 deletions(-) delete mode 100644 tools/patman/checkpatch.py delete mode 100644 tools/patman/cmdline.py delete mode 100644 tools/patman/control.py delete mode 100644 tools/patman/cser_helper.py delete mode 100644 tools/patman/cseries.py delete mode 100644 tools/patman/database.py delete mode 100644 tools/patman/patchwork.py delete mode 100644 tools/patman/project.py delete mode 100644 tools/patman/send.py delete mode 100644 tools/patman/status.py
tools/patman/__init__.py +1 -4
@@ -1,8 +1,5 @@ # SPDX-License-Identifier: GPL-2.0+ __all__ = [ - 'checkpatch', 'cmdline', 'commit', 'control', 'cser_helper', 'cseries', - 'database', 'func_test', 'get_maintainer', '__main__', 'patchstream', - 'patchwork', 'project', 'send', 'series', 'settings', 'setup', 'status', - 'test_checkpatch', 'test_common', 'test_cseries', 'test_settings' + 'commit', 'get_maintainer', 'patchstream', 'series', 'settings', ]
tools/patman/checkpatch.py deleted +0 -287
287 lines not on this page · raw message
tools/patman/cmdline.py deleted +0 -516
516 lines not on this page · raw message
tools/patman/control.py deleted +0 -333
333 lines not on this page · raw message
tools/patman/cser_helper.py deleted +0 -1524
1,524 lines not on this page · raw message
tools/patman/cseries.py deleted +0 -1165
331 lines not on this page · raw message
tools/patman/database.py deleted +0 -823
823 lines not on this page · raw message
tools/patman/patchwork.py deleted +0 -852
852 lines not on this page · raw message
tools/patman/send.py deleted +0 -197
197 lines not on this page · raw message
tools/patman/status.py deleted +0 -405
405 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
PATCH 4/9 u_boot_pylib: Require setuptools for building pylibfdt
In reply to Simon GlassBuilding the pylibfdt bindings (scripts/dtc/pylibfdt/setup.py) needs setuptools. In the tree this comes only from patman's requirements.txt, which a later patch removes.
Add setuptools to u_boot_pylib's requirements instead, where it is available to every tool that builds pylibfdt.
---
tools/u_boot_pylib/requirements.txt | 2 ++ 1 file changed, 2 insertions(+)
tools/u_boot_pylib/requirements.txt +2 -0
@@ -1 +1,3 @@ concurrencytest==0.1.2 +# Needed to build the pylibfdt bindings (scripts/dtc/pylibfdt/setup.py) +setuptools==78.1.1
Signature · 1 line
2.43.0
Re: [PATCH 4/9] u_boot_pylib: Require setuptools for building pylibfdt
Quoted 18 lines · Simon Glass
Building the pylibfdt bindings (
scripts/dtc/pylibfdt/setup.py) needs setuptools. In the tree this comes only from patman's requirements.txt, which a later patch removes.Add setuptools to u_boot_pylib's requirements instead, where it is available to every tool that builds pylibfdt.
Signed-off-by Simon Glass <[email protected]>---
tools/u_boot_pylib/requirements.txt | 2 ++ 1 file changed, 2 insertions(+)tools/u_boot_pylib/requirements.txt +0
-0
tools/u_boot_pylib/requirements.txt line 3
Quoted 3 lines
tools/u_boot_pylib/requirements.txt +2
-0@@ -1 +1,3 @@ concurrencytest==0.1.2 +# Needed to build the pylibfdt bindings (scripts/dtc/pylibfdt/setup.py) +setuptools==78.1.1
This is covered by scripts/dtc/pylibfdt/requirements.txt already and is what should be used when pylibfdt bindings are needed. This does likely mean the CI jobs have been omitting this as patman was pulling it in.
Signature · 1 line
Tom
PATCH 5/9 patman: Replace the documentation with a stub
In reply to Simon GlassThe full patman manual now lives with the standalone patch-manager package, making the 1000-line copy in the tree redundant. Its published page is a long-standing URL, though, so removing it outright would break existing links.
Replace the in-tree manual with a short stub that points readers at the patch-manager package, and keep the toctree entry so the page still builds. Drop the README and the tool's own rst, and point the patch-sending docs at the standalone package too.
---
doc/develop/driver-model/spi-howto.rst | 5 +- doc/develop/patman.rst | 15 +- doc/develop/sending_patches.rst | 4 +- tools/patman/README.rst | 1 - tools/patman/patman.rst | 1023 ------------------------ 5 files changed, 20 insertions(+), 1028 deletions(-) mode change 120000 => 100644 doc/develop/patman.rst delete mode 120000 tools/patman/README.rst delete mode 100644 tools/patman/patman.rst
doc/develop/driver-model/spi-howto.rst +3 -2
@@ -649,8 +649,9 @@ board. Prepare patches and send them to the mailing lists -------------------------------------------------- -You can use 'tools/patman/patman' to prepare, check and send patches for -your work. See tools/patman/README for details. +You can use the patman tool to prepare, check and send patches for your work. +Install it with ``pip install patch-manager``; see the +`patman documentation <https://deinde.dev/patman>`_. A little note about SPI uclass features ---------------------------------------
doc/develop/patman.rst deleted +0 -1
@@ -1 +0,0 @@ -../../tools/patman/patman.rst
doc/develop/patman.rst new file +14 -0
@@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +patman +====== + +patman is no longer part of the U-Boot tree. It is now maintained as a +separate package called 'patch-manager'. + +Install it with:: + + pip install patch-manager + +See the `patman documentation <https://deinde.dev/patman>`_ for more +information.
doc/develop/sending_patches.rst +3 -1
@@ -24,7 +24,9 @@ You can use a tool called patman to prepare, check and send patches. It creates change logs, cover letters and patch notes. It also simplifies the process of sending multiple versions of a series. -See more details at :doc:`patman`. +patman now lives outside the U-Boot tree; install it with +``pip install patch-manager``. See the +`patman documentation <https://deinde.dev/patman>`_ for details. General Patch Submission Rules ------------------------------
tools/patman/README.rst deleted +0 -1
@@ -1 +0,0 @@ -patman.rst
tools/patman/patman.rst deleted +0 -1023
1,023 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 5/9] patman: Replace the documentation with a stub
Quoted 13 lines · Simon Glass
The full patman manual now lives with the standalone patch-manager package, making the 1000-line copy in the tree redundant. Its published page is a long-standing URL, though, so removing it outright would break existing links.
Replace the in-tree manual with a short stub that points readers at the patch-manager package, and keep the toctree entry so the page still builds. Drop the README and the tool's own rst, and point the patch-sending docs at the standalone package too.
Signed-off-by Simon Glass <[email protected]>---
Quoted 9 lines
doc/develop/driver-model/spi-howto.rst | 5 +- doc/develop/patman.rst | 15 +- doc/develop/sending_patches.rst | 4 +- tools/patman/README.rst | 1 - tools/patman/patman.rst | 1023 ------------------------ 5 files changed, 20 insertions(+), 1028 deletions(-) mode change 120000 => 100644 doc/develop/patman.rst delete mode 120000 tools/patman/README.rst delete mode 100644 tools/patman/patman.rst
We shouldn't keep a stub here, and instead just have a short blurb about patman that follows after the b4 blurb in doc/develop/codingstyle.rst. And that's indeed an odd location, so if you want to first move b4 to sending_patches.rst and then have a patman blub, that would be good too.
Signature · 1 line
Tom
Re: [PATCH 5/9] patman: Replace the documentation with a stub
In reply to Simon GlassQuoted 29 lines · Simon Glass
The full patman manual now lives with the standalone patch-manager package, making the 1000-line copy in the tree redundant. Its published page is a long-standing URL, though, so removing it outright would break existing links.
Replace the in-tree manual with a short stub that points readers at the patch-manager package, and keep the toctree entry so the page still builds. Drop the README and the tool's own rst, and point the patch-sending docs at the standalone package too.
Signed-off-by Simon Glass <[email protected]>---
doc/develop/driver-model/spi-howto.rst | 5 +- doc/develop/patman.rst | 15 +- doc/develop/sending_patches.rst | 4 +- tools/patman/README.rst | 1 - tools/patman/patman.rst | 1023 ------------------------ 5 files changed, 20 insertions(+), 1028 deletions(-) mode change 120000 => 100644 doc/develop/patman.rst delete mode 120000 tools/patman/README.rst delete mode 100644 tools/patman/patman.rstdoc/develop/driver-model/spi-howto.rst +0
-0
doc/develop/driver-model/spi-howto.rst board. · line 654
Quoted 8 lines
doc/develop/driver-model/spi-howto.rst +3
-2@@ -649,8 +649,9 @@ board. Prepare patches and send them to the mailing lists -------------------------------------------------- -You can use 'tools/patman/patman' to prepare, check and send patches for -your work. See tools/patman/README for details. +You can use the patman tool to prepare, check and send patches for your work. +Install it with ``pip install patch-manager``; see the +`patman documentation <https://deinde.dev/patman>`_.
So this URL seems weird, and it redirects to
https://patman.readthedocs.io/en/latest/
If I search for patch-manager on pypi.org the project goes to
https://github.com/nxtboot/patman
May I suggest that deinde.dev and nxtboot and patman and patch-manager as different names all feel disconnected, maybe some consistency around patman for the URLs, even if the github project is nxtboot, may provide less confusion for the users.
Quoted 1,085 lines
doc/develop/driver-model/spi-howto.rst +0
-0A little note about SPI uclass features ---------------------------------------doc/develop/patman.rst deleted +0
-1@@ -1 +0,0 @@ -../../tools/patman/patman.rstdoc/develop/patman.rst new file +14
-0@@ -0,0 +1,14 @@ +.. SPDX-License-Identifier: GPL-2.0+ + +patman +====== + +patman is no longer part of the U-Boot tree. It is now maintained as a +separate package called 'patch-manager'. + +Install it with:: + + pip install patch-manager + +See the `patman documentation <https://deinde.dev/patman>`_ for more +information.doc/develop/sending_patches.rst +3
-1@@ -24,7 +24,9 @@ You can use a tool called patman to prepare, check and send patches. It creates change logs, cover letters and patch notes. It also simplifies the process of sending multiple versions of a series. -See more details at :doc:`patman`. +patman now lives outside the U-Boot tree; install it with +``pip install patch-manager``. See the +`patman documentation <https://deinde.dev/patman>`_ for details. General Patch Submission Rules ------------------------------tools/patman/README.rst deleted +0
-1@@ -1 +0,0 @@ -patman.rsttools/patman/patman.rst deleted +0
-1024@@ -1,1023 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0+ -.. Copyright (c) 2011 The Chromium OS Authors -.. Simon Glass <[email protected]> -.. Maxim Cournoyer <[email protected]> -.. v1, v2, 19-Oct-11 -.. revised v3 24-Nov-11 -.. revised v4 Independence Day 2020, with Patchwork integration - -Patman patch manager -==================== - -This tool is a Python script which: - -- Creates patch directly from your branch -- Cleans them up by removing unwanted tags -- Inserts a cover letter with change lists -- Runs the patches through checkpatch.pl and its own checks -- Optionally emails them out to selected people -- Links the series automatically to Patchwork once sent - -It also has some Patchwork features: - -- Manage local series and their status on patchwork -- Show review tags from Patchwork and allows them to be gathered into commits -- List comments received on a series - -It is intended to automate patch creation and make it a less -error-prone process. It is useful for U-Boot and Linux work so far, -since they use the checkpatch.pl script. - -It is configured almost entirely by tags it finds in your commits. -This means that you can work on a number of different branches at -once, and keep the settings with each branch rather than having to -git format-patch, git send-email, etc. with the correct parameters -each time. So for example if you put:: - - Series-to: [email protected] - -in one of your commits, the series will be sent there. - -In Linux and U-Boot this will also call get_maintainer.pl on each of your -patches automatically (unless you use -m to disable this). - - -Installation ------------- - -You can install patman using:: - - pip install patch-manager - -The name is chosen since patman conflicts with an existing package. - -If you are using patman within the U-Boot tree, it may be easiest to add a -symlink from your local `~/.bin` directory to `/path/to/tools/patman/patman`. - -How to use this tool --------------------- - -This tool requires a certain way of working: - -- Maintain a number of branches, one for each patch series you are - working on -- Add tags into the commits within each branch to indicate where the - series should be sent, cover letter, version, etc. Most of these are - normally in the top commit so it is easy to change them with 'git - commit --amend' -- Each branch tracks the upstream branch, so that this script can - automatically determine the number of commits in it (optional) -- Check out a branch, and run this script to create and send out your - patches. Weeks later, change the patches and repeat, knowing that you - will get a consistent result each time. - - -How to configure it -------------------- - -For most cases of using patman for U-Boot development, patman can use the -file 'doc/git-mailrc' in your U-Boot directory to supply the email aliases -you need. To make this work, tell git where to find the file by typing -this once:: - - git config sendemail.aliasesfile doc/git-mailrc - -For both Linux and U-Boot the 'scripts/get_maintainer.pl' handles -figuring out where to send patches pretty well. For other projects, -you may want to specify a different script to be run, for example via -a project-specific `.patman` file:: - - # .patman configuration file at the root of some project - - [settings] - get_maintainer_script: etc/teams.scm get-maintainer - -The `get_maintainer_script` option corresponds to the -`--get-maintainer-script` argument of the `send` command. It is -looked relatively to the root of the current git repository, as well -as on PATH. It can also be provided arguments, as shown above. The -contract is that the script should accept a patch file name and return -a list of email addresses, one per line, like `get_maintainer.pl` -does. - -During the first run patman creates a config file for you by taking the default -user name and email address from the global .gitconfig file. - -To add your own, create a file `~/.patman` like this:: - - # patman alias file - - [alias] - me: Simon Glass <[email protected]> - - u-boot: U-Boot Mailing List <[email protected]> - wolfgang: Wolfgang Denk <[email protected]> - others: Mike Frysinger <[email protected]>, Fred Bloggs <[email protected]> - -As hinted above, Patman will also look for a `.patman` configuration -file at the root of the current project git repository, which makes it -possible to override the `project` settings variable or anything else -in a project-specific way. The values of this "local" configuration -file take precedence over those of the "global" one. - -Aliases are recursive. - -The checkpatch.pl in the U-Boot tools/ subdirectory will be located and -used. Failing that you can put it into your path or ~/bin/checkpatch.pl - -If you want to avoid sending patches to email addresses that are picked up -by patman but are known to bounce you can add a [bounces] section to your -.patman file. Unlike the [alias] section these are simple key: value pairs -that are not recursive:: - - [bounces] - gonefishing: Fred Bloggs <[email protected]> - - -If you want to change the defaults for patman's command-line arguments, -you can add a [settings] section to your .patman file. This can be used -for any command line option by referring to the "dest" for the option in -patman.py. For reference, the useful ones (at the moment) shown below -(all with the non-default setting):: - - [settings] - ignore_errors: True - process_tags: False - verbose: True - smtp_server: /path/to/sendmail - patchwork_url: https://patchwork.ozlabs.org - -If you want to adjust settings (or aliases) that affect just a single -project you can add a section that looks like [project_settings] or -[project_alias]. If you want to use tags for your linux work, you could do:: - - [linux_settings] - process_tags: True - - -How to run it -------------- - -First do a dry run: - -.. code-block:: bash - - ./tools/patman/patman send -n - -If it can't detect the upstream branch, try telling it how many patches -there are in your series - -.. code-block:: bash - - ./tools/patman/patman -c5 send -n - -This will create patch files in your current directory and tell you who -it is thinking of sending them to. Take a look at the patch files: - -.. code-block:: bash - - ./tools/patman/patman -c5 -s1 send -n - -Similar to the above, but skip the first commit and take the next 5. This -is useful if your top commit is for setting up testing. - - -How to install it ------------------ - -The most up to date version of patman can be found in the U-Boot sources. -However to use it on other projects it may be more convenient to install it as -a standalone application. A distutils installer is included, this can be used -to install patman: - -.. code-block:: bash - - cd tools/patman && python setup.py install - - -How to add tags ---------------- - -To make this script useful you must add tags like the following into any -commit. Most can only appear once in the whole series. - -Series-to: email / alias - Email address / alias to send patch series to (you can add this - multiple times) - -Series-cc: email / alias, ... - Email address / alias to Cc patch series to (you can add this - multiple times) - -Series-version: n - Sets the version number of this patch series - -Series-prefix: prefix - Sets the subject prefix. Normally empty but it can be RFC for - RFC patches, or RESEND if you are being ignored. The patch subject - is like [RFC PATCH] or [RESEND PATCH]. - In the meantime, git format.subjectprefix option will be added as - well. If your format.subjectprefix is set to InternalProject, then - the patch shows like: [InternalProject][RFC/RESEND PATCH] - -Series-postfix: postfix - Sets the subject "postfix". Normally empty, but can be the name of a - tree such as net or net-next if that needs to be specified. The patch - subject is like [PATCH net] or [PATCH net-next]. - -Series-name: name - Sets the name of the series. You don't need to have a name, and - patman does not yet use it, but it is convenient to put the branch - name here to help you keep track of multiple upstreaming efforts. - -Series-links: [id | version:id]... - Set the ID of the series in patchwork. You can set this after you send - out the series and look in patchwork for the resulting series. The - URL you want is the one for the series itself, not any particular patch. - E.g. for http://patchwork.ozlabs.org/project/uboot/list/?series=187331 - the series ID is 187331. This property can have a list of series IDs, - one for each version of the series, e.g. - - :: - - Series-links: 1:187331 2:188434 189372 - - Patman always uses the one without a version, since it assumes this is - the latest one. When this tag is provided, patman can compare your local - branch against patchwork to see what new reviews your series has - collected ('patman status'). - -Series-patchwork-url: url - This allows specifying the Patchwork URL for a branch. This overrides - both the setting files ("patchwork_url") and the command-line argument. - The URL should include the protocol and web site, with no trailing slash, - for example 'https://patchwork.ozlabs.org/project' - -Cover-letter: - Sets the cover letter contents for the series. The first line - will become the subject of the cover letter:: - - Cover-letter: - This is the patch set title - blah blah - more blah blah - END - -Cover-letter-cc: email / alias - Additional email addresses / aliases to send cover letter to (you - can add this multiple times) - -Series-notes: - Sets some notes for the patch series, which you don't want in - the commit messages, but do want to send, The notes are joined - together and put after the cover letter. Can appear multiple - times:: - - Series-notes: - blah blah - blah blah - more blah blah - END - -Commit-notes: - Similar, but for a single commit (patch). These notes will appear - immediately below the ``---`` cut in the patch file:: - - Commit-notes: - blah blah - blah blah - more blah blah - -Signed-off-by: Their Name <email> - A sign-off is added automatically to your patches (this is - probably a bug). If you put this tag in your patches, it will - override the default signoff that patman automatically adds. - Multiple duplicate signoffs will be removed. - -Tested-by / Reviewed-by / Acked-by - These indicate that someone has tested/reviewed/acked your patch. - When you get this reply on the mailing list, you can add this - tag to the relevant commit and the script will include it when - you send out the next version. If 'Tested-by:' is set to - yourself, it will be removed. No one will believe you. - - Example:: - - Tested-by: Their Name <[email protected]> - Reviewed-by: Their Name <email> - Acked-by: Their Name <email> - -Series-changes: n - This can appear in any commit. It lists the changes for a - particular version n of that commit. The change list is - created based on this information. Each commit gets its own - change list and also the whole thing is repeated in the cover - letter (where duplicate change lines are merged). - - By adding your change lists into your commits it is easier to - keep track of what happened. When you amend a commit, remember - to update the log there and then, knowing that the script will - do the rest. - - Example:: - - Series-changes: n - - Guinea pig moved into its cage - - Other changes ending with a blank line - <blank line> - -Commit-changes: n - This tag is like Series-changes, except changes in this changelog will - only appear in the changelog of the commit this tag is in. This is - useful when you want to add notes which may not make sense in the cover - letter. For example, you can have short changes such as "New" or - "Lint". - - Example:: - - Commit-changes: n - - This line will not appear in the cover-letter changelog - <blank line> - -Cover-changes: n - This tag is like Series-changes, except changes in this changelog will - only appear in the cover-letter changelog. This is useful to summarize - changes made with Commit-changes, or to add additional context to - changes. - - Example:: - - Cover-changes: n - - This line will only appear in the cover letter - <blank line> - -Commit-added-in: n - Add a change noting the version this commit was added in. This is - equivalent to:: - - Commit-changes: n - - New - - Cover-changes: n - - <commit subject> - - It is a convenient shorthand for suppressing the '(no changes in vN)' - message. - -Patch-cc / Commit-cc: Their Name <email> - This copies a single patch to another email address. Note that the - Cc: used by git send-email is ignored by patman, but will be - interpreted by git send-email if you use it. - -Series-process-log: sort, uniq - This tells patman to sort and/or uniq the change logs. Changes may be - multiple lines long, as long as each subsequent line of a change begins - with a whitespace character. For example, - - Example:: - - - This change - continues onto the next line - - But this change is separate - - Use 'sort' to sort the entries, and 'uniq' to include only - unique entries. If omitted, no change log processing is done. - Separate each tag with a comma. - -Change-Id: - This tag is used to generate the Message-Id of the emails that - will be sent. When you keep the Change-Id the same you are - asserting that this is a slightly different version (but logically - the same patch) as other patches that have been sent out with the - same Change-Id. The Change-Id tag line is removed from outgoing - patches, unless the `keep_change_id` settings is set to `True`. - -Various other tags are silently removed, like these Chrome OS and -Gerrit tags:: - - BUG=... - TEST=... - Review URL: - Reviewed-on: - Commit-xxxx: (except Commit-notes) - -Exercise for the reader: Try adding some tags to one of your current -patch series and see how the patches turn out. - - -Where Patches Are Sent ----------------------- - -Once the patches are created, patman sends them using git send-email. The -whole series is sent to the recipients in Series-to: and Series-cc. -You can Cc individual patches to other people with the Patch-cc: tag. Tags -in the subject are also picked up to Cc patches. For example, a commit like -this:: - - commit 10212537b85ff9b6e09c82045127522c0f0db981 - Author: Mike Frysinger <[email protected]> - Date: Mon Nov 7 23:18:44 2011 -0500 - - x86: arm: add a git mailrc file for maintainers - - This should make sending out e-mails to the right people easier. - - Patch-cc: sandbox, mikef, ag - Patch-cc: afleming - -will create a patch which is copied to x86, arm, sandbox, mikef, ag and -afleming. - -If you have a cover letter it will get sent to the union of the Patch-cc -lists of all of the other patches. If you want to sent it to additional -people you can add a tag:: - - Cover-letter-cc: <list of addresses> - -These people will get the cover letter even if they are not on the To/Cc -list for any of the patches. - - -Patchwork Integration ---------------------- - -Patman has a very basic integration with Patchwork. If you point patman to -your series on patchwork it can show you what new reviews have appeared since -you sent your series. - -To set this up, add a Series-link tag to one of the commits in your series -(see above). - -Then you can type: - -.. code-block:: bash - - patman status - -and patman will show you each patch and what review tags have been collected, -for example:: - - ... - 21 x86: mtrr: Update the command to use the new mtrr - Reviewed-by: Wolfgang Wallner <[email protected]> - + Reviewed-by: Bin Meng <[email protected]> - 22 x86: mtrr: Restructure so command execution is in - Reviewed-by: Wolfgang Wallner <[email protected]> - + Reviewed-by: Bin Meng <[email protected]> - ... - -This shows that patch 21 and 22 were sent out with one review but have since -attracted another review each. If the series needs changes, you can update -these commits with the new review tag before sending the next version of the -series. - -To automatically pull into these tags into a new branch, use the -d option: - -.. code-block:: bash - - patman status -d mtrr4 - -This will create a new 'mtrr4' branch which is the same as your current branch -but has the new review tags in it. The tags are added in alphabetic order and -are placed immediately after any existing ack/review/test/fixes tags, or at the -end. You can check that this worked with: - -.. code-block:: bash - - patman -b mtrr4 status - -which should show that there are no new responses compared to this new branch. - -There is also a -C option to list the comments received for each patch. - - -Example Work Flow ------------------ - -The basic workflow is to create your commits, add some tags to the top -commit, and type 'patman' to check and send them. - -Here is an example workflow for a series of 4 patches. Let's say you have -these rather contrived patches in the following order in branch us-cmd in -your tree where 'us' means your upstreaming activity (newest to oldest as -output by git log --oneline):: - - 7c7909c wip - 89234f5 Don't include standard parser if hush is used - 8d640a7 mmc: sparc: Stop using builtin_run_command() - 0c859a9 Rename run_command2() to run_command() - a74443f sandbox: Rename run_command() to builtin_run_command() - -The first patch is some test things that enable your code to be compiled, -but that you don't want to submit because there is an existing patch for it -on the list. So you can tell patman to create and check some patches -(skipping the first patch) with: - -.. code-block:: bash - - patman -s1 send -n - -If you want to do all of them including the work-in-progress one, then -(if you are tracking an upstream branch): - -.. code-block:: bash - - patman send -n - -Let's say that patman reports an error in the second patch. Then: - -.. code-block:: bash - - git rebase -i HEAD~6 - # change 'pick' to 'edit' in 89234f5 - # use editor to make code changes - git add -u - git rebase --continue - -Now you have an updated patch series. To check it: - -.. code-block:: bash - - patman -s1 send -n - -Let's say it is now clean and you want to send it. Now you need to set up -the destination. So amend the top commit with: - -.. code-block:: bash - - git commit --amend - -Use your editor to add some tags, so that the whole commit message is:: - - The current run_command() is really only one of the options, with - hush providing the other. It really shouldn't be called directly - in case the hush parser is bring used, so rename this function to - better explain its purpose:: - - Series-to: u-boot - Series-cc: bfin, marex - Series-prefix: RFC - Cover-letter: - Unified command execution in one place - - At present two parsers have similar code to execute commands. Also - cmd_usage() is called all over the place. This series adds a single - function which processes commands called cmd_process(). - END - - Change-Id: Ica71a14c1f0ecb5650f771a32fecb8d2eb9d8a17 - - -You want this to be an RFC and Cc the whole series to the bfin alias and -to Marek. Two of the patches have tags (those are the bits at the front of -the subject that say mmc: sparc: and sandbox:), so 8d640a7 will be Cc'd to -mmc and sparc, and the last one to sandbox. - -Now to send the patches, take off the -n flag: - -.. code-block:: bash - - patman -s1 send - -The patches will be created, shown in your editor, and then sent along with -the cover letter. Note that patman's tags are automatically removed so that -people on the list don't see your secret info. - -Of course patches often attract comments and you need to make some updates. -Let's say one person sent comments and you get an Acked-by: on one patch. -Also, the patch on the list that you were waiting for has been merged, -so you can drop your wip commit. - -Take a look on patchwork and find out the URL of the series. This will be -something like `http://patchwork.ozlabs.org/project/uboot/list/?series=187331` -Add this to a tag in your top commit:: - - Series-links: 187331 - -You can use then patman to collect the Acked-by tag to the correct commit, -creating a new 'version 2' branch for us-cmd: - -.. code-block:: bash - - patman status -d us-cmd2 - git checkout us-cmd2 - -You can look at the comments in Patchwork or with: - -.. code-block:: bash - - patman status -C - -Then you can resync with upstream: - -.. code-block:: bash - - git fetch origin # or whatever upstream is called - git rebase origin/master - -and use git rebase -i to edit the commits, dropping the wip one. - -Then update the `Series-cc:` in the top commit to add the person who reviewed -the v1 series:: - - Series-cc: bfin, marex, Heiko Schocher <[email protected]> - -and remove the Series-prefix: tag since it it isn't an RFC any more. The -series is now version two, so the series info in the top commit looks like -this:: - - Series-to: u-boot - Series-cc: bfin, marex, Heiko Schocher <[email protected]> - Series-version: 2 - Cover-letter: - ... - -Finally, you need to add a change log to the two commits you changed. You -add change logs to each individual commit where the changes happened, like -this:: - - Series-changes: 2 - - Updated the command decoder to reduce code size - - Wound the torque propounder up a little more - -(note the blank line at the end of the list) - -When you run patman it will collect all the change logs from the different -commits and combine them into the cover letter, if you have one. So finally -you have a new series of commits:: - - faeb973 Don't include standard parser if hush is used - 1b2f2fe mmc: sparc: Stop using builtin_run_command() - cfbe330 Rename run_command2() to run_command() - 0682677 sandbox: Rename run_command() to builtin_run_command() - -so to send them: - -.. code-block:: bash - - patman - -and it will create and send the version 2 series. - - -Series Management ------------------ - -Sometimes you might have several series in flight at the same time. Each of -these receives comments and you want to create a new version of each series with -those comments addressed. - -Patman provides a few subcommands which are helpful for managing series. - -Series and branches -~~~~~~~~~~~~~~~~~~~ - -'patman series' works with the concept of a series. It maintains a local -database (.patman.db in your top-level git tree) and uses that to keep track of -series and patches. - -Each series goes through muliple versions. Patman requires that the first -version of your series is in a branch without a numeric suffix. Branch names -like 'serial' and 'video' are OK, but 'part3' is not. This is because Patman -uses the number at the end of the branch name to indicate the version. - -If your series name is 'video', then you can have a 'video' branch for version -1 of the series, 'video2' for version 2 and 'video3' for version 3. All three -branches are for the same series. Patman keeps track of these different -versions. It handles the branch naming automatically, but you need to be aware -of what it is doing. - -You will have an easier time if the branch names you use with 'patman series' -are short, no more than 15 characters. This is the amount of columnar space in -listings. You can add a longer description as the series description. If you -are used to having very descriptive branch names, remember that patman lets you -add metadata into commit which is automatically removed before sending. - -This documentation uses the term 'series' to mean all the versions of a series -and 'series/version' to mean a particular version of a series. - -Updating commits -~~~~~~~~~~~~~~~~ - -Since Patman provides quite a bit of automation, it updates your commits in -some cases, effectively doing a rebase of a branch in order to change the tags -in the commits. It never makes code changes. - -In extremis you can use 'git reflog' to revert something that Patman did. - - -Series subcommands -~~~~~~~~~~~~~~~~~~ - -Note that 'patman series ...' can be abbreviated as 'patman s' or 'patman ser'. - -Here is a short overview of the available subcommands: - - add - Add a new series. Use this on an existing branch to tell Patman about it. - - archive (ar) - Archive a series when you have finished upstreaming it. Archived series - are not shown by most commands. This creates a dated tag for each - version of the series, pointing to the series branch, then deletes the - branches. It puts the tag names in the database so that it can - 'unarchive' to restore things how they were. - - unarchive (unar) - Unarchive a series when you decide you need to do something more with - it. The branches are restored and tags deleted. - - autolink (au) - Search patchwork for the series link for your series, so Patman can - track the status - - autolink-all - Same but for all series - - inc - Increase the series number, effectively creating a new branch with the - next highest version number. The new branch is created based on the - existing branch. So if you use 'patman series inc' on branch 'video2' - it will create branch 'video3' and add v3 into its database - - dec - Decrease the series number, thus deleting the current branch and - removing that version from the data. If you use this comment on branch - 'video3' Patman will delete version 3 and branch 'video3'. - - get-link - Shows the Patchwork link for a series/version - - ls - Lists the series in the database - - mark - Mark a series with 'Change-Id' tags so that Patman can track patches - even when the subject changes. Unmarked patches just use the subject to - decided which is which. - - unmark - Remove 'Change-Id' tags from a series. - - open (o) - Open a series in Patchwork using your web browser - - patches - Show the patches in a particular series/version - - progress (p) - Show upstream progress for your series, or for all series - - rm - Remove a series entirely, including all versions - - rm-version (rmv) - Remove a particular version of a series. This is similar to 'dec' - except that any version can be removed, not just the latest one. - - scan - Scan the local branch and update the database with the set of patches - in that branch. This throws away the old patches. - - send - Send a series out as patches. This is similar to 'patman send' except - that it can send any series, not just the current branch. It also - waits a little for patchwork to see the cover letter, so it can find - out the patchwork link for the series. - - set-link - Sets the Patchwork link for a series-version manually. - - status (st) - Run 'patman status' on a series. This is similar to 'patman status' - except that it can get status on any series, not just the current - branch - - summary - Shows a quick summary of series with their status and description. - - sync - Sync the status of a series with Pathwork, so that - 'patman series progress' can show the right information. - - sync-all - Sync the status of all series. - - -Patman series workflow -~~~~~~~~~~~~~~~~~~~~~~ - -Here is a run-through of how to incorporate 'patman series' into your workflow. - -Firstly, set up your project:: - - patman patchwork set-project U-Boot - -This just tells Patman to look on the Patchwork server for a project of that -name. Internally Patman stores the ID and URL 'link-name' for the project, so it -can access it. - -If you need to use a different patchwork server, use the `--patchwork-url` -option or put the URL in your Patman-settings file. - -Now create a branch. For our example we are going to send out a series related -to video so the branch will be called 'video'. The upstream remove is called -'us':: - - git checkout -b video us/master - -We now have a branch and so we can do some commits:: - - <edit files> - git add ... - <edit files> - git add -u - git commit ... - git commit ... - -We now have a few commits in our 'video' branch. Let's tell patman about it:: - - patman series add - -Like most commands, if no series is given (`patman series -s video add`) then -the current branch is assumed. Since the branch is called 'video' patman knows -that it is version one of the video series. - -You'll likely get a warning that there is no cover letter. Let's add some tags -to the top commit:: - - Series-to: u-boot - Series-cc: ... - Cover-letter: - video: Improve syncing performance with cyclic - -Trying again:: - - patman series add - -You'll likely get a warning that the commits are unmarked. You can either let -patman add Change-Id values itself with the `-m` flag, or tell it not to worry -about it with `-M`. You must choose one or the other. Let's leave the commits -unmarked:: - - patman series add -M - -Congratulations, you've now got a patman database! - -Now let's send out the series. We will add tags to the top commit. - -To send it:: - - patman series send - -You should send 'git send-email' start up and you can confirm the sending of -each email. - -After that, patman waits a bit to see if it can find your new series appearing -on Patchwork. With a bit of luck this will only take 20 seconds or so. Then your -series is linked. - -To gather tags (Reviewed-by ...) for your series from patchwork:: - - patman series gather - -Now you can check your progress:: - - patman series progress - -Later on you get some comments, or perhaps you just decide to make a change on -your own. You have several options. - -The first option is that you can just create a new branch:: - - git checkout -b video2 video - -then you can add this 'v2' series to Patman with:: - - patman series add - -The second option is to get patman to create the new 'video2' branch in one -step:: - - patman inc - -The third option is to collect some tags using the 'patman status' command and -put them in a new branch:: - - patman status -d video2 - -One day the fourth option will be to ask patman to collect tags as part of the -'patman inc' command. - -Again, you do your edits, perhaps adding/removing patches, rebasing on -master -and so on. Then, send your v2:: - - patman series send - -Let's say the patches are accepted. You can use:: - - patch series gather - patch series progress - -to check, or:: - - patman series status -cC - -to see comments. You can now archive the series:: - - patman series archive - -At this point you have the basics. Some of the subcommands useful options, so -be sure to check out the help. - -Here is a sample 'progress' view: - -.. image:: pics/patman.jpg - :width: 800 - :alt: Patman showing the progress view - -General points --------------- - -#. When you change back to the us-cmd branch days or weeks later all your - information is still there, safely stored in the commits. You don't need - to remember what version you are up to, who you sent the last lot of patches - to, or anything about the change logs. -#. If you put tags in the subject, patman will Cc the maintainers - automatically in many cases. -#. If you want to keep the commits from each series you sent so that you can - compare change and see what you did, you can either create a new branch for - each version, or just tag the branch before you start changing it: - - .. code-block:: bash - - git tag sent/us-cmd-rfc - # ...later... - git tag sent/us-cmd-v2 - -#. If you want to modify the patches a little before sending, you can do - this in your editor, but be careful! -#. If you want to run git send-email yourself, use the -n flag which will - print out the command line patman would have used. -#. It is a good idea to add the change log info as you change the commit, - not later when you can't remember which patch you changed. You can always - go back and change or remove logs from commits. -#. Some mailing lists have size limits and when we add binary contents to - our patches it's easy to exceed the size limits. Use "--no-binary" to - generate patches without any binary contents. You are supposed to include - a link to a git repository in your "Commit-notes", "Series-notes" or - "Cover-letter" for maintainers to fetch the original commit. -#. Patches will have no changelog entries for revisions where they did not - change. For clarity, if there are no changes for this patch in the most - recent revision of the series, a note will be added. For example, a patch - with the following tags in the commit:: - - Series-version: 5 - Series-changes: 2 - - Some change - - Series-changes: 4 - - Another change - - would have a changelog of::: - - (no changes since v4) - - Changes in v4: - - Another change - - Changes in v2: - - Some change - - -Other thoughts --------------- - -This script has been split into sensible files but still needs work. -Most of these are indicated by a TODO in the code. - -It would be nice if this could handle the In-reply-to side of things. - -The tests are incomplete, as is customary. Use the 'test' subcommand to run -them: - -.. code-block:: bash - - $ tools/patman/patman test - -Note that since the test suite depends on data files only available in -the git checkout, the `test` command is hidden unless `patman` is -invoked from the U-Boot git repository. - -Alternatively, you can run the test suite via Pytest: - -.. code-block:: bash - - $ cd tools/patman && pytest - -Error handling doesn't always produce friendly error messages - e.g. -putting an incorrect tag in a commit may provide a confusing message. - -There might be a few other features not mentioned in this README. They -might be bugs. In particular, tags are case sensitive which is probably -a bad thing. --2.43.0
Re: [PATCH 5/9] patman: Replace the documentation with a stub
Hi Peter,
Quoted 43 lines · Peter Robinson
Quoted 29 lines · Simon Glass
The full patman manual now lives with the standalone patch-manager package, making the 1000-line copy in the tree redundant. Its published page is a long-standing URL, though, so removing it outright would break existing links.
Replace the in-tree manual with a short stub that points readers at the patch-manager package, and keep the toctree entry so the page still builds. Drop the README and the tool's own rst, and point the patch-sending docs at the standalone package too.
Signed-off-by Simon Glass <[email protected]>---
doc/develop/driver-model/spi-howto.rst | 5 +- doc/develop/patman.rst | 15 +- doc/develop/sending_patches.rst | 4 +- tools/patman/README.rst | 1 - tools/patman/patman.rst | 1023 ------------------------ 5 files changed, 20 insertions(+), 1028 deletions(-) mode change 120000 => 100644 doc/develop/patman.rst delete mode 120000 tools/patman/README.rst delete mode 100644 tools/patman/patman.rstdoc/develop/driver-model/spi-howto.rst +0
-0doc/develop/driver-model/spi-howto.rst board. · line 654
Quoted 8 lines
doc/develop/driver-model/spi-howto.rst +3
-2@@ -649,8 +649,9 @@ board. Prepare patches and send them to the mailing lists -------------------------------------------------- -You can use 'tools/patman/patman' to prepare, check and send patches for -your work. See tools/patman/README for details. +You can use the patman tool to prepare, check and send patches for your work. +Install it with ``pip install patch-manager``; see the +`patman documentation <https://deinde.dev/patman>`_.So this URL seems weird, and it redirects to
https://patman.readthedocs.io/en/latest/
Quoted 7 lines
If I search for patch-manager on pypi.org the project goes to
https://github.com/nxtboot/patmanMay I suggest that deinde.dev and nxtboot and patman and patch-manager as different names all feel disconnected, maybe some consistency around patman for the URLs, even if the github project is nxtboot, may provide less confusion for the users.
Yes I agree and I would like to, but it's a matter of what is available:
- patman is used for something else on pypi
- nextboot and deinde are taken on github
I didn't cconsider using patch-manager as the github name, but that seems wrong because everyone thinks of it as 'patman'. It is somewhat of a mess, but I'm open to suggestions.
[..]
Regards,
Simon
PATCH 6/9 CI: Stop building and testing patman
In reply to Simon Glasspatman is now just a stub, so drop its requirements file and its 'patman test' run from the Azure and GitLab pipelines.
---
.azure-pipelines.yml | 5 +---- .gitlab-ci.yml | 7 +++---- 2 files changed, 4 insertions(+), 8 deletions(-)
.azure-pipelines.yml +1 -4
@@ -146,7 +146,7 @@ stages: make tools-only_config envtools -j$(nproc) - job: utils - displayName: 'Run binman, buildman, dtoc, Kconfig and patman testsuites' + displayName: 'Run binman, buildman, dtoc and Kconfig testsuites' pool: vmImage: $(ubuntu_vm) container:
@@ -163,7 +163,6 @@ stages: pip install -r test/py/requirements.txt \ -r tools/binman/requirements.txt \ -r tools/buildman/requirements.txt \ - -r tools/patman/requirements.txt \ -r tools/u_boot_pylib/requirements.txt export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only export PYTHONPATH=${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt
@@ -177,7 +176,6 @@ stages: COVERAGE_FILE=/tmp/.coverage ./tools/binman/binman ${TOOLPATH} test -T ./tools/buildman/buildman -t ./tools/dtoc/dtoc -t - ./tools/patman/patman test make O=${UBOOT_TRAVIS_BUILD_DIR} testconfig - job: pylint
@@ -196,7 +194,6 @@ stages: pip install -r test/py/requirements.txt \ -r tools/binman/requirements.txt \ -r tools/buildman/requirements.txt \ - -r tools/patman/requirements.txt \ -r tools/u_boot_pylib/requirements.txt \ asteval pylint==3.3.4 pyopenssl export PATH=${PATH}:~/.local/bin
.gitlab-ci.yml +3 -4
@@ -206,7 +206,7 @@ Build allyesconfig, tools-only and envtools: make mrproper; make tools-only_config envtools -j$(nproc) -Run binman, buildman, dtoc, Kconfig and patman testsuites: +Run binman, buildman, dtoc and Kconfig testsuites: extends: .testsuites tags: - ${DEFAULT_AMD64_TAG}
@@ -218,7 +218,7 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: python3 -m venv /tmp/venv; . /tmp/venv/bin/activate; pip install -r test/py/requirements.txt -r tools/binman/requirements.txt - -r tools/buildman/requirements.txt -r tools/patman/requirements.txt + -r tools/buildman/requirements.txt -r tools/u_boot_pylib/requirements.txt; export UBOOT_TRAVIS_BUILD_DIR=/tmp/tools-only; export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt";
@@ -233,7 +233,6 @@ Run binman, buildman, dtoc, Kconfig and patman testsuites: ./tools/binman/binman ${TOOLPATH} test -T; ./tools/buildman/buildman -t; ./tools/dtoc/dtoc -t; - ./tools/patman/patman test; make testconfig # Check for any pylint regressions
@@ -244,7 +243,7 @@ Run pylint: - python3 -m venv /tmp/venv - . /tmp/venv/bin/activate - pip install -r test/py/requirements.txt -r tools/binman/requirements.txt - -r tools/buildman/requirements.txt -r tools/patman/requirements.txt + -r tools/buildman/requirements.txt -r tools/u_boot_pylib/requirements.txt asteval pylint==3.3.4 pyopenssl - export PATH=${PATH}:~/.local/bin - echo "[MASTER]" >> .pylintrc
Signature · 1 line
2.43.0
PATCH 7/9 tools: docker: Drop patman from the CI image
In reply to Simon GlassThe CI runner image pre-caches pip packages by downloading each tool's requirements.txt from master. A later patch removes patman's requirements.txt from the tree, so stop fetching and installing it.
The same step already installs setuptools explicitly (patman's requirements list it too), so this needs nothing further.
This takes effect the next time someone rebuilds the image; the existing image keeps working in the meantime.
---
tools/docker/Dockerfile | 2 -- 1 file changed, 2 deletions(-)
tools/docker/Dockerfile +0 -2
@@ -362,7 +362,6 @@ RUN wget -O /tmp/pytest-requirements.txt https://source.denx.de/u-boot/u-boot/-/ RUN wget -O /tmp/sphinx-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/doc/sphinx/requirements.txt RUN wget -O /tmp/binman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/binman/requirements.txt RUN wget -O /tmp/buildman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/buildman/requirements.txt -RUN wget -O /tmp/patman-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/patman/requirements.txt RUN wget -O /tmp/u_boot_pylib-requirements.txt https://source.denx.de/u-boot/u-boot/-/raw/master/tools/u_boot_pylib/requirements.txt RUN python3 -m venv /tmp/venv && \ . /tmp/venv/bin/activate && \
@@ -370,7 +369,6 @@ RUN python3 -m venv /tmp/venv && \ -r /tmp/sphinx-requirements.txt \ -r /tmp/binman-requirements.txt \ -r /tmp/buildman-requirements.txt \ - -r /tmp/patman-requirements.txt \ -r /tmp/u_boot_pylib-requirements.txt \ setuptools pytest-azurepipelines && \ deactivate && \
Signature · 1 line
2.43.0
PATCH 8/9 tools: Stop packaging patman as a pip module
In reply to Simon Glasspatman is no longer shipped from the U-Boot tree, so drop it from the 'make pip' target and from make_pip.sh, and remove its packaging files (setup.py, pyproject.toml, requirements.txt). Nothing else refers to them by this point in the series, so they can go.
Also fix binman's pyproject.toml, which declares package-data for a 'patman' package (a copy-paste leftover); use 'binman' instead.
---
Makefile | 1 - scripts/make_pip.sh | 10 +++++----- tools/binman/pyproject.toml | 2 +- tools/patman/pyproject.toml | 29 ----------------------------- tools/patman/requirements.txt | 6 ------ tools/patman/setup.py | 11 ----------- 6 files changed, 6 insertions(+), 53 deletions(-) delete mode 100644 tools/patman/pyproject.toml delete mode 100644 tools/patman/requirements.txt delete mode 100644 tools/patman/setup.py
Makefile +0 -1
@@ -2691,7 +2691,6 @@ pip pip_test pip_release: _pip _pip: scripts/make_pip.sh u_boot_pylib ${PIP_ARGS} - scripts/make_pip.sh patman ${PIP_ARGS} scripts/make_pip.sh buildman ${PIP_ARGS} scripts/make_pip.sh dtoc ${PIP_ARGS} scripts/make_pip.sh binman ${PIP_ARGS}
scripts/make_pip.sh +5 -5
@@ -5,7 +5,7 @@ # # Usage: make_pip.sh <tool_name> [--real] # -# Where tool_name is one of patman, buildman, dtoc, binman, u_boot_pylib +# Where tool_name is one of buildman, dtoc, binman, u_boot_pylib # # and --real means to upload to the real server (otherwise the test one is used) #
@@ -36,10 +36,10 @@ tool="$1" shift flags="$*" -if [[ "${tool}" =~ ^(patman|buildman|dtoc|binman|u_boot_pylib)$ ]]; then +if [[ "${tool}" =~ ^(buildman|dtoc|binman|u_boot_pylib)$ ]]; then echo "Building dist package for tool ${tool}" else - echo "Unknown tool ${tool}: use u_boot_pylib, patman, buildman, dtoc or binman" + echo "Unknown tool ${tool}: use u_boot_pylib, buildman, dtoc or binman" exit 1 fi
@@ -61,8 +61,8 @@ if [ -n "${upload}" ]; then fi fi -if [[ "${tool}" =~ ^(patman|u_boot_pylib)$ ]]; then - # Leave test_util.py and patman test files alone +if [[ "${tool}" =~ ^(u_boot_pylib)$ ]]; then + # Leave test_util.py and the u_boot_pylib test files alone delete_testfiles= fi
tools/binman/pyproject.toml +1 -1
@@ -26,4 +26,4 @@ classifiers = [ binman = "binman.main:start_binman" [tool.setuptools.package-data] -patman = ["*.rst"] +binman = ["*.rst"]
tools/patman/pyproject.toml deleted +0 -29
@@ -1,29 +0,0 @@ -[build-system] -requires = ["setuptools>=78.1.1"] -build-backend = "setuptools.build_meta" - -[project] -name = "patch-manager" -version = "0.0.6" -authors = [ - { name="Simon Glass", email="[email protected]" }, -] -dependencies = ["u_boot_pylib >= 0.0.6", "aiohttp >= 3.9.1" ] -description = "Patman patch manager" -readme = "README.rst" -requires-python = ">=3.7" -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", - "Operating System :: OS Independent", -] - -[project.urls] -"Homepage" = "https://docs.u-boot-project.org/en/latest/develop/patman.html" -"Bug Tracker" = "https://source.denx.de/groups/u-boot/-/issues" - -[project.scripts] -patman = "patman.__main__:run_patman" - -[tool.setuptools.package-data] -patman = ["*.rst"]
tools/patman/requirements.txt deleted +0 -6
@@ -1,6 +0,0 @@ -aiohttp==3.10.11 -ConfigParser==7.1.0 -importlib_resources==6.5.2 -pygit2==1.14.1 -requests==2.32.4 -setuptools==78.1.1
tools/patman/setup.py deleted +0 -11
@@ -1,11 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0+ - -from setuptools import setup -setup(name='patman', - version='1.0', - scripts=['patman'], - packages=['patman'], - package_dir={'patman': ''}, - package_data={'patman': ['README.rst']}, - classifiers=['Environment :: Console', - 'Topic :: Software Development'])
Signature · 1 line
2.43.0
PATCH 9/9 test: Stop running the patman tests
In reply to Simon GlassThe patman tests no longer exist in the tree, so drop them from the test/run script (used by 'make tcheck' and friends) and from the tools-testing example in the documentation.
---
doc/develop/testing.rst | 2 +- test/run | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
doc/develop/testing.rst +1 -1
@@ -22,7 +22,7 @@ the quick ones, type this:: make qcheck -It is also possible to run just the tests for tools (patman, binman, etc.). +It is also possible to run just the tests for tools (binman, buildman, etc.). Such tests are included with those tools, i.e. no actual U-Boot unit tests are run. Type this::
test/run +0 -1
@@ -80,7 +80,6 @@ export DTC=${DTC_DIR}/dtc TOOLS_DIR=build-sandbox_spl/tools run_test "binman" ./tools/binman/binman --toolpath ${TOOLS_DIR} test -run_test "patman" ./tools/patman/patman test run_test "u_boot_pylib" ./tools/u_boot_pylib/u_boot_pylib run_test "buildman" ./tools/buildman/buildman -t ${skip}
Signature · 1 line
2.43.0