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-10-30 22:11:09
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-specfile (Old)
and /work/SRC/openSUSE:Factory/.python-specfile.new.17445 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-specfile"
Mon Oct 30 22:11:09 2023 rev:16 rq:1121152 version:0.23.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-specfile/python-specfile.changes
2023-10-17 20:25:05.427475492 +0200
+++
/work/SRC/openSUSE:Factory/.python-specfile.new.17445/python-specfile.changes
2023-10-30 22:11:39.226138880 +0100
@@ -1,0 +2,8 @@
+Mon Oct 30 10:14:03 UTC 2023 - David Anes <[email protected]>
+
+- Update to 0.23.0:
+ - Sources now have a valid property that indicates whether a
+ source is valid in the current context, meaning it is not
+ present in a false branch of any condition.
+
+-------------------------------------------------------------------
Old:
----
specfile-0.22.1.tar.gz
New:
----
specfile-0.23.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-specfile.spec ++++++
--- /var/tmp/diff_new_pack.p0mDMi/_old 2023-10-30 22:11:39.906163967 +0100
+++ /var/tmp/diff_new_pack.p0mDMi/_new 2023-10-30 22:11:39.906163967 +0100
@@ -17,7 +17,7 @@
Name: python-specfile
-Version: 0.22.1
+Version: 0.23.0
Release: 0
Summary: A library for parsing and manipulating RPM spec files
License: MIT
++++++ specfile-0.22.1.tar.gz -> specfile-0.23.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/.pre-commit-config.yaml
new/specfile-0.23.0/.pre-commit-config.yaml
--- old/specfile-0.22.1/.pre-commit-config.yaml 2023-10-06 15:07:44.000000000
+0200
+++ new/specfile-0.23.0/.pre-commit-config.yaml 2023-10-30 10:13:03.000000000
+0100
@@ -4,7 +4,7 @@
repos:
- repo: https://github.com/asottile/pyupgrade
- rev: v3.11.0
+ rev: v3.14.0
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
@@ -54,6 +54,8 @@
rev: 1.27.0
hooks:
- id: tmt-lint
+ # linting of the reverse-dependency tests requires internet access
+ stages: [manual, push]
- repo: https://github.com/packit/pre-commit-hooks
rev: v1.2.0
hooks:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/CHANGELOG.md
new/specfile-0.23.0/CHANGELOG.md
--- old/specfile-0.22.1/CHANGELOG.md 2023-10-06 15:07:44.000000000 +0200
+++ new/specfile-0.23.0/CHANGELOG.md 2023-10-30 10:13:03.000000000 +0100
@@ -1,3 +1,7 @@
+# 0.23.0
+
+- Sources now have a `valid` property that indicates whether a source is valid
in the current context, meaning it is not present in a false branch of any
condition. (#295)
+
# 0.22.1
- Removed dependency on setuptools-scm-git-archive. (#290)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/PKG-INFO new/specfile-0.23.0/PKG-INFO
--- old/specfile-0.22.1/PKG-INFO 2023-10-06 15:07:52.815003400 +0200
+++ new/specfile-0.23.0/PKG-INFO 2023-10-30 10:13:11.669105000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: specfile
-Version: 0.22.1
+Version: 0.23.0
Summary: A library for parsing and manipulating RPM spec files.
Home-page: https://github.com/packit/specfile
Author: Red Hat
@@ -39,8 +39,6 @@
Python library for parsing and manipulating RPM spec files. Main focus is on
modifying existing spec files, any change should result in a minimal diff.
-This project is still a work in progress.
-
## Motivation
Originally, [rebase-helper](https://github.com/rebase-helper/rebase-helper/)
provided an API for spec file modifications that was also used by
[packit](https://github.com/packit/packit). The goal of this project is to make
the interface more general and convenient to use by not only packit but also by
other Python projects that need to interact with RPM spec files.
@@ -289,11 +287,43 @@
print(len(specfile.sources().content))
```
-## Caveats
+### Validity
+
+Macro definitions, tags, `%sourcelist`/`%patchlist` entries and
sources/patches have a `valid` attribute. An entity is considered valid if it
isn't present in a false branch of any condition.
+
+Consider the following in a spec file:
+
+```specfile
+%if 0%{?fedora} >= 36
+Recommends: %{name}-selinux
+%endif
+```
+
+Provided there are no other `Recommends` tags, the following would print
`True` or `False` depending on the value of the `%fedora` macro:
+
+```python
+with specfile.tags() as tags:
+ print(tags.recommends.valid)
+```
+
+You can define macros or redefine/undefine system macros using the `macros`
argument of the constructor or by modifying the `macros` attribute of a
`Specfile` instance.
+
+The same applies to `%ifarch`/`%ifos` statements:
+
+```specfile
+%ifarch %{java_arches}
+BuildRequires: java-devel
+%endif
+```
-### RPM macros
+Provided there are no other `BuildRequires` tags, the following would print
`True` in case the current platform was part of `%java_arches`:
+
+```python
+with specfile.tags() as tags:
+ print(tags.buildrequires.valid)
+```
-specfile uses RPM for parsing spec files and macro expansion. Unfortunately,
macros are always stored in a global context, which poses a problem for
multiple instances of Specfile.
+To override this, you would have to redefine the `%_target_cpu` system macro
(or `%_target_os` in case of `%ifos`).
## Videos
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/README.md
new/specfile-0.23.0/README.md
--- old/specfile-0.22.1/README.md 2023-10-06 15:07:44.000000000 +0200
+++ new/specfile-0.23.0/README.md 2023-10-30 10:13:03.000000000 +0100
@@ -2,8 +2,6 @@
Python library for parsing and manipulating RPM spec files. Main focus is on
modifying existing spec files, any change should result in a minimal diff.
-This project is still a work in progress.
-
## Motivation
Originally, [rebase-helper](https://github.com/rebase-helper/rebase-helper/)
provided an API for spec file modifications that was also used by
[packit](https://github.com/packit/packit). The goal of this project is to make
the interface more general and convenient to use by not only packit but also by
other Python projects that need to interact with RPM spec files.
@@ -252,11 +250,43 @@
print(len(specfile.sources().content))
```
-## Caveats
+### Validity
+
+Macro definitions, tags, `%sourcelist`/`%patchlist` entries and
sources/patches have a `valid` attribute. An entity is considered valid if it
isn't present in a false branch of any condition.
+
+Consider the following in a spec file:
+
+```specfile
+%if 0%{?fedora} >= 36
+Recommends: %{name}-selinux
+%endif
+```
+
+Provided there are no other `Recommends` tags, the following would print
`True` or `False` depending on the value of the `%fedora` macro:
+
+```python
+with specfile.tags() as tags:
+ print(tags.recommends.valid)
+```
+
+You can define macros or redefine/undefine system macros using the `macros`
argument of the constructor or by modifying the `macros` attribute of a
`Specfile` instance.
+
+The same applies to `%ifarch`/`%ifos` statements:
+
+```specfile
+%ifarch %{java_arches}
+BuildRequires: java-devel
+%endif
+```
-### RPM macros
+Provided there are no other `BuildRequires` tags, the following would print
`True` in case the current platform was part of `%java_arches`:
+
+```python
+with specfile.tags() as tags:
+ print(tags.buildrequires.valid)
+```
-specfile uses RPM for parsing spec files and macro expansion. Unfortunately,
macros are always stored in a global context, which poses a problem for
multiple instances of Specfile.
+To override this, you would have to redefine the `%_target_cpu` system macro
(or `%_target_os` in case of `%ifos`).
## Videos
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/epel8/python-specfile.spec
new/specfile-0.23.0/epel8/python-specfile.spec
--- old/specfile-0.22.1/epel8/python-specfile.spec 2023-10-06
15:07:44.000000000 +0200
+++ new/specfile-0.23.0/epel8/python-specfile.spec 2023-10-30
10:13:03.000000000 +0100
@@ -5,7 +5,7 @@
Name: python-specfile
-Version: 0.22.1
+Version: 0.23.0
Release: 1%{?dist}
Summary: A library for parsing and manipulating RPM spec files
@@ -61,6 +61,9 @@
%changelog
+* Sun Oct 29 2023 Packit Team <[email protected]> - 0.23.0-1
+- New upstream release 0.23.0
+
* Fri Oct 06 2023 Packit Team <[email protected]> - 0.22.1-1
- New upstream release 0.22.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/fedora/python-specfile.spec
new/specfile-0.23.0/fedora/python-specfile.spec
--- old/specfile-0.22.1/fedora/python-specfile.spec 2023-10-06
15:07:44.000000000 +0200
+++ new/specfile-0.23.0/fedora/python-specfile.spec 2023-10-30
10:13:03.000000000 +0100
@@ -8,7 +8,7 @@
Name: python-specfile
-Version: 0.22.1
+Version: 0.23.0
Release: 1%{?dist}
Summary: A library for parsing and manipulating RPM spec files
@@ -70,6 +70,9 @@
%changelog
+* Sun Oct 29 2023 Packit Team <[email protected]> - 0.23.0-1
+- New upstream release 0.23.0
+
* Fri Oct 06 2023 Packit Team <[email protected]> - 0.22.1-1
- New upstream release 0.22.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/specfile/sourcelist.py
new/specfile-0.23.0/specfile/sourcelist.py
--- old/specfile-0.22.1/specfile/sourcelist.py 2023-10-06 15:07:44.000000000
+0200
+++ new/specfile-0.23.0/specfile/sourcelist.py 2023-10-30 10:13:03.000000000
+0100
@@ -5,7 +5,9 @@
import copy
from typing import TYPE_CHECKING, Any, Dict, List, Optional, overload
+from specfile.conditions import process_conditions
from specfile.formatter import formatted
+from specfile.macro_definitions import MacroDefinitions
from specfile.macros import Macros
from specfile.sections import Section
from specfile.tags import Comments
@@ -22,10 +24,15 @@
Attributes:
location: Literal location of the source/patch as stored in the spec
file.
comments: List of comments associated with the source/patch.
+ valid: Whether the entry is not located in a false branch of a
condition.
"""
def __init__(
- self, location: str, comments: Comments, context: Optional["Specfile"]
= None
+ self,
+ location: str,
+ comments: Comments,
+ valid: bool = True,
+ context: Optional["Specfile"] = None,
) -> None:
"""
Constructs a `SourceListEntry` object.
@@ -33,6 +40,7 @@
Args:
location: Literal location of the source/patch as stored in the
spec file.
comments: List of comments associated with the source/patch.
+ valid: Whether the entry is not located in a false branch of a
condition.
context: `Specfile` instance that defines the context for macro
expansions.
Returns:
@@ -40,6 +48,7 @@
"""
self.location = location
self.comments = comments.copy()
+ self.valid = valid
self._context = context
def __eq__(self, other: object) -> bool:
@@ -50,7 +59,8 @@
@formatted
def __repr__(self) -> str:
return (
- f"SourcelistEntry({self.location!r}, {self.comments!r},
{self._context!r})"
+ f"SourcelistEntry({self.location!r}, {self.comments!r}, "
+ f"{self.valid!r}, {self._context!r})"
)
def __deepcopy__(self, memo: Dict[int, Any]) -> "SourcelistEntry":
@@ -134,11 +144,15 @@
Returns:
Constructed instance of `Sourcelist` class.
"""
+ macro_definitions = MacroDefinitions.parse(list(section))
+ lines = process_conditions(list(section), macro_definitions, context)
data = []
buffer: List[str] = []
- for line in section:
+ for line, valid in lines:
if line and not line.lstrip().startswith("#"):
- data.append(SourcelistEntry(line, Comments.parse(buffer),
context))
+ data.append(
+ SourcelistEntry(line, Comments.parse(buffer), valid,
context)
+ )
buffer = []
else:
buffer.append(line)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/specfile/sources.py
new/specfile-0.23.0/specfile/sources.py
--- old/specfile-0.22.1/specfile/sources.py 2023-10-06 15:07:44.000000000
+0200
+++ new/specfile-0.23.0/specfile/sources.py 2023-10-30 10:13:03.000000000
+0100
@@ -66,6 +66,12 @@
"""List of comments associated with the source."""
...
+ @property
+ @abstractmethod
+ def valid(self) -> bool:
+ """Whether the source is not located in a false branch of a
condition."""
+ ...
+
class TagSource(Source):
"""Class that represents a source backed by a spec file tag."""
@@ -161,6 +167,11 @@
"""List of comments associated with the source."""
return self._tag.comments
+ @property
+ def valid(self) -> bool:
+ """Whether the source is not located in a false branch of a
condition."""
+ return self._tag.valid
+
class ListSource(Source):
"""Class that represents a source backed by a line in a %sourcelist
section."""
@@ -224,6 +235,11 @@
"""List of comments associated with the source."""
return self._source.comments
+ @property
+ def valid(self) -> bool:
+ """Whether the source is not located in a false branch of a
condition."""
+ return self._source.valid
+
class Sources(collections.abc.MutableSequence):
"""Class that represents a sequence of all sources."""
@@ -537,12 +553,15 @@
container.insert(
index,
SourcelistEntry( # type: ignore[arg-type]
- location, Comments(), context=self._context
+ location,
+ Comments(),
+ container[index - 1].valid,
+ context=self._context,
),
)
elif self._sourcelists:
self._sourcelists[-1].append(
- SourcelistEntry(location, Comments(), context=self._context)
+ SourcelistEntry(location, Comments(), True,
context=self._context)
)
else:
index, name, separator = self._get_initial_tag_setup()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/specfile-0.22.1/specfile.egg-info/PKG-INFO
new/specfile-0.23.0/specfile.egg-info/PKG-INFO
--- old/specfile-0.22.1/specfile.egg-info/PKG-INFO 2023-10-06
15:07:52.000000000 +0200
+++ new/specfile-0.23.0/specfile.egg-info/PKG-INFO 2023-10-30
10:13:11.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: specfile
-Version: 0.22.1
+Version: 0.23.0
Summary: A library for parsing and manipulating RPM spec files.
Home-page: https://github.com/packit/specfile
Author: Red Hat
@@ -39,8 +39,6 @@
Python library for parsing and manipulating RPM spec files. Main focus is on
modifying existing spec files, any change should result in a minimal diff.
-This project is still a work in progress.
-
## Motivation
Originally, [rebase-helper](https://github.com/rebase-helper/rebase-helper/)
provided an API for spec file modifications that was also used by
[packit](https://github.com/packit/packit). The goal of this project is to make
the interface more general and convenient to use by not only packit but also by
other Python projects that need to interact with RPM spec files.
@@ -289,11 +287,43 @@
print(len(specfile.sources().content))
```
-## Caveats
+### Validity
+
+Macro definitions, tags, `%sourcelist`/`%patchlist` entries and
sources/patches have a `valid` attribute. An entity is considered valid if it
isn't present in a false branch of any condition.
+
+Consider the following in a spec file:
+
+```specfile
+%if 0%{?fedora} >= 36
+Recommends: %{name}-selinux
+%endif
+```
+
+Provided there are no other `Recommends` tags, the following would print
`True` or `False` depending on the value of the `%fedora` macro:
+
+```python
+with specfile.tags() as tags:
+ print(tags.recommends.valid)
+```
+
+You can define macros or redefine/undefine system macros using the `macros`
argument of the constructor or by modifying the `macros` attribute of a
`Specfile` instance.
+
+The same applies to `%ifarch`/`%ifos` statements:
+
+```specfile
+%ifarch %{java_arches}
+BuildRequires: java-devel
+%endif
+```
-### RPM macros
+Provided there are no other `BuildRequires` tags, the following would print
`True` in case the current platform was part of `%java_arches`:
+
+```python
+with specfile.tags() as tags:
+ print(tags.buildrequires.valid)
+```
-specfile uses RPM for parsing spec files and macro expansion. Unfortunately,
macros are always stored in a global context, which poses a problem for
multiple instances of Specfile.
+To override this, you would have to redefine the `%_target_cpu` system macro
(or `%_target_os` in case of `%ifos`).
## Videos