U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] patman: Separate gitutil fully
@ 2025-04-07 10:51 Simon Glass
  2025-04-07 10:51 ` [PATCH 1/5] patman: Untangle settings from gitutil Simon Glass
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Douglas Anderson, Sean Anderson, Tom Rini


The gitutil module uses Patman's settings module, which is not allowed
as it is supposed to be a separate package. This series ties up this
dependency.

This series depends on these two patches being applied:

https://patchwork.ozlabs.org/project/uboot/patch/20250227192735.406389-1-sjg@chromium.org/
https://patchwork.ozlabs.org/project/uboot/patch/20250328130225.2607974-1-sjg@chromium.org/


Simon Glass (5):
  patman: Untangle settings from gitutil
  patman: Pass the alias dict into gitutil.build_email_list()
  patman: Pass the alias dict into gitutil.email_patches()
  patman: Pass aliases to Series.MakeCcFile()
  patman: Update Series.ShowActions() to pass alias

 tools/patman/control.py       | 11 ++++++++---
 tools/patman/func_test.py     |  8 ++++----
 tools/patman/series.py        | 32 ++++++++++++++++++++++----------
 tools/u_boot_pylib/gitutil.py | 34 ++++++++++++++--------------------
 4 files changed, 48 insertions(+), 37 deletions(-)

-- 
2.43.0

base-commit: d47b5693e21f78d8cd8caa8fcd9e64fd6ae85759
branch: pata

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/5] patman: Untangle settings from gitutil
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
@ 2025-04-07 10:51 ` Simon Glass
  2025-04-07 10:51 ` [PATCH 2/5] patman: Pass the alias dict into gitutil.build_email_list() Simon Glass
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Simon Glass, Tom Rini

The gitutil module is supposed to be independent from patman but one
piece was missed in the series which separated them.

Move the settings setup out of gitutil

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/control.py       | 4 ++++
 tools/u_boot_pylib/gitutil.py | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/patman/control.py b/tools/patman/control.py
index b8a45912058..c1b6e41e2d2 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -13,6 +13,7 @@ import sys
 
 from patman import checkpatch
 from patman import patchstream
+from patman import settings
 from u_boot_pylib import gitutil
 from u_boot_pylib import terminal
 
@@ -20,6 +21,9 @@ from u_boot_pylib import terminal
 def setup():
     """Do required setup before doing anything"""
     gitutil.setup()
+    alias_fname = gitutil.get_alias_file()
+    if alias_fname:
+        settings.ReadGitAliases(alias_fname)
 
 
 def prepare_patches(col, branch, count, start, end, ignore_binary, signoff,
diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py
index 0376bece3e6..8935b6cc847 100644
--- a/tools/u_boot_pylib/gitutil.py
+++ b/tools/u_boot_pylib/gitutil.py
@@ -693,9 +693,6 @@ def setup():
     # Check for a git alias file also
     global USE_NO_DECORATE
 
-    alias_fname = get_alias_file()
-    if alias_fname:
-        settings.ReadGitAliases(alias_fname)
     cmd = log_cmd(None, count=0)
     USE_NO_DECORATE = (command.run_one(*cmd, raise_on_error=False)
                        .return_code == 0)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/5] patman: Pass the alias dict into gitutil.build_email_list()
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
  2025-04-07 10:51 ` [PATCH 1/5] patman: Untangle settings from gitutil Simon Glass
@ 2025-04-07 10:51 ` Simon Glass
  2025-04-07 10:51 ` [PATCH 3/5] patman: Pass the alias dict into gitutil.email_patches() Simon Glass
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List; +Cc: Simon Glass, Tom Rini

