Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-specfile for openSUSE:Factory checked in at 2023-04-25 16:43:01 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-specfile (Old) and /work/SRC/openSUSE:Factory/.python-specfile.new.1533 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-specfile" Tue Apr 25 16:43:01 2023 rev:10 rq:1082743 version:0.16.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-specfile/python-specfile.changes 2023-03-14 18:16:16.667614136 +0100 +++ /work/SRC/openSUSE:Factory/.python-specfile.new.1533/python-specfile.changes 2023-04-25 16:44:47.930929305 +0200 @@ -1,0 +2,7 @@ +Tue Apr 25 07:18:46 UTC 2023 - David Anes <david.a...@suse.com> + +- Update to version 0.16.0: + * Added Specfile.has_autorelease property to detect if a spec + file uses the %autorelease macro. (#221) + +------------------------------------------------------------------- Old: ---- specfile-0.15.0.tar.gz New: ---- specfile-0.16.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-specfile.spec ++++++ --- /var/tmp/diff_new_pack.OuxRTq/_old 2023-04-25 16:44:48.358931843 +0200 +++ /var/tmp/diff_new_pack.OuxRTq/_new 2023-04-25 16:44:48.366931890 +0200 @@ -18,7 +18,7 @@ %define skip_python38 1 Name: python-specfile -Version: 0.15.0 +Version: 0.16.0 Release: 0 Summary: A library for parsing and manipulating RPM spec files License: MIT ++++++ specfile-0.15.0.tar.gz -> specfile-0.16.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/.github/workflows/pypi-publish.yml new/specfile-0.16.0/.github/workflows/pypi-publish.yml --- old/specfile-0.15.0/.github/workflows/pypi-publish.yml 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/.github/workflows/pypi-publish.yml 2023-04-20 18:57:54.000000000 +0200 @@ -19,7 +19,7 @@ # https://pypa-build.readthedocs.io run: | python -m pip install build - python -m build --sdist --wheel + python -m build - name: Publish ð¦ to PyPI # https://github.com/pypa/gh-action-pypi-publish diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/.github/workflows/update-constants.yml new/specfile-0.16.0/.github/workflows/update-constants.yml --- old/specfile-0.15.0/.github/workflows/update-constants.yml 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/.github/workflows/update-constants.yml 2023-04-20 18:57:54.000000000 +0200 @@ -28,7 +28,7 @@ python scripts/update_constants.py specfile/constants.py rpm-source-tree/ case $? in 0) echo "pr=true" >> $GITHUB_OUTPUT;; - 100) echo "pr=false" >> $GITHUB_OUTPUT;; + 100) echo "pr=false" >> $GITHUB_OUTPUT; exit 0;; *) exit $?;; esac - name: Create Pull Request diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/.pre-commit-config.yaml new/specfile-0.16.0/.pre-commit-config.yaml --- old/specfile-0.15.0/.pre-commit-config.yaml 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/.pre-commit-config.yaml 2023-04-20 18:57:54.000000000 +0200 @@ -8,11 +8,11 @@ hooks: - id: pyupgrade - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.1.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.0-alpha.4 + rev: v3.0.0-alpha.6 hooks: - id: prettier - repo: https://github.com/pre-commit/pre-commit-hooks @@ -39,19 +39,19 @@ # https://github.com/PyCQA/pycodestyle/issues/373 - --extend-ignore=E203 - repo: https://github.com/PyCQA/isort - rev: 5.11.5 + rev: 5.12.0 hooks: - id: isort args: [--profile, black] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.991 + rev: v1.1.1 hooks: - id: mypy args: [--show-error-codes, --ignore-missing-imports] additional_dependencies: [types-pkg_resources, types-requests, types-python-dateutil] - repo: https://github.com/packit/pre-commit-hooks - rev: 8db5a24e01b9f54aaa7a800f33c4b9aa619af1b9 + rev: v1.0.0 hooks: - id: check-rebase args: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/CHANGELOG.md new/specfile-0.16.0/CHANGELOG.md --- old/specfile-0.15.0/CHANGELOG.md 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/CHANGELOG.md 2023-04-20 18:57:54.000000000 +0200 @@ -1,3 +1,7 @@ +# 0.16.0 + +- Added `Specfile.has_autorelease` property to detect if a spec file uses the `%autorelease` macro. (#221) + # 0.15.0 - Parsing the spec file by RPM is now performed only if really necessary, greatly improving performance in certain scenarios. (#212) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/PKG-INFO new/specfile-0.16.0/PKG-INFO --- old/specfile-0.15.0/PKG-INFO 2023-03-10 12:17:02.947491000 +0100 +++ new/specfile-0.16.0/PKG-INFO 2023-04-20 18:58:05.934381500 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: specfile -Version: 0.15.0 +Version: 0.16.0 Summary: A library for parsing and manipulating RPM spec files. Home-page: https://github.com/packit/specfile Author: Red Hat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/fedora/python-specfile.spec new/specfile-0.16.0/fedora/python-specfile.spec --- old/specfile-0.15.0/fedora/python-specfile.spec 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/fedora/python-specfile.spec 2023-04-20 18:57:54.000000000 +0200 @@ -13,7 +13,7 @@ Name: python-specfile -Version: 0.15.0 +Version: 0.16.0 Release: 1%{?dist} Summary: A library for parsing and manipulating RPM spec files @@ -67,6 +67,9 @@ %changelog +* Thu Apr 20 2023 Packit Team <he...@packit.dev> - 0.16.0-1 +- New upstream release 0.16.0 + * Fri Mar 10 2023 Packit Team <he...@packit.dev> - 0.15.0-1 - New upstream release 0.15.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/specfile/specfile.py new/specfile-0.16.0/specfile/specfile.py --- old/specfile-0.15.0/specfile/specfile.py 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/specfile/specfile.py 2023-04-20 18:57:54.000000000 +0200 @@ -23,7 +23,12 @@ from specfile.sources import Patches, Sources from specfile.spec_parser import SpecParser from specfile.tags import Tag, Tags -from specfile.value_parser import SUBSTITUTION_GROUP_PREFIX, ValueParser +from specfile.value_parser import ( + SUBSTITUTION_GROUP_PREFIX, + EnclosedMacroSubstitution, + MacroSubstitution, + ValueParser, +) class Specfile: @@ -374,15 +379,35 @@ section.data = patchlist.get_raw_section_data() @property + def has_autorelease(self) -> bool: + """Whether the spec file uses %autorelease.""" + for node in ValueParser.flatten(ValueParser.parse(self.raw_release)): + if ( + isinstance(node, (MacroSubstitution, EnclosedMacroSubstitution)) + and node.name == "autorelease" + ): + return True + return False + + @property def has_autochangelog(self) -> bool: """Whether the spec file uses %autochangelog.""" with self.sections() as sections: try: - section = sections.changelog + changelog = sections.changelog except AttributeError: return False - changelog = [ln.strip() for ln in section if ln.strip()] - return changelog == ["%autochangelog"] + for line in changelog: + if line.lstrip().startswith("#"): + # skip comments + continue + for node in ValueParser.flatten(ValueParser.parse(line)): + if ( + isinstance(node, (MacroSubstitution, EnclosedMacroSubstitution)) + and node.name == "autochangelog" + ): + return True + return False def add_changelog_entry( self, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/specfile/value_parser.py new/specfile-0.16.0/specfile/value_parser.py --- old/specfile-0.15.0/specfile/value_parser.py 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/specfile/value_parser.py 2023-04-20 18:57:54.000000000 +0200 @@ -228,7 +228,7 @@ i += 2 elif i < len(value) and value[i] in "*#": i += 1 - return i + 1 + return i result: List[Node] = [] start = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/specfile.egg-info/PKG-INFO new/specfile-0.16.0/specfile.egg-info/PKG-INFO --- old/specfile-0.15.0/specfile.egg-info/PKG-INFO 2023-03-10 12:17:02.000000000 +0100 +++ new/specfile-0.16.0/specfile.egg-info/PKG-INFO 2023-04-20 18:58:05.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: specfile -Version: 0.15.0 +Version: 0.16.0 Summary: A library for parsing and manipulating RPM spec files. Home-page: https://github.com/packit/specfile Author: Red Hat diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.15.0/tests/integration/test_specfile.py new/specfile-0.16.0/tests/integration/test_specfile.py --- old/specfile-0.15.0/tests/integration/test_specfile.py 2023-03-10 12:16:50.000000000 +0100 +++ new/specfile-0.16.0/tests/integration/test_specfile.py 2023-04-20 18:57:54.000000000 +0200 @@ -320,6 +320,26 @@ ] +@pytest.mark.parametrize( + "raw_release, has_autorelease", + [ + ("1%{?dist}", False), + ("%{release_number}%{?dist}", False), + ("0.27.%{commitdate}git%{shortcommit}%{?dist}", False), + ("%autorelease", True), + ("%{autorelease}", True), + ("%autorelease -b 4 -s %{date}git%{shortcommit}", True), + ("%{?autorelease}%{!?autorelease:1%{?dist}}", True), + ("0.10.%{date}git%{shortcommit}.%autorelease", True), + ("%{obsrel}.%{autorelease}", True), + ], +) +def test_autorelease(spec_rpmautospec, raw_release, has_autorelease): + spec = Specfile(spec_rpmautospec) + spec.raw_release = raw_release + assert spec.has_autorelease == has_autorelease + + @pytest.mark.skipif( rpm.__version__ < "4.16", reason="%autochangelog requires rpm 4.16 or higher" )