diff options
author | Tim Harder <radhermit@gmail.com> | 2021-06-03 07:42:40 -0600 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2021-06-03 07:42:40 -0600 |
commit | 9e704b3170acae0388d60888772b94ba31a4a9e6 (patch) | |
tree | 8a2e3a67cb746c924fad79aab18219dd91fa0eb4 | |
parent | pkgdev commit: add initial USE_RUBY summary generation support (diff) | |
download | pkgdev-9e704b3170acae0388d60888772b94ba31a4a9e6.tar.gz pkgdev-9e704b3170acae0388d60888772b94ba31a4a9e6.tar.bz2 pkgdev-9e704b3170acae0388d60888772b94ba31a4a9e6.zip |
pkgdev commit: add initial support for LUA_COMPAT summary generation
And make target summary generation more generic between array/string var
types.
-rw-r--r-- | src/pkgdev/scripts/pkgdev_commit.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/pkgdev/scripts/pkgdev_commit.py b/src/pkgdev/scripts/pkgdev_commit.py index ded022c..b75ed97 100644 --- a/src/pkgdev/scripts/pkgdev_commit.py +++ b/src/pkgdev/scripts/pkgdev_commit.py @@ -400,23 +400,23 @@ class PkgSummary(ChangeSummary): add[mo.group('name')] = mo.group('value') watch_vars = {'HOMEPAGE', 'DESCRIPTION', 'LICENSE', 'SRC_URI'} + array_targets = {'PYTHON_COMPAT', 'LUA_COMPAT'} + string_targets = {'USE_RUBY'} + targets = array_targets | string_targets + updated_vars = drop.keys() & add.keys() if updated := sorted(watch_vars & updated_vars): return f"update {', '.join(updated)}" - elif 'PYTHON_COMPAT' in updated_vars: - array_re = re.compile(r'\[\d+\]="(?P<val>.+?)"') - py_re = lambda x: re.sub(r'^python(\d+)_(\d+)$', r'py\1.\2', x) - old = {py_re(m.group('val')) for m in re.finditer(array_re, drop['PYTHON_COMPAT'])} - new = {py_re(m.group('val')) for m in re.finditer(array_re, add['PYTHON_COMPAT'])} - msg = [] - if added := sorted(new - old): - msg.append(f"enable {', '.join(added)}") - if dropped := sorted(old - new): - msg.append(f"disable {', '.join(dropped)}") - return ' and '.join(msg) - elif 'USE_RUBY' in updated_vars: - old = set(drop['USE_RUBY'].strip('"').split()) - new = set(add['USE_RUBY'].strip('"').split()) + elif (target := targets & updated_vars) and len(target) == 1: + target = next(iter(target)) + if target in array_targets: + array_re = re.compile(r'\[\d+\]="(?P<val>.+?)"') + py_re = lambda x: re.sub(r'^python(\d+)_(\d+)$', r'py\1.\2', x) + old = {py_re(m.group('val')) for m in re.finditer(array_re, drop[target])} + new = {py_re(m.group('val')) for m in re.finditer(array_re, add[target])} + else: + old = set(drop[target].strip('"').split()) + new = set(add[target].strip('"').split()) msg = [] if added := sorted(new - old): msg.append(f"enable {', '.join(added)}") |