Rather than accessing the settings module in this function, require the
alias dict to be passed in.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/series.py        | 14 ++++++++------
 tools/u_boot_pylib/gitutil.py | 18 +++++++++---------
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/tools/patman/series.py b/tools/patman/series.py
index b73e9c58de4..51ae7f04c89 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -110,8 +110,8 @@ class Series(dict):
             cmd: The git command we would have run
             process_tags: Process tags as if they were aliases
         """
-        to_set = set(gitutil.build_email_list(self.to));
-        cc_set = set(gitutil.build_email_list(self.cc));
+        to_set = set(gitutil.build_email_list(self.to, settings.alias));
+        cc_set = set(gitutil.build_email_list(self.cc, settings.alias));
 
         col = terminal.Color()
         print('Dry run, so not doing much. But I would do this:')
@@ -140,7 +140,8 @@ class Series(dict):
         print('Postfix:\t ', self.get('postfix'))
         if self.cover:
             print('Cover: %d lines' % len(self.cover))
-            cover_cc = gitutil.build_email_list(self.get('cover_cc', ''))
+            cover_cc = gitutil.build_email_list(self.get('cover_cc', ''),
+                                                settings.alias)
             all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
             for email in sorted(set(all_ccs) - to_set - cc_set):
                     print('      Cc: ', email)
@@ -267,9 +268,9 @@ class Series(dict):
         """
         cc = []
         if process_tags:
