From dca7926c2cb82ff4aea665ed97e38520d39865a5 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Fri, 7 Jan 2022 15:15:55 -0800 Subject: patman: Support absolute and ~user-relative alias files Python doesn't naturally support tilde (~) as a user-home marker in paths, but git-config does. So we need to resolve it before continuing. We also shouldn't blindly join the top-level tree with the aliasesfile path, because it might be an absolute path. This resolves warnings like the following: Warning: Cannot find alias file '/path/to/source/tree/~/.git-email' Seen when git-config is like: $ git config sendemail.aliasesfile ~/.git-email Signed-off-by: Brian Norris Reviewed-by: Simon Glass Reviewed-by: Otavio Salvador --- tools/patman/gitutil.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'tools') diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 5e4c1128dcb..e1ef96df22e 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -616,9 +616,14 @@ def GetAliasFile(): """ fname = command.OutputOneLine('git', 'config', 'sendemail.aliasesfile', raise_on_error=False) - if fname: - fname = os.path.join(GetTopLevel(), fname.strip()) - return fname + if not fname: + return None + + fname = os.path.expanduser(fname.strip()) + if os.path.isabs(fname): + return fname + + return os.path.join(GetTopLevel(), fname) def GetDefaultUserName(): """Gets the user.name from .gitconfig file. -- cgit v1.2.3 From 5ecdd529ae38fecd35bfc41869058802c804a01e Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Tue, 11 Jan 2022 15:34:50 +0000 Subject: genboardscfg: limit to 240 jobs When genboardscfg.py is run on machines with 255 or more cores, the process will consume more than 1024 file descriptors, which is a common standard ulimit for user processes. As a consequence it will fail with a lenghty Python trace, with the almost hidden message: OSError: [Errno 24] Too many open files It's somewhat questionable whether that level of parallelity is actually useful for genboardscfg, so we limit the *default* number of jobs to the safe number of 240, to avoid the problem. If a user persists, she can still force a higher number via the -j parameter - hopefully having raised the ulimit accordingly beforehand. Signed-off-by: Andre Przywara Reviewed-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- tools/genboardscfg.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/genboardscfg.py b/tools/genboardscfg.py index 4ee7aa1f891..07bf681d1d9 100755 --- a/tools/genboardscfg.py +++ b/tools/genboardscfg.py @@ -430,7 +430,7 @@ def main(): # Add options here parser.add_option('-f', '--force', action="store_true", default=False, help='regenerate the output even if it is new') - parser.add_option('-j', '--jobs', type='int', default=cpu_count, + parser.add_option('-j', '--jobs', type='int', default=min(cpu_count, 240), help='the number of jobs to run simultaneously') parser.add_option('-o', '--output', default=OUTPUT_FILE, help='output file [default=%s]' % OUTPUT_FILE) -- cgit v1.2.3