commit python-specfile for openSUSE:Factory
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 2024-01-03 12:24:23 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-specfile (Old) and /work/SRC/openSUSE:Factory/.python-specfile.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "python-specfile" Wed Jan 3 12:24:23 2024 rev:19 rq:1135634 version:0.26.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-specfile/python-specfile.changes 2023-11-23 21:43:31.173836981 +0100 +++ /work/SRC/openSUSE:Factory/.python-specfile.new.28375/python-specfile.changes 2024-01-03 12:24:30.718433686 +0100 @@ -1,0 +2,12 @@ +Fri Dec 29 10:17:19 UTC 2023 - Dirk Müller <dmueller@suse.com> + +- update to 0.26.0: + * When accessing tags or macro definitions by name, specfile + now takes validity into account when looking for the best + match. For example if there are two instances of `Version` + tag, one in the true and one in the false branch of a + condition, `Specfile.version` will always access the one that + is in the true branch. (#328) + * Third pre-release for testing Packit support. + +------------------------------------------------------------------- Old: ---- specfile-0.25.0.tar.gz New: ---- specfile-0.26.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-specfile.spec ++++++ --- /var/tmp/diff_new_pack.h9mIww/_old 2024-01-03 12:24:31.522463063 +0100 +++ /var/tmp/diff_new_pack.h9mIww/_new 2024-01-03 12:24:31.526463210 +0100 @@ -17,7 +17,7 @@ Name: python-specfile -Version: 0.25.0 +Version: 0.26.0 Release: 0 Summary: A library for parsing and manipulating RPM spec files License: MIT ++++++ specfile-0.25.0.tar.gz -> specfile-0.26.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/.github/workflows/prepare-release.yml new/specfile-0.26.0/.github/workflows/prepare-release.yml --- old/specfile-0.25.0/.github/workflows/prepare-release.yml 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/.github/workflows/prepare-release.yml 2023-12-11 11:24:25.000000000 +0100 @@ -20,10 +20,12 @@ with: fetch-depth: 0 - name: Prepare release content - uses: packit/prepare-release@v1 + uses: packit/prepare-release@v3 with: version: ${{ inputs.version }} specfiles: fedora/python-specfile.spec,epel8/python-specfile.spec + prerelease_suffix_pattern: "([.\\-_]?)(a(lpha)?|b(eta)?|r?c|pre(view)?)([.\\-_]?\\d+)?" + prerelease_suffix_macro: prerelease - name: Create Pull Request uses: peter-evans/create-pull-request@v4 with: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/.packit.yaml new/specfile-0.26.0/.packit.yaml --- old/specfile-0.25.0/.packit.yaml 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/.packit.yaml 2023-12-11 11:24:25.000000000 +0100 @@ -5,8 +5,8 @@ issue_repository: https://github.com/packit/specfile # PEP440 -#prerelease_suffix_pattern: "([.\\-_]?)(a(lpha)?|b(eta)?|r?c|pre(view)?)([.\\-_]?\\d+)?" -#prerelease_suffix_macro: prerelease +prerelease_suffix_pattern: "([.\\-_]?)(a(lpha)?|b(eta)?|r?c|pre(view)?)([.\\-_]?\\d+)?" +prerelease_suffix_macro: prerelease copy_upstream_release_description: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/.pre-commit-config.yaml new/specfile-0.26.0/.pre-commit-config.yaml --- old/specfile-0.25.0/.pre-commit-config.yaml 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/.pre-commit-config.yaml 2023-12-11 11:24:25.000000000 +0100 @@ -8,11 +8,11 @@ hooks: - id: pyupgrade - repo: https://github.com/psf/black - rev: 23.10.1 + rev: 23.11.0 hooks: - id: black - repo: https://github.com/pre-commit/mirrors-prettier - rev: v3.0.3 + rev: v3.1.0 hooks: - id: prettier - repo: https://github.com/pre-commit/pre-commit-hooks @@ -44,14 +44,14 @@ - id: isort args: [--profile, black] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.6.1 + rev: v1.7.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/teemtee/tmt.git - rev: 1.28.2 + rev: 1.29.0 hooks: - id: tmt-lint # linting of the reverse-dependency tests requires internet access diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/CHANGELOG.md new/specfile-0.26.0/CHANGELOG.md --- old/specfile-0.25.0/CHANGELOG.md 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/CHANGELOG.md 2023-12-11 11:24:25.000000000 +0100 @@ -1,3 +1,11 @@ +# 0.26.0 + +- When accessing tags or macro definitions by name, specfile now takes validity into account when looking for the best match. For example if there are two instances of `Version` tag, one in the true and one in the false branch of a condition, `Specfile.version` will always access the one that is in the true branch. (#328) + +# 0.25.1rc1 + +- Third pre-release for testing Packit support. + # 0.25.0 - There is a new method, `Specfile.update_version()`, that allows updating spec file version even if it is a pre-release. (#317) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/PKG-INFO new/specfile-0.26.0/PKG-INFO --- old/specfile-0.25.0/PKG-INFO 2023-11-20 15:56:01.348562000 +0100 +++ new/specfile-0.26.0/PKG-INFO 2023-12-11 11:24:32.313039300 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: specfile -Version: 0.25.0 +Version: 0.26.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.25.0/epel8/python-specfile.spec new/specfile-0.26.0/epel8/python-specfile.spec --- old/specfile-0.25.0/epel8/python-specfile.spec 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/epel8/python-specfile.spec 2023-12-11 11:24:25.000000000 +0100 @@ -4,8 +4,8 @@ in a minimal diff.} -%global base_version 0.25.0 -#global prerelease rc2 +%global base_version 0.26.0 +#%global prerelease rc1 %global package_version %{base_version}%{?prerelease:~%{prerelease}} %global pypi_version %{base_version}%{?prerelease} @@ -68,6 +68,12 @@ %changelog +* Fri Dec 08 2023 Packit Team <hello@packit.dev> - 0.26.0-1 +- New upstream release 0.26.0 + +* Mon Nov 20 2023 Packit Team <hello@packit.dev> - 0.25.1~rc1-1 +- New upstream release 0.25.1rc1 + * Mon Nov 20 2023 Packit Team <hello@packit.dev> - 0.25.0-1 - New upstream release 0.25.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/fedora/python-specfile.spec new/specfile-0.26.0/fedora/python-specfile.spec --- old/specfile-0.25.0/fedora/python-specfile.spec 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/fedora/python-specfile.spec 2023-12-11 11:24:25.000000000 +0100 @@ -7,8 +7,8 @@ in a minimal diff.} -%global base_version 0.25.0 -#global prerelease rc2 +%global base_version 0.26.0 +#%global prerelease rc1 %global package_version %{base_version}%{?prerelease:~%{prerelease}} %global pypi_version %{base_version}%{?prerelease} @@ -77,6 +77,12 @@ %changelog +* Fri Dec 08 2023 Packit Team <hello@packit.dev> - 0.26.0-1 +- New upstream release 0.26.0 + +* Mon Nov 20 2023 Packit Team <hello@packit.dev> - 0.25.1~rc1-1 +- New upstream release 0.25.1rc1 + * Mon Nov 20 2023 Packit Team <hello@packit.dev> - 0.25.0-1 - New upstream release 0.25.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/specfile/macro_definitions.py new/specfile-0.26.0/specfile/macro_definitions.py --- old/specfile-0.25.0/specfile/macro_definitions.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/specfile/macro_definitions.py 2023-12-11 11:24:25.000000000 +0100 @@ -219,11 +219,36 @@ return self.data[self.find(name, position)] def find(self, name: str, position: Optional[int] = None) -> int: + """ + Finds a macro definition with the specified name. If position is not specified, + returns the first valid matching macro definiton. If there is no such macro + definition, returns the first match, if any. If position is specified and there is + a matching macro definition at that position, it is returned, otherwise + ValueError is raised. + + Args: + name: Name of the tag to find. + position: Optional position in the spec file. + + Returns: + Index of the matching tag. + + Raises: + ValueError if there is no match. + """ + first_match = None for i, macro_definition in enumerate(self.data): if macro_definition.name == name: - if position is None or macro_definition.get_position(self) == position: + if position is None: + if first_match is None: + first_match = i + if macro_definition.valid: + return i + elif macro_definition.get_position(self) == position: return i - raise ValueError + if first_match is None or position is not None: + raise ValueError + return first_match @classmethod def _parse( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/specfile/options.py new/specfile-0.26.0/specfile/options.py --- old/specfile-0.25.0/specfile/options.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/specfile/options.py 2023-12-11 11:24:25.000000000 +0100 @@ -9,7 +9,7 @@ from specfile.exceptions import OptionsException from specfile.formatter import formatted -from specfile.value_parser import Node, StringLiteral, ValueParser +from specfile.value_parser import StringLiteral, ValueParser class TokenType(Enum): @@ -476,79 +476,67 @@ OptionsException if the option string is untokenizable. """ result: List[Token] = [] - - def append_default(s): - if result and result[-1].type == TokenType.DEFAULT: - result[-1].value += s - else: - result.append(Token(TokenType.DEFAULT, s)) - - token_nodes: List[Node] = [] + token = "" + quote = None + inp = [] for node in ValueParser.parse(option_string): if isinstance(node, StringLiteral): - if token_nodes: - append_default("".join(str(n) for n in token_nodes)) - token_nodes = [] - token = "" + inp.extend(list(str(node))) + continue + inp.append(str(node)) + while inp: + c = inp.pop(0) + if c == quote: + if token: + result.append( + Token( + TokenType.QUOTED + if quote == "'" + else TokenType.DOUBLE_QUOTED, + token, + ) + ) + token = "" quote = None - inp = list(str(node)) + continue + if quote: + if c == "\\": + if not inp: + raise OptionsException("No escaped character") + c = inp.pop(0) + if c != quote: + token += "\\" + token += c + continue + if c.isspace(): + if token: + result.append(Token(TokenType.DEFAULT, token)) + token = "" + whitespace = c while inp: c = inp.pop(0) - if c == quote: - if token: - result.append( - Token( - TokenType.QUOTED - if quote == "'" - else TokenType.DOUBLE_QUOTED, - token, - ) - ) - token = "" - quote = None - continue - if quote: - if c == "\\": - if not inp: - raise OptionsException("No escaped character") - c = inp.pop(0) - if c != quote: - token += "\\" - token += c - continue - if c.isspace(): - if token: - append_default(token) - token = "" - whitespace = c - while inp: - c = inp.pop(0) - if not c.isspace(): - break - whitespace += c - else: - result.append(Token(TokenType.WHITESPACE, whitespace)) - break - inp.insert(0, c) - result.append(Token(TokenType.WHITESPACE, whitespace)) - continue - if c in ('"', "'"): - if token: - append_default(token) - token = "" - quote = c - continue - if c == "\\": - if not inp: - raise OptionsException("No escaped character") - c = inp.pop(0) - token += c - if quote: - raise OptionsException("No closing quotation") + if not c.isspace(): + break + whitespace += c + else: + result.append(Token(TokenType.WHITESPACE, whitespace)) + break + inp.insert(0, c) + result.append(Token(TokenType.WHITESPACE, whitespace)) + continue + if c in ('"', "'"): if token: - append_default(token) - else: - token_nodes.append(node) - if token_nodes: - append_default("".join(str(n) for n in token_nodes)) + result.append(Token(TokenType.DEFAULT, token)) + token = "" + quote = c + continue + if c == "\\": + if not inp: + raise OptionsException("No escaped character") + c = inp.pop(0) + token += c + if quote: + raise OptionsException("No closing quotation") + if token: + result.append(Token(TokenType.DEFAULT, token)) return result diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/specfile/specfile.py new/specfile-0.26.0/specfile/specfile.py --- old/specfile-0.25.0/specfile/specfile.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/specfile/specfile.py 2023-12-11 11:24:25.000000000 +0100 @@ -354,7 +354,9 @@ try: yield Sources( tags, - list(zip(*sourcelists))[1] if sourcelists else [], + cast(List[Sourcelist], list(zip(*sourcelists))[1]) + if sourcelists + else [], allow_duplicates, default_to_implicit_numbering, default_source_number_digits, @@ -391,7 +393,9 @@ try: yield Patches( tags, - list(zip(*patchlists))[1] if patchlists else [], + cast(List[Sourcelist], list(zip(*patchlists))[1]) + if patchlists + else [], allow_duplicates, default_to_implicit_numbering, default_source_number_digits, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/specfile/tags.py new/specfile-0.26.0/specfile/tags.py --- old/specfile-0.25.0/specfile/tags.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/specfile/tags.py 2023-12-11 11:24:25.000000000 +0100 @@ -441,11 +441,35 @@ return self.data[self.find(name, position)] def find(self, name: str, position: Optional[int] = None) -> int: + """ + Finds a tag with the specified name. If position is not specified, + returns the first valid matching tag. If there is no such tag, returns + the first match, if any. If position is specified and there is a matching + tag at that position, it is returned, otherwise ValueError is raised. + + Args: + name: Name of the tag to find. + position: Optional position in the spec file. + + Returns: + Index of the matching tag. + + Raises: + ValueError if there is no match. + """ + first_match = None for i, tag in enumerate(self.data): if tag.name.capitalize() == name.capitalize(): - if position is None or tag.get_position(self) == position: + if position is None: + if first_match is None: + first_match = i + if tag.valid: + return i + elif tag.get_position(self) == position: return i - raise ValueError + if first_match is None or position is not None: + raise ValueError + return first_match def insert(self, i: int, item: Tag) -> None: if i > len(self.data): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/specfile.egg-info/PKG-INFO new/specfile-0.26.0/specfile.egg-info/PKG-INFO --- old/specfile-0.25.0/specfile.egg-info/PKG-INFO 2023-11-20 15:56:01.000000000 +0100 +++ new/specfile-0.26.0/specfile.egg-info/PKG-INFO 2023-12-11 11:24:32.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: specfile -Version: 0.25.0 +Version: 0.26.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.25.0/specfile.egg-info/SOURCES.txt new/specfile-0.26.0/specfile.egg-info/SOURCES.txt --- old/specfile-0.25.0/specfile.egg-info/SOURCES.txt 2023-11-20 15:56:01.000000000 +0100 +++ new/specfile-0.26.0/specfile.egg-info/SOURCES.txt 2023-12-11 11:24:32.000000000 +0100 @@ -96,6 +96,11 @@ tests/data/spec_commented_patches/test-0.1.tar.xz tests/data/spec_commented_patches/test.spec tests/data/spec_conditionalized_changelog/test.spec +tests/data/spec_conditionalized_version/patch0.patch +tests/data/spec_conditionalized_version/patch1.patch +tests/data/spec_conditionalized_version/patch2.patch +tests/data/spec_conditionalized_version/test-0.1.2.tar.xz +tests/data/spec_conditionalized_version/test.spec tests/data/spec_includes/description1.inc tests/data/spec_includes/description2.inc tests/data/spec_includes/macros1.inc @@ -132,7 +137,7 @@ tests/data/spec_prerelease/patch0.patch tests/data/spec_prerelease/patch1.patch tests/data/spec_prerelease/patch2.patch -tests/data/spec_prerelease/test-v0.1.2~rc2.tar.xz +tests/data/spec_prerelease/test-v0.1.2-rc2.tar.xz tests/data/spec_prerelease/test.spec tests/data/spec_rpmautospec/test.spec tests/data/spec_shell_expansions/test.spec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/constants.py new/specfile-0.26.0/tests/constants.py --- old/specfile-0.25.0/tests/constants.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/tests/constants.py 2023-12-11 11:24:25.000000000 +0100 @@ -18,5 +18,6 @@ SPEC_COMMENTED_PATCHES = DATA_DIR / "spec_commented_patches" SPEC_SHELL_EXPANSIONS = DATA_DIR / "spec_shell_expansions" SPEC_CONDITIONALIZED_CHANGELOG = DATA_DIR / "spec_conditionalized_changelog" +SPEC_CONDITIONALIZED_VERSION = DATA_DIR / "spec_conditionalized_version" SPECFILE = "test.spec" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch0.patch new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch0.patch --- old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch0.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch0.patch 2023-12-11 11:24:25.000000000 +0100 @@ -0,0 +1,18 @@ +From b7af0b9194585c6d208de3a0e9978d5ad9c5d97b Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com> +Date: Wed, 16 Mar 2022 10:29:59 +0100 +Subject: [PATCH 1/3] patch0 + +--- + test.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test.txt b/test.txt +index 9daeafb..dec2cbe 100644 +--- a/test.txt ++++ b/test.txt +@@ -1 +1,2 @@ + test ++test +-- +2.35.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch1.patch new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch1.patch --- old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch1.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch1.patch 2023-12-11 11:24:25.000000000 +0100 @@ -0,0 +1,19 @@ +From 6d5d1561b3ccf2df9d001a7af011144acc352361 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com> +Date: Wed, 16 Mar 2022 10:30:15 +0100 +Subject: [PATCH 2/3] patch1 + +--- + test.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test.txt b/test.txt +index dec2cbe..0867e73 100644 +--- a/test.txt ++++ b/test.txt +@@ -1,2 +1,3 @@ + test + test ++test +-- +2.35.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch2.patch new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch2.patch --- old/specfile-0.25.0/tests/data/spec_conditionalized_version/patch2.patch 1970-01-01 01:00:00.000000000 +0100 +++ new/specfile-0.26.0/tests/data/spec_conditionalized_version/patch2.patch 2023-12-11 11:24:25.000000000 +0100 @@ -0,0 +1,20 @@ +From ae1d3bbca0caf1cce1842ceab4c6d7252c0a7bd8 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com> +Date: Wed, 16 Mar 2022 10:30:29 +0100 +Subject: [PATCH 3/3] patch2 + +--- + test.txt | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test.txt b/test.txt +index 0867e73..d0c7fbe 100644 +--- a/test.txt ++++ b/test.txt +@@ -1,3 +1,4 @@ + test + test + test ++test +-- +2.35.1 Binary files old/specfile-0.25.0/tests/data/spec_conditionalized_version/test-0.1.2.tar.xz and new/specfile-0.26.0/tests/data/spec_conditionalized_version/test-0.1.2.tar.xz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/data/spec_conditionalized_version/test.spec new/specfile-0.26.0/tests/data/spec_conditionalized_version/test.spec --- old/specfile-0.25.0/tests/data/spec_conditionalized_version/test.spec 1970-01-01 01:00:00.000000000 +0100 +++ new/specfile-0.26.0/tests/data/spec_conditionalized_version/test.spec 2023-12-11 11:24:25.000000000 +0100 @@ -0,0 +1,41 @@ +%dnl %global commit 202ab7e698a34154129bb9ded589db58996eeb53 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +%global upstream_version 0.1.2 + +Name: test +%if 0%{?commit:1} +Version: %{upstream_version}^git%{shortcommit} +%else +Version: %{upstream_version} +%endif +Release: 1%{?dist} +Summary: Test package + +License: MIT + +%if 0%{?commit:1} +Source0: https://example.com/archive/%{name}/%{commit}/%{name}-%{shortcommit}.tar.xz +%else +Source0: https://example.com/archive/%{name}/v%{version}/%{name}-%{version}.tar.xz +%endif +Patch0: patch0.patch +Patch1: patch1.patch +Patch2: patch2.patch + + +%description +Test package + + +%prep +%if 0%{?commit:1} +%autosetup -p1 -n %{name}-%{shortcommit} +%else +%autosetup -p1 -n %{name}-%{version} +%endif + + +%changelog +* Thu Jun 07 2018 Nikola Forró <nforro@redhat.com> - 0.1.2-1 +- first version Binary files old/specfile-0.25.0/tests/data/spec_prerelease/test-v0.1.2-rc2.tar.xz and new/specfile-0.26.0/tests/data/spec_prerelease/test-v0.1.2-rc2.tar.xz differ Binary files old/specfile-0.25.0/tests/data/spec_prerelease/test-v0.1.2~rc2.tar.xz and new/specfile-0.26.0/tests/data/spec_prerelease/test-v0.1.2~rc2.tar.xz differ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/integration/conftest.py new/specfile-0.26.0/tests/integration/conftest.py --- old/specfile-0.25.0/tests/integration/conftest.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/tests/integration/conftest.py 2023-12-11 11:24:25.000000000 +0100 @@ -10,6 +10,7 @@ SPEC_AUTOSETUP, SPEC_COMMENTED_PATCHES, SPEC_CONDITIONALIZED_CHANGELOG, + SPEC_CONDITIONALIZED_VERSION, SPEC_INCLUDES, SPEC_MACROS, SPEC_MINIMAL, @@ -112,3 +113,10 @@ specfile_path = tmp_path / SPECFILE shutil.copyfile(SPEC_CONDITIONALIZED_CHANGELOG / SPECFILE, specfile_path) return specfile_path + + +@pytest.fixture(scope="function") +def spec_conditionalized_version(tmp_path): + specfile_path = tmp_path / SPECFILE + shutil.copyfile(SPEC_CONDITIONALIZED_VERSION / SPECFILE, specfile_path) + return specfile_path diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/integration/test_specfile.py new/specfile-0.26.0/tests/integration/test_specfile.py --- old/specfile-0.25.0/tests/integration/test_specfile.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/tests/integration/test_specfile.py 2023-12-11 11:24:25.000000000 +0100 @@ -575,7 +575,7 @@ rpm.__version__ < "4.16", reason="condition expression evaluation requires rpm 4.16 or higher", ) -def test_update_version(spec_prerelease): +def test_update_version(spec_prerelease, spec_conditionalized_version): spec = Specfile(spec_prerelease) prerelease_suffix_pattern = r"(-)rc\d+" prerelease_suffix_macro = "prerel" @@ -609,3 +609,20 @@ assert md.prerel.body == "rc2" assert md.prerel.commented_out assert spec.version == "%{pkgver}" + spec = Specfile(spec_conditionalized_version) + version = "0.1.3" + assert spec.version == "%{upstream_version}" + spec.update_version(version, prerelease_suffix_pattern) + with spec.macro_definitions() as md: + assert md.upstream_version.body == version + assert spec.version == "%{upstream_version}" + assert spec.expanded_version == version + spec = Specfile(spec_conditionalized_version) + with spec.macro_definitions() as md: + md.commit.commented_out = False + assert spec.version == "%{upstream_version}^git%{shortcommit}" + spec.update_version(version, prerelease_suffix_pattern) + with spec.macro_definitions() as md: + assert md.upstream_version.body != version + assert spec.version == version + assert spec.expanded_version == version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/specfile-0.25.0/tests/unit/test_options.py new/specfile-0.26.0/tests/unit/test_options.py --- old/specfile-0.25.0/tests/unit/test_options.py 2023-11-20 15:55:51.000000000 +0100 +++ new/specfile-0.26.0/tests/unit/test_options.py 2023-12-11 11:24:25.000000000 +0100 @@ -258,6 +258,36 @@ Token(TokenType.DEFAULT, '%{name}-%{version}%[%{rc}?"-rc":""]'), ], ), + ( + "-q -n '%{name}-%{version}'", + [ + Token(TokenType.DEFAULT, "-q"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.DEFAULT, "-n"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.QUOTED, "%{name}-%{version}"), + ], + ), + ( + '-q -n "%{name}-%{version}"', + [ + Token(TokenType.DEFAULT, "-q"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.DEFAULT, "-n"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.DOUBLE_QUOTED, "%{name}-%{version}"), + ], + ), + ( + '-q -n \'%{name}-%{version}%[%{rc}?"-rc":""]\'', + [ + Token(TokenType.DEFAULT, "-q"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.DEFAULT, "-n"), + Token(TokenType.WHITESPACE, " "), + Token(TokenType.QUOTED, '%{name}-%{version}%[%{rc}?"-rc":""]'), + ], + ), ], ) def test_options_tokenize(option_string, result):
participants (1)
-
Source-Sync