-            cc += gitutil.build_email_list(commit.tags,
+            cc += gitutil.build_email_list(commit.tags, settings.alias,
                                            warn_on_error=warn_on_error)
-        cc += gitutil.build_email_list(commit.cc_list,
+        cc += gitutil.build_email_list(commit.cc_list, settings.alias,
                                        warn_on_error=warn_on_error)
         if type(add_maintainers) == type(cc):
             cc += add_maintainers
@@ -344,7 +345,8 @@ class Series(dict):
             print(col.build(col.YELLOW, f'Skipping "{x}"'))
 
         if cover_fname:
-            cover_cc = gitutil.build_email_list(self.get('cover_cc', ''))
+            cover_cc = gitutil.build_email_list(
+                self.get('cover_cc', ''), settings.alias)
             cover_cc = list(set(cover_cc + all_ccs))
             if limit is not None:
                 cover_cc = cover_cc[:limit]
diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py
index 8935b6cc847..7c9d0deecbb 100644
--- a/tools/u_boot_pylib/gitutil.py
+++ b/tools/u_boot_pylib/gitutil.py
@@ -361,7 +361,7 @@ def create_patches(branch, start, count, ignore_binary, series, signoff=True):
     return None, files
 
 
-def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
+def build_email_list(in_list, alias, tag=None, warn_on_error=True):
     """Build a list of email addresses based on an input list.
 
     Takes a list of email addresses and aliases, and turns this into a list
@@ -373,10 +373,10 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
 
     Args:
         in_list (list of str): List of aliases/email addresses
-        tag (str): Text to put before each address
         alias (dict): Alias dictionary:
             key: alias
             value: list of aliases or email addresses
+        tag (str): Text to put before each address
         warn_on_error (bool): True to raise an error when an alias fails to
             match, False to just print a message.
 
@@ -389,12 +389,12 @@ def build_email_list(in_list, tag=None, alias=None, warn_on_error=True):
     >>> alias['mary'] = ['Mary Poppins <m.poppins@cloud.net>']
     >>> alias['boys'] = ['fred', ' john']
     >>> alias['all'] = ['fred ', 'john', '   mary   ']
-    >>> build_email_list(['john', 'mary'], None, alias)
+    >>> build_email_list(['john', 'mary'], alias, None)
     ['j.bloggs@napier.co.nz', 'Mary Poppins <m.poppins@cloud.net>']
-    >>> build_email_list(['john', 'mary'], '--to', alias)
+    >>> build_email_list(['john', 'mary'], alias, '--to')
     ['--to "j.bloggs@napier.co.nz"', \
 '--to "Mary Poppins <m.poppins@cloud.net>"']
-    >>> build_email_list(['john', 'mary'], 'Cc', alias)
+    >>> build_email_list(['john', 'mary'], alias, 'Cc')
     ['Cc j.bloggs@napier.co.nz', 'Cc Mary Poppins <m.poppins@cloud.net>']
     """
     quote = '"' if tag and tag[0] == '-' else ''
@@ -498,7 +498,7 @@ send --cc-cmd cc-fname" cover p1 p2'
     # Restore argv[0] since we clobbered it.
     >>> sys.argv[0] = _old_argv0
     """
-    to = build_email_list(series.get('to'), '--to', alias, warn_on_error)
+    to = build_email_list(series.get('to'), settings.alias, '--to', warn_on_error)
     if not to:
         git_config_to = command.output('git', 'config', 'sendemail.to',
                                        raise_on_error=False)
@@ -510,10 +510,10 @@ send --cc-cmd cc-fname" cover p1 p2'
                   "git config sendemail.to u-boot@lists.denx.de")
             return None
     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
-                          '--cc', alias, warn_on_error)
+                          settings.alias, '--cc', warn_on_error)
     if self_only:
-        to = build_email_list([os.getenv('USER')], '--to',
-                              alias, warn_on_error)
+        to = build_email_list([os.getenv('USER')], '--to', settings.alias,
+                              warn_on_error)
         cc = []
     cmd = ['git', 'send-email', '--annotate']
     if smtp_server:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/5] patman: Pass the alias dict into gitutil.email_patches()
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
  2025-04-07 10:51 ` [PATCH 1/5] patman: Untangle settings from gitutil Simon Glass
  2025-04-07 10:51 ` [PATCH 2/5] patman: Pass the alias dict into gitutil.build_email_list() Simon Glass
@ 2025-04-07 10:51 ` Simon Glass
  2025-04-07 10:51 ` [PATCH 4/5] patman: Pass aliases to Series.MakeCcFile() Simon Glass
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Douglas Anderson, Sean Anderson, Tom Rini

Rather than accessing the settings module in this function, require the
alias dict to be passed in.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/control.py       |  2 +-
 tools/patman/func_test.py     |  5 +++--
 tools/u_boot_pylib/gitutil.py | 19 ++++++++-----------
 3 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/tools/patman/control.py b/tools/patman/control.py
index c1b6e41e2d2..f578336c7cc 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -153,7 +153,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
     if its_a_go:
         cmd = gitutil.email_patches(
             series, cover_fname, patch_files, dry_run, not ignore_bad_tags,
-            cc_file, in_reply_to=in_reply_to, thread=thread,
+            cc_file, settings.alias, in_reply_to=in_reply_to, thread=thread,
             smtp_server=smtp_server)
     else:
         print(col.build(col.RED, "Not sending emails due to errors/warnings"))
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index 720746e21f5..b8fb49c34ba 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -206,13 +206,14 @@ class TestFunctional(unittest.TestCase):
         dry_run = True
         in_reply_to = mel
         count = 2
-        settings.alias = {
+        alias = {
             'fdt': ['simon'],
             'u-boot': ['u-boot@lists.denx.de'],
             'simon': [self.leb],
             'fred': [self.fred],
             'joe': [self.joe],
         }
+        settings.alias = alias
 
         text = self._get_text('test01.txt')
         series = patchstream.get_metadata_for_test(text)
@@ -231,7 +232,7 @@ class TestFunctional(unittest.TestCase):
                                         None, get_maintainer_script)
             cmd = gitutil.email_patches(
                 series, cover_fname, args, dry_run, not ignore_bad_tags,
-                cc_file, in_reply_to=in_reply_to, thread=None)
+                cc_file, alias, in_reply_to=in_reply_to, thread=None)
             series.ShowActions(args, cmd, process_tags)
         cc_lines = open(cc_file, encoding='utf-8').read().splitlines()
         os.remove(cc_file)
diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py
index 7c9d0deecbb..7d3a0b68c53 100644
--- a/tools/u_boot_pylib/gitutil.py
+++ b/tools/u_boot_pylib/gitutil.py
@@ -5,7 +5,6 @@
 import os
 import sys
 
-from patman import settings
 from u_boot_pylib import command
 from u_boot_pylib import terminal
 
@@ -437,7 +436,7 @@ def check_suppress_cc_config():
 
 
 def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
-                  self_only=False, alias=None, in_reply_to=None, thread=False,
+                  alias, self_only=False, in_reply_to=None, thread=False,
                   smtp_server=None):
     """Email a patch series.
 
@@ -449,10 +448,10 @@ def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
         warn_on_error (bool): True to print a warning when an alias fails to
             match, False to ignore it.
         cc_fname (str): Filename of Cc file for per-commit Cc
-        self_only (bool): True to just email to yourself as a test
-        alias (dict or None): Alias dictionary: (None to use settings default)
+        alias (dict): Alias dictionary:
             key: alias
             value: list of aliases or email addresses
+        self_only (bool): True to just email to yourself as a test
         in_reply_to (str or None): If set we'll pass this to git as
             --in-reply-to - should be a message ID that this is in reply to.
         thread (bool): True to add --thread to git send-email (make
@@ -498,7 +497,7 @@ send --cc-cmd cc-fname" cover p1 p2'
     # Restore argv[0] since we clobbered it.
     >>> sys.argv[0] = _old_argv0
     """
-    to = build_email_list(series.get('to'), settings.alias, '--to', warn_on_error)
+    to = build_email_list(series.get('to'), alias, '--to', warn_on_error)
     if not to:
         git_config_to = command.output('git', 'config', 'sendemail.to',
                                        raise_on_error=False)
@@ -510,9 +509,9 @@ send --cc-cmd cc-fname" cover p1 p2'
                   "git config sendemail.to u-boot@lists.denx.de")
             return None
     cc = build_email_list(list(set(series.get('cc')) - set(series.get('to'))),
-                          settings.alias, '--cc', warn_on_error)
+                          alias, '--cc', warn_on_error)
     if self_only:
-        to = build_email_list([os.getenv('USER')], '--to', settings.alias,
+        to = build_email_list([os.getenv('USER')], '--to', alias,
                               warn_on_error)
         cc = []
     cmd = ['git', 'send-email', '--annotate']
@@ -535,14 +534,14 @@ send --cc-cmd cc-fname" cover p1 p2'
     return cmdstr
 
 
-def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
+def lookup_email(lookup_name, alias, warn_on_error=True, level=0):
     """If an email address is an alias, look it up and return the full name
 
     TODO: Why not just use git's own alias feature?
 
     Args:
         lookup_name (str): Alias or email address to look up
-        alias (dict or None): Alias dictionary: (None to use settings default)
+        alias (dict): Alias dictionary
             key: alias
             value: list of aliases or email addresses
         warn_on_error (bool): True to print a warning when an alias fails to
@@ -589,8 +588,6 @@ def lookup_email(lookup_name, alias=None, warn_on_error=True, level=0):
     Recursive email alias at 'mary'
     ['j.bloggs@napier.co.nz', 'm.poppins@cloud.net']
     """
-    if not alias:
-        alias = settings.alias
     lookup_name = lookup_name.strip()
     if '@' in lookup_name:      # Perhaps a real email address
         return [lookup_name]
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/5] patman: Pass aliases to Series.MakeCcFile()
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
                   ` (2 preceding siblings ...)
  2025-04-07 10:51 ` [PATCH 3/5] patman: Pass the alias dict into gitutil.email_patches() Simon Glass
@ 2025-04-07 10:51 ` Simon Glass
  2025-04-07 10:51 ` [PATCH 5/5] patman: Update Series.ShowActions() to pass alias Simon Glass
  2025-04-08 22:13 ` [PATCH 0/5] patman: Separate gitutil fully Tom Rini
  5 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Douglas Anderson, Sean Anderson, Tom Rini

Rather than accessing settings directly, pass the aliases in, so that
we can do the same from tests. With further work this will allow the
tests to work without using settings.alias

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/control.py   |  3 ++-
 tools/patman/func_test.py |  2 +-
 tools/patman/series.py    | 13 ++++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/tools/patman/control.py b/tools/patman/control.py
index f578336c7cc..13de9b6abfc 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -146,7 +146,8 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
         smtp_server (str): SMTP server to use to send patches (None for default)
     """
     cc_file = series.MakeCcFile(process_tags, cover_fname, not ignore_bad_tags,
-                                add_maintainers, limit, get_maintainer_script)
+                                add_maintainers, limit, get_maintainer_script,
+                                settings.alias)
 
     # Email the patches out (giving the user time to check / cancel)
     cmd = ''
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index b8fb49c34ba..c87c938808c 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -229,7 +229,7 @@ class TestFunctional(unittest.TestCase):
             series.DoChecks()
             cc_file = series.MakeCcFile(process_tags, cover_fname,
                                         not ignore_bad_tags, add_maintainers,
-                                        None, get_maintainer_script)
+                                        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)
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 51ae7f04c89..4322882abd5 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -242,7 +242,7 @@ class Series(dict):
 
     def GetCcForCommit(self, commit, process_tags, warn_on_error,
                        add_maintainers, limit, get_maintainer_script,
-                       all_skips):
+                       all_skips, alias):
         """Get the email CCs to use with a particular commit
 
         Uses subject tags and get_maintainers.pl script to find people to cc
@@ -262,6 +262,9 @@ class Series(dict):
             all_skips (set of str): Updated to include the set of bouncing email
                 addresses that were dropped from the output. This is essentially
                 a return value from this function.
+            alias (dict): Alias dictionary
+                key: alias
+                value: list of aliases or email addresses
 
         Returns:
             list of str: List of email addresses to cc
@@ -284,7 +287,7 @@ class Series(dict):
         return cc
 
     def MakeCcFile(self, process_tags, cover_fname, warn_on_error,
-                   add_maintainers, limit, get_maintainer_script):
+                   add_maintainers, limit, get_maintainer_script, alias):
         """Make a cc file for us to use for per-commit Cc automation
 
         Also stores in self._generated_cc to make ShowActions() faster.
@@ -300,6 +303,9 @@ class Series(dict):
             limit (int): Limit the length of the Cc list (None if no limit)
             get_maintainer_script (str): The file name of the get_maintainer.pl
                 script (or compatible).
+            alias (dict): Alias dictionary
+                key: alias
+                value: list of aliases or email addresses
         Return:
             Filename of temp file created
         """
@@ -314,7 +320,8 @@ class Series(dict):
                 commit.seq = i
                 commit.future = executor.submit(
                     self.GetCcForCommit, commit, process_tags, warn_on_error,
-                    add_maintainers, limit, get_maintainer_script, all_skips)
+                    add_maintainers, limit, get_maintainer_script, all_skips,
+                    alias)
 
             # Show progress any commits that are taking forever
             lastlen = 0
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 5/5] patman: Update Series.ShowActions() to pass alias
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
                   ` (3 preceding siblings ...)
  2025-04-07 10:51 ` [PATCH 4/5] patman: Pass aliases to Series.MakeCcFile() Simon Glass
@ 2025-04-07 10:51 ` Simon Glass
  2025-04-08 22:13 ` [PATCH 0/5] patman: Separate gitutil fully Tom Rini
  5 siblings, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-07 10:51 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Simon Glass, Douglas Anderson, Sean Anderson, Tom Rini

Instead of using settings.alias pass this value in. This allows tests to
work without using settings.alias

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/patman/control.py   |  2 +-
 tools/patman/func_test.py |  3 +--
 tools/patman/series.py    | 17 ++++++++++-------
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/tools/patman/control.py b/tools/patman/control.py
index 13de9b6abfc..9d7c9ef4478 100644
--- a/tools/patman/control.py
+++ b/tools/patman/control.py
@@ -161,7 +161,7 @@ def email_patches(col, series, cover_fname, patch_files, process_tags, its_a_go,
 
     # For a dry run, just show our actions as a sanity check
     if dry_run:
-        series.ShowActions(patch_files, cmd, process_tags)
+        series.ShowActions(patch_files, cmd, process_tags, settings.alias)
         if not its_a_go:
             print(col.build(col.RED, "Email would not be sent"))
 
diff --git a/tools/patman/func_test.py b/tools/patman/func_test.py
index c87c938808c..ce39f561f63 100644
--- a/tools/patman/func_test.py
+++ b/tools/patman/func_test.py
@@ -213,7 +213,6 @@ class TestFunctional(unittest.TestCase):
             'fred': [self.fred],
             'joe': [self.joe],
         }
-        settings.alias = alias
 
         text = self._get_text('test01.txt')
         series = patchstream.get_metadata_for_test(text)
@@ -233,7 +232,7 @@ class TestFunctional(unittest.TestCase):
             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)
+            series.ShowActions(args, cmd, process_tags, alias)
         cc_lines = open(cc_file, encoding='utf-8').read().splitlines()
         os.remove(cc_file)
 
diff --git a/tools/patman/series.py b/tools/patman/series.py
index 4322882abd5..3ec33e022d0 100644
--- a/tools/patman/series.py
+++ b/tools/patman/series.py
@@ -102,16 +102,19 @@ class Series(dict):
         commit.check_tags()
         self.commits.append(commit)
 
-    def ShowActions(self, args, cmd, process_tags):
+    def ShowActions(self, args, cmd, process_tags, alias):
         """Show what actions we will/would perform
 
         Args:
             args: List of patch files we created
             cmd: The git command we would have run
             process_tags: Process tags as if they were aliases
+            alias (dict): Alias dictionary
+                key: alias
+                value: list of aliases or email addresses
         """
-        to_set = set(gitutil.build_email_list(self.to, settings.alias));
-        cc_set = set(gitutil.build_email_list(self.cc, settings.alias));
+        to_set = set(gitutil.build_email_list(self.to, alias));
+        cc_set = set(gitutil.build_email_list(self.cc, alias));
 
         col = terminal.Color()
         print('Dry run, so not doing much. But I would do this:')
@@ -141,7 +144,7 @@ class Series(dict):
         if self.cover:
             print('Cover: %d lines' % len(self.cover))
             cover_cc = gitutil.build_email_list(self.get('cover_cc', ''),
-                                                settings.alias)
+                                                alias)
             all_ccs = itertools.chain(cover_cc, *self._generated_cc.values())
             for email in sorted(set(all_ccs) - to_set - cc_set):
                     print('      Cc: ', email)
@@ -271,9 +274,9 @@ class Series(dict):
         """
         cc = []
         if process_tags:
-            cc += gitutil.build_email_list(commit.tags, settings.alias,
+            cc += gitutil.build_email_list(commit.tags, alias,
                                            warn_on_error=warn_on_error)
-        cc += gitutil.build_email_list(commit.cc_list, settings.alias,
+        cc += gitutil.build_email_list(commit.cc_list, alias,
                                        warn_on_error=warn_on_error)
         if type(add_maintainers) == type(cc):
             cc += add_maintainers
@@ -353,7 +356,7 @@ class Series(dict):
 
         if cover_fname:
             cover_cc = gitutil.build_email_list(
-                self.get('cover_cc', ''), settings.alias)
+                self.get('cover_cc', ''), alias)
             cover_cc = list(set(cover_cc + all_ccs))
             if limit is not None:
                 cover_cc = cover_cc[:limit]
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] patman: Separate gitutil fully
  2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
                   ` (4 preceding siblings ...)
  2025-04-07 10:51 ` [PATCH 5/5] patman: Update Series.ShowActions() to pass alias Simon Glass
@ 2025-04-08 22:13 ` Tom Rini
  2025-04-09 13:04   ` Simon Glass
  5 siblings, 1 reply; 10+ messages in thread
From: Tom Rini @ 2025-04-08 22:13 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List, Douglas Anderson, Sean Anderson

[-- Attachment #1: Type: text/plain, Size: 1436 bytes --]

On Mon, Apr 07, 2025 at 10:51:42PM +1200, Simon Glass wrote:

> 
> The gitutil module uses Patman's settings module, which is not allowed
> as it is supposed to be a separate package. This series ties up this
> dependency.
> 
> This series depends on these two patches being applied:
> 
> https://patchwork.ozlabs.org/project/uboot/patch/20250227192735.406389-1-sjg@chromium.org/
> https://patchwork.ozlabs.org/project/uboot/patch/20250328130225.2607974-1-sjg@chromium.org/
> 
> 
> Simon Glass (5):
>   patman: Untangle settings from gitutil
>   patman: Pass the alias dict into gitutil.build_email_list()
>   patman: Pass the alias dict into gitutil.email_patches()
>   patman: Pass aliases to Series.MakeCcFile()
>   patman: Update Series.ShowActions() to pass alias
> 
>  tools/patman/control.py       | 11 ++++++++---
>  tools/patman/func_test.py     |  8 ++++----
>  tools/patman/series.py        | 32 ++++++++++++++++++++++----------
>  tools/u_boot_pylib/gitutil.py | 34 ++++++++++++++--------------------
>  4 files changed, 48 insertions(+), 37 deletions(-)

I just want to reiterate my question / request to host these outside of
the U-Boot sources themselves so they can be managed (both in the sense
of U-Boot as user and as maintainer of sources) following normal Python
best practices? I'd be fine even with something under
https://source.denx.de/u-boot/<something>/patman, etc.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] patman: Separate gitutil fully
  2025-04-08 22:13 ` [PATCH 0/5] patman: Separate gitutil fully Tom Rini
@ 2025-04-09 13:04   ` Simon Glass
  2025-04-09 13:08     ` Simon Glass
  2025-04-09 15:18     ` Tom Rini
  0 siblings, 2 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-09 13:04 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List, Douglas Anderson, Sean Anderson

Hi Tom,

On Tue, 8 Apr 2025 at 16:13, Tom Rini <trini@konsulko.com> wrote:
>
> On Mon, Apr 07, 2025 at 10:51:42PM +1200, Simon Glass wrote:
>
> >
> > The gitutil module uses Patman's settings module, which is not allowed
> > as it is supposed to be a separate package. This series ties up this
> > dependency.
> >
> > This series depends on these two patches being applied:
> >
> > https://patchwork.ozlabs.org/project/uboot/patch/20250227192735.406389-1-sjg@chromium.org/
> > https://patchwork.ozlabs.org/project/uboot/patch/20250328130225.2607974-1-sjg@chromium.org/
> >
> >
> > Simon Glass (5):
> >   patman: Untangle settings from gitutil
> >   patman: Pass the alias dict into gitutil.build_email_list()
> >   patman: Pass the alias dict into gitutil.email_patches()
> >   patman: Pass aliases to Series.MakeCcFile()
> >   patman: Update Series.ShowActions() to pass alias
> >
> >  tools/patman/control.py       | 11 ++++++++---
> >  tools/patman/func_test.py     |  8 ++++----
> >  tools/patman/series.py        | 32 ++++++++++++++++++++++----------
> >  tools/u_boot_pylib/gitutil.py | 34 ++++++++++++++--------------------
> >  4 files changed, 48 insertions(+), 37 deletions(-)
>
> I just want to reiterate my question / request to host these outside of
> the U-Boot sources themselves so they can be managed (both in the sense
> of U-Boot as user and as maintainer of sources) following normal Python
> best practices? I'd be fine even with something under
> https://source.denx.de/u-boot/<something>/patman, etc.

Yes I am working towards that. This series cleans up something missed
in the last series.

After this series there is really just 'patchstream' left, which is
used by buildman and patman. I haven't quite come to terms with the
idea of moving it to u_boot_pylib yet.

What are the best practices you are referring to?

As to location, I can keep it in my tree and just delete it from yours
if you like.

Regards,
Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] patman: Separate gitutil fully
  2025-04-09 13:04   ` Simon Glass
@ 2025-04-09 13:08     ` Simon Glass
  2025-04-09 15:18     ` Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Simon Glass @ 2025-04-09 13:08 UTC (permalink / raw)
  To: Tom Rini; +Cc: U-Boot Mailing List, Douglas Anderson, Sean Anderson

Hi Tom,

On Wed, 9 Apr 2025 at 07:04, Simon Glass <sjg@chromium.org> wrote:
>
> Hi Tom,
>
> On Tue, 8 Apr 2025 at 16:13, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Mon, Apr 07, 2025 at 10:51:42PM +1200, Simon Glass wrote:
> >
> > >
> > > The gitutil module uses Patman's settings module, which is not allowed
> > > as it is supposed to be a separate package. This series ties up this
> > > dependency.
> > >
> > > This series depends on these two patches being applied:
> > >
> > > https://patchwork.ozlabs.org/project/uboot/patch/20250227192735.406389-1-sjg@chromium.org/
> > > https://patchwork.ozlabs.org/project/uboot/patch/20250328130225.2607974-1-sjg@chromium.org/
> > >
> > >
> > > Simon Glass (5):
> > >   patman: Untangle settings from gitutil
> > >   patman: Pass the alias dict into gitutil.build_email_list()
> > >   patman: Pass the alias dict into gitutil.email_patches()
> > >   patman: Pass aliases to Series.MakeCcFile()
> > >   patman: Update Series.ShowActions() to pass alias
> > >
> > >  tools/patman/control.py       | 11 ++++++++---
> > >  tools/patman/func_test.py     |  8 ++++----
> > >  tools/patman/series.py        | 32 ++++++++++++++++++++++----------
> > >  tools/u_boot_pylib/gitutil.py | 34 ++++++++++++++--------------------
> > >  4 files changed, 48 insertions(+), 37 deletions(-)
> >
> > I just want to reiterate my question / request to host these outside of
> > the U-Boot sources themselves so they can be managed (both in the sense
> > of U-Boot as user and as maintainer of sources) following normal Python
> > best practices? I'd be fine even with something under
> > https://source.denx.de/u-boot/<something>/patman, etc.
>
> Yes I am working towards that. This series cleans up something missed
> in the last series.
>
> After this series there is really just 'patchstream' left, which is
> used by buildman and patman. I haven't quite come to terms with the
> idea of moving it to u_boot_pylib yet.
>
> What are the best practices you are referring to?
>
> As to location, I can keep it in my tree and just delete it from yours
> if you like.

BTW I'm working on better support for handling lots of series, as
mentioned a while back. I need to add some docs, but will send some
patches at some point in the next month.

Regards,
Simon

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/5] patman: Separate gitutil fully
  2025-04-09 13:04   ` Simon Glass
  2025-04-09 13:08     ` Simon Glass
@ 2025-04-09 15:18     ` Tom Rini
  1 sibling, 0 replies; 10+ messages in thread
From: Tom Rini @ 2025-04-09 15:18 UTC (permalink / raw)
  To: Simon Glass; +Cc: U-Boot Mailing List, Douglas Anderson, Sean Anderson

[-- Attachment #1: Type: text/plain, Size: 2373 bytes --]

On Wed, Apr 09, 2025 at 07:04:48AM -0600, Simon Glass wrote:
> Hi Tom,
> 
> On Tue, 8 Apr 2025 at 16:13, Tom Rini <trini@konsulko.com> wrote:
> >
> > On Mon, Apr 07, 2025 at 10:51:42PM +1200, Simon Glass wrote:
> >
> > >
> > > The gitutil module uses Patman's settings module, which is not allowed
> > > as it is supposed to be a separate package. This series ties up this
> > > dependency.
> > >
> > > This series depends on these two patches being applied:
> > >
> > > https://patchwork.ozlabs.org/project/uboot/patch/20250227192735.406389-1-sjg@chromium.org/
> > > https://patchwork.ozlabs.org/project/uboot/patch/20250328130225.2607974-1-sjg@chromium.org/
> > >
> > >
> > > Simon Glass (5):
> > >   patman: Untangle settings from gitutil
> > >   patman: Pass the alias dict into gitutil.build_email_list()
> > >   patman: Pass the alias dict into gitutil.email_patches()
> > >   patman: Pass aliases to Series.MakeCcFile()
> > >   patman: Update Series.ShowActions() to pass alias
> > >
> > >  tools/patman/control.py       | 11 ++++++++---
> > >  tools/patman/func_test.py     |  8 ++++----
> > >  tools/patman/series.py        | 32 ++++++++++++++++++++++----------
> > >  tools/u_boot_pylib/gitutil.py | 34 ++++++++++++++--------------------
> > >  4 files changed, 48 insertions(+), 37 deletions(-)
> >
> > I just want to reiterate my question / request to host these outside of
> > the U-Boot sources themselves so they can be managed (both in the sense
> > of U-Boot as user and as maintainer of sources) following normal Python
> > best practices? I'd be fine even with something under
> > https://source.denx.de/u-boot/<something>/patman, etc.
> 
> Yes I am working towards that. This series cleans up something missed
> in the last series.
> 
> After this series there is really just 'patchstream' left, which is
> used by buildman and patman. I haven't quite come to terms with the
> idea of moving it to u_boot_pylib yet.
> 
> What are the best practices you are referring to?

Hosting python projects in their own repository, and versioning them
and managing them via pip/etc.

> As to location, I can keep it in my tree and just delete it from yours
> if you like.

That would be very silly. Aside from the whole thing about you needing
to close down your fork, which this isn't even about.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-04-09 15:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 10:51 [PATCH 0/5] patman: Separate gitutil fully Simon Glass
2025-04-07 10:51 ` [PATCH 1/5] patman: Untangle settings from gitutil Simon Glass
2025-04-07 10:51 ` [PATCH 2/5] patman: Pass the alias dict into gitutil.build_email_list() Simon Glass
2025-04-07 10:51 ` [PATCH 3/5] patman: Pass the alias dict into gitutil.email_patches() Simon Glass
2025-04-07 10:51 ` [PATCH 4/5] patman: Pass aliases to Series.MakeCcFile() Simon Glass
2025-04-07 10:51 ` [PATCH 5/5] patman: Update Series.ShowActions() to pass alias Simon Glass
2025-04-08 22:13 ` [PATCH 0/5] patman: Separate gitutil fully Tom Rini
2025-04-09 13:04   ` Simon Glass
2025-04-09 13:08     ` Simon Glass
2025-04-09 15:18     ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox