public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/package-notes] rawhide: Version 0.18
@ 2026-06-02 16:28 
  0 siblings, 0 replies; only message in thread
From:  @ 2026-06-02 16:28 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/package-notes
            Branch : rawhide
            Commit : 0dfeccaaec3f987c04161a63782c982b01b82e83
            Author : Zbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
            Date   : 2026-06-02T18:23:12+02:00
            Stats  : +3/-415 in 8 file(s)
            URL    : https://src.fedoraproject.org/rpms/package-notes/c/0dfeccaaec3f987c04161a63782c982b01b82e83?branch=rawhide

            Log:
            Version 0.18

- This significantly reworks how rpm attributes are generated based
  on dlopen notes. For example use of how this is done, see
  https://src.fedoraproject.org/rpms/systemd/pull-request/246.
- No changes to package note handling.

---
diff --git a/.gitignore b/.gitignore
index 372eb8d..99c4328 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
 /package-notes-0.15.tar.gz
 /package-notes-0.16.tar.gz
 /package-notes-0.17.tar.gz
+/package-notes-0.18.tar.gz

diff --git a/0001-Fix-type-in-group_by_feature.patch b/0001-Fix-type-in-group_by_feature.patch
deleted file mode 100644
index 5721460..0000000
--- a/0001-Fix-type-in-group_by_feature.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From a2f9622f3f21b80b3cfbf9ce76fbc2dc721ecf13 Mon Sep 17 00:00:00 2001
-From: Arthur Petitpierre <bartaba@smallstone.org>
-Date: Wed, 7 Jan 2026 17:48:14 +0700
-Subject: [PATCH 1/6] Fix type in group_by_feature
-
-In group_by_feature, fix typo "recommened" -> "recommended".
----
- dlopen-notes.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/dlopen-notes.py b/dlopen-notes.py
-index 3d5b651fd9..e55800c98d 100755
---- a/dlopen-notes.py
-+++ b/dlopen-notes.py
-@@ -98,7 +98,7 @@ def group_by_feature(elffiles):
-     # ]
-     for elffiles in elffiles:
-         for note in elffiles.notes():
--            prio = Priority[note.get('priority', 'recommened')]
-+            prio = Priority[note.get('priority', 'recommended')]
-             feature_name = note['feature']
- 
-             try:

diff --git a/0002-dlopen-notes-group-two-helper-functions-together.patch b/0002-dlopen-notes-group-two-helper-functions-together.patch
deleted file mode 100644
index 99f7bef..0000000
--- a/0002-dlopen-notes-group-two-helper-functions-together.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From 2ad3aca11e60a9f50574a65df2232dfb58597f2b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
-Date: Mon, 12 Jan 2026 13:57:06 +0100
-Subject: [PATCH 2/6] dlopen-notes: group two helper functions together
-
----
- dlopen-notes.py | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/dlopen-notes.py b/dlopen-notes.py
-index e55800c98d..f103611c00 100755
---- a/dlopen-notes.py
-+++ b/dlopen-notes.py
-@@ -19,6 +19,11 @@ try:
- except ImportError:
-     print_json = print
- 
-+def dictify(f):
-+    def wrap(*args, **kwargs):
-+        return dict(f(*args, **kwargs))
-+    return functools.update_wrapper(wrap, f)
-+
- def listify(f):
-     def wrap(*args, **kwargs):
-         return list(f(*args, **kwargs))
-@@ -63,11 +68,6 @@ class ELFFileReader:
- 
-                 yield from j
- 
--def dictify(f):
--    def wrap(*args, **kwargs):
--        return dict(f(*args, **kwargs))
--    return functools.update_wrapper(wrap, f)
--
- @dictify
- def group_by_soname(elffiles):
-     for elffile in elffiles:

diff --git a/0003-rpm-add-fileattr-multifile-generator.patch b/0003-rpm-add-fileattr-multifile-generator.patch
deleted file mode 100644
index 23ddbd1..0000000
--- a/0003-rpm-add-fileattr-multifile-generator.patch
+++ /dev/null
@@ -1,270 +0,0 @@
-From d6e833810909a4278f59c19dbc748424ca5e153f Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
-Date: Tue, 13 Jan 2026 14:14:22 +0100
-Subject: [PATCH 3/6] rpm: add fileattr multifile generator
-
-This allows dlopen notes to be turned into appropriate dependencies
-automatically. The dlopen_notes.attr file needs to be installed into
-%{_fileattrsdir}.
-
-By default, dependencies are generated for all files that have package
-notes. I think this is a reasonable default because it makes the whole
-feature easier to discover. In more realistic cases, esp. with
-multiple subpackages, it's likely that the packager may need to
-configure the distribution of dependencies between subpackages.
-
-One shortcoming of the scheme is that everything is per file, so it's
-not possible to say that dependencies generated from a feature should
-be assigned to a different subpackage. This is how the feature is
-designed in rpm.
-
-The opt-out mechanism is a bit clunky. The first option I considered
-was to tell the user to undefine
-%__dlopen_notes_requires/recommends/suggests, but that requires three
-lines of boilerplate. And might not be forwards-compatible if we add
-new features in the future. The second option would be to tell the
-user to define __dlopen_notes_requires/recommends/suggests_opts to
-%nil. But that has similar problems. I think it's nice to have an
-obvious oneliner to handle this. Unfortunately, when I tried to use
-  %__dlopen_notes_requires %{?_dlopen_notes_generator:%{_dlopen_notes_generator} ...}
-  %__dlopen_notes_recommends %{?_dlopen_notes_generator:%{_dlopen_notes_generator} ...}
-  %__dlopen_notes_suggests %{?_dlopen_notes_generator:%{_dlopen_notes_generator} ...}
-in the .attr file, when the package has %undefine _dlopen_notes_generator,
-we still end up with the macro being expanded. Maybe I misunderstood
-the macro expansion logic. The approach with 'true' is clunky, but
-it works fine.
-
-Thanks to Neal Gompa for the suggestion to use this protocol.
-
-The new interface is new, independent of the existing options
---feature, --rpm-recommends, --rpm-requires that were previously added
-to support rpms. Unfortunately, with the fileattr protocol, the
-old way to specify information is not useful. Instead of trying
-to shoehorn the new metadata into existing options, I think it's
-easier to add a new set with clear semantics.
----
- README.md             | 13 ++++++
- dlopen-notes.py       | 96 +++++++++++++++++++++++++++++++++++++++++--
- rpm/dlopen_notes.attr | 44 ++++++++++++++++++++
- 3 files changed, 150 insertions(+), 3 deletions(-)
- create mode 100644 rpm/dlopen_notes.attr
-
-diff --git a/README.md b/README.md
-index 8b27e19de3..f7fa518630 100644
---- a/README.md
-+++ b/README.md
-@@ -97,6 +97,19 @@ $ dlopen-notes /usr/lib64/systemd/libsystemd-shared-257.so
- ...
- ```
- 
-+### Using the rpm fileattr generator
-+
-+The tool that processes package notes can be hooked into the rpm build process
-+to automatically generate virtual `Requires`, `Recommends`, and `Suggests` dependencies.
-+
-+The rpm file attribute mechanism is described in
-+[rpm-dependency-generators.7](https://rpm-software-management.github.io/rpm/man/rpm-dependency-generators.7).
-+
-+This tool implements the 'multifile' protocol:
-+it reads the list of files on stdin and outputs a list of virtual dependencies.
-+
-+See the `rpm/dlopen_notes.attr` file for invocation details and options.
-+
- ## Requirements
- * binutils (>= 2.39)
- * mold (>= 1.3.0)
-diff --git a/dlopen-notes.py b/dlopen-notes.py
-index f103611c00..4fa30d8e89 100755
---- a/dlopen-notes.py
-+++ b/dlopen-notes.py
-@@ -7,6 +7,7 @@ Read .note.dlopen notes from ELF files and report the contents.
- 
- import argparse
- import enum
-+import fnmatch
- import functools
- import json
- import sys
-@@ -84,6 +85,16 @@ class Priority(enum.Enum):
-     def __lt__(self, other):
-         return self.value < other.value
- 
-+    def rpm_name(self):
-+        if self == self.__class__.suggested:
-+            return 'Suggests'
-+        if self == self.__class__.recommended:
-+            return 'Recommends'
-+        if self == self.__class__.required:
-+            return 'Requires'
-+        raise ValueError
-+
-+
- def group_by_feature(elffiles):
-     features = {}
- 
-@@ -143,6 +154,52 @@ def generate_rpm(elffiles, stanza, filter):
-                 soname = next(iter(note['soname']))  # we take the first — most recommended — soname
-                 yield f"{stanza}: {soname}{suffix}"
- 
-+def rpm_fileattr_generator(args):
-+    if args.rpm_features is not None:
-+        if not any(fnmatch.fnmatch(args.subpackage, pattern[0])
-+                   for pattern in args.rpm_features):
-+            # Current subpackage is not listed, nothing to do.
-+            # Consume all input as required by the protocol.
-+            sys.stdin.read()
-+            return
-+
-+    for file in sys.stdin:
-+        file = file.strip()
-+        if not file:
-+            continue  # ignore empty lines
-+
-+        elffile = ELFFileReader(file)
-+        suffix = '()(64bit)' if elffile.elffile.elfclass == 64 else ''
-+
-+        first = True
-+
-+        for note in elffile.notes():
-+            # Feature name is optional. Allow this to be matched
-+            # by the empty string ('') or a wildcard glob ('*').
-+            feature = note.get('feature', '')
-+
-+            if args.rpm_features is not None:
-+                for package_pattern,feature_pattern in args.rpm_features:
-+                    if (fnmatch.fnmatch(args.subpackage, package_pattern) and
-+                        fnmatch.fnmatch(feature, feature_pattern)):
-+                        break
-+                else:
-+                    # not matched
-+                    continue
-+            else:
-+                # if no mapping, print all features at the suggested level
-+                level = Priority[note.get('priority', 'recommended')].rpm_name()
-+                if level != args.rpm_fileattr:
-+                    continue
-+
-+            if first:
-+                print(f';{file}')
-+                first = False
-+
-+            soname = next(iter(note['soname']))  # we take the first — most recommended — soname
-+            print(f'{soname}{suffix}')
-+
-+
- def make_parser():
-     p = argparse.ArgumentParser(
-         description=__doc__,
-@@ -187,10 +244,28 @@ def make_parser():
-         metavar='FEATURE1,FEATURE2',
-         help='Generate rpm Recommends for listed features',
-     )
-+    p.add_argument(
-+        '--rpm-fileattr',
-+        metavar='TYPE',
-+        help='Run as rpm fileattr generator for TYPE dependencies',
-+    )
-+    p.add_argument(
-+        '--subpackage',
-+        metavar='NAME',
-+        default='',
-+        help='Current subpackage NAME',
-+    )
-+    p.add_argument(
-+        '--rpm-features',
-+        metavar='SUBPACKAGE:FEATURE,SUBPACKAGE:FEATURE',
-+        type=lambda s: [x.split(':', maxsplit=1) for x in s.split(',')],
-+        action='extend',
-+        help='Specify subpackage:feature mapping',
-+    )
-     p.add_argument(
-         'filenames',
--        nargs='+',
--        metavar='filename',
-+        nargs='*',
-+        metavar='FILENAME',
-         help='Library file to extract notes from',
-     )
-     p.add_argument(
-@@ -207,15 +282,30 @@ def parse_args():
-         and not args.sonames
-         and args.features is None
-         and args.rpm_requires is None
--        and args.rpm_recommends is None):
-+        and args.rpm_recommends is None
-+        and args.rpm_fileattr is None):
-         # Make --raw the default if no action is specified.
-         args.raw = True
- 
-+    if args.rpm_fileattr is not None:
-+        if (args.filenames
-+            or args.raw
-+            or args.features is not None
-+            or args.rpm_requires
-+            or args.rpm_recommends):
-+            raise ValueError('--rpm-generate cannot be combined with most options')
-+
-+    if args.rpm_fileattr is None and not args.filenames:
-+        raise ValueError('At least one positional FILENAME parameter is required')
-+
-     return args
- 
- if __name__ == '__main__':
-     args = parse_args()
- 
-+    if args.rpm_fileattr is not None:
-+        sys.exit(rpm_fileattr_generator(args))
-+
-     elffiles = [ELFFileReader(filename) for filename in args.filenames]
-     features = group_by_feature(elffiles)
- 
-diff --git a/rpm/dlopen_notes.attr b/rpm/dlopen_notes.attr
-new file mode 100644
-index 0000000000..abe3e8547c
---- /dev/null
-+++ b/rpm/dlopen_notes.attr
-@@ -0,0 +1,44 @@
-+# SPDX-License-Identifier: MIT-0
-+#
-+# This file is part of the package-notes package.
-+#
-+#
-+# The spec file for a package can specify which features are listed
-+# and at which level, using
-+# '--rpm-features=SUBPACKAGE1:FEATURE1,SUBPACKAGE2:FEATURE2' option in
-+# the '__dlopen_notes_TYPE_opts' macro, where TYPE is one of
-+# 'requires', 'recommends', or 'suggests'. The macro should be declared
-+# in the spec file using:
-+#   %define __dlopen_notes_TYPE_opts SUBPACKAGE:FEATURE…
-+# e.g.
-+#   %define __dlopen_notes_recommends_opts *:zstd
-+#
-+# The option accepts multiple comma-separated pairs, and can also be
-+# specified multiple times. Both the subpackage name and feature name
-+# can be a glob. If configuration is omitted, the priority recommended
-+# in the notes is used.
-+#
-+# The '--subpackage=SUBPACKAGE' option (inserted below) tells the generator
-+# which subpackage is being processed.
-+#
-+# For example, for a package using compression libraries, we can say
-+# that the 'package-libs' subpackage shall carry 'Requires' on all the
-+# libraries needed for the 'zstd' feature, all subpackages shall carry
-+# 'Recommends' on all the libraries needed for the 'gzip' feature, and
-+# the 'package' subpackage shall carry 'Suggests' for any feature
-+# matching 'lzma' or 'bzip*'.
-+#
-+#  %define __dlopen_notes_requires_opts   --rpm-features=package-libs:zstd
-+#  %define __dlopen_notes_recommends_opts --rpm-features=*:gzip
-+#  %define __dlopen_notes_suggests_opts   --rpm-features=package:lzma,package:bzip*
-+#
-+# To opt out, undefine the %_dlopen_notes_generator macro:
-+#  %undefine _dlopen_notes_generator
-+
-+%_dlopen_notes_generator   %{_bindir}/dlopen-notes
-+
-+%__dlopen_notes_requires   %{!?_dlopen_notes_generator:true }%{_dlopen_notes_generator} --subpackage='%{name}' --rpm-fileattr=Requires
-+%__dlopen_notes_recommends %{!?_dlopen_notes_generator:true }%{_dlopen_notes_generator} --subpackage='%{name}' --rpm-fileattr=Recommends
-+%__dlopen_notes_suggests   %{!?_dlopen_notes_generator:true }%{_dlopen_notes_generator} --subpackage='%{name}' --rpm-fileattr=Suggests
-+%__dlopen_notes_protocol   multifile
-+%__dlopen_notes_magic      ^.*ELF (32|64)-bit.*$

diff --git a/0004-fakelib-add-test-for-the-new-fileattr-plugin.patch b/0004-fakelib-add-test-for-the-new-fileattr-plugin.patch
deleted file mode 100644
index 8b19a33..0000000
--- a/0004-fakelib-add-test-for-the-new-fileattr-plugin.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 9f6142b43b730d2ff51cf2b355050548f5f8fc9e Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
-Date: Tue, 13 Jan 2026 09:53:07 +0100
-Subject: [PATCH 4/6] fakelib: add test for the new fileattr plugin
-
-This is a package that "builds" by copying two files: a systemd
-library that is known to use dlopen notes and another glibc library
-that doesn't have them. It can be built with 'rpmbuild' or 'fedpkg local'.
-For example:
-  (cd fakelib && fedpkg local && echo 'Requires:' && rpm -qpv --requires x86_64/fakelib-0-1.fc44.x86_64.rpm && echo 'Recommends:' && rpm -qpv --recommends x86_64/fakelib-0-1.fc44.x86_64.rpm && echo 'Suggests:' && rpm -qpv --suggests x86_64/fakelib-0-1.fc44.x86_64.rpm)
----
- fakelib/fakelib.spec | 36 ++++++++++++++++++++++++++++++++++++
- 1 file changed, 36 insertions(+)
- create mode 100644 fakelib/fakelib.spec
-
-diff --git a/fakelib/fakelib.spec b/fakelib/fakelib.spec
-new file mode 100644
-index 0000000000..40714cbeb1
---- /dev/null
-+++ b/fakelib/fakelib.spec
-@@ -0,0 +1,36 @@
-+# SPDX-License-Identifier: MIT-0
-+#
-+# This file is part of the package-notes package.
-+
-+Name:           fakelib
-+Version:        0
-+Release:        %autorelease
-+Summary:        %{name}
-+
-+License:        None
-+
-+%define __dlopen_notes_requires_opts   --rpm-features=fakelib:gcrypt,fakelib:lz4
-+%define __dlopen_notes_recommends_opts --rpm-features=*:zstd
-+%define __dlopen_notes_suggests_opts   --rpm-features=fakelib:lzm[abc]
-+
-+#undefine _dlopen_notes_generator
-+
-+%description
-+%{summary}.
-+
-+%prep
-+
-+%build
-+
-+%install
-+install -Dt %{buildroot}/usr/lib64/ /usr/lib64/libsystemd.so.0
-+ln -s libsystemd.so.0 %{buildroot}/usr/lib64/libsystemd.so
-+install -Dt %{buildroot}/usr/lib64/ /usr/lib64/libmvec.so.1
-+
-+%files
-+/usr/lib64/libsystemd.so.0
-+/usr/lib64/libsystemd.so
-+/usr/lib64/libmvec.so.1
-+
-+%changelog
-+%autochangelog

diff --git a/0005-rpm-use-a-r-.-guard-around-package-notes-LDFLAGS.patch b/0005-rpm-use-a-r-.-guard-around-package-notes-LDFLAGS.patch
deleted file mode 100644
index be26cf0..0000000
--- a/0005-rpm-use-a-r-.-guard-around-package-notes-LDFLAGS.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-From e52dfeba8ba36fc765fbe0ff0d4c93ed9aac493b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= <fberat@redhat.com>
-Date: Tue, 27 Jan 2026 11:31:16 +0100
-Subject: [PATCH 5/6] rpm: use a '%{!r: ... }' guard around package notes
- LDFLAGS
-
-...to prevent double inclusion when performing a relocatable link ('-r').
-Relates to https://bugzilla.redhat.com/show_bug.cgi?id=2362272.
----
- rpm/redhat-package-notes.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/rpm/redhat-package-notes.in b/rpm/redhat-package-notes.in
-index 3a19b1be8a..1297ae5261 100644
---- a/rpm/redhat-package-notes.in
-+++ b/rpm/redhat-package-notes.in
-@@ -1,2 +1,2 @@
- *link:
--+ --package-metadata={\"type\":\"rpm\",\"name\":\"%:getenv(RPM_PACKAGE_NAME \",\"version\":\"%:getenv(RPM_PACKAGE_VERSION -%:getenv(RPM_PACKAGE_RELEASE \",\"architecture\":\"%:getenv(RPM_ARCH \",\"osCpe\":\"@OSCPE@\"}))))
-++ %{!r:--package-metadata={\"type\":\"rpm\",\"name\":\"%:getenv(RPM_PACKAGE_NAME \",\"version\":\"%:getenv(RPM_PACKAGE_VERSION -%:getenv(RPM_PACKAGE_RELEASE \",\"architecture\":\"%:getenv(RPM_ARCH \",\"osCpe\":\"@OSCPE@\"}))))}

diff --git a/package-notes.spec b/package-notes.spec
index 9fc7fbc..c63d23d 100644
--- a/package-notes.spec
+++ b/package-notes.spec
@@ -1,5 +1,5 @@
 Name:           package-notes
-Version:        0.17
+Version:        0.18
 Release:        %autorelease
 Summary:        ELF Package and Dlopen Notes
 License:        0BSD
@@ -11,12 +11,6 @@ BuildRequires:  make
 
 Requires:       python3dist(pyelftools)
 
-Patch:          0001-Fix-type-in-group_by_feature.patch
-Patch:          0002-dlopen-notes-group-two-helper-functions-together.patch
-Patch:          0003-rpm-add-fileattr-multifile-generator.patch
-Patch:          0004-fakelib-add-test-for-the-new-fileattr-plugin.patch
-Patch:          0005-rpm-use-a-r-.-guard-around-package-notes-LDFLAGS.patch
-
 %description
 This package provides rpm macros to generate an '.note.package' ELF note in
 compiled binaries (programs and shared libraries) to provide metadata about

diff --git a/sources b/sources
index 4c7a641..2991b3c 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-SHA512 (package-notes-0.17.tar.gz) = e06fe34a8d61445055d5d7375f91af2936b53770e5d9651b096470e35bb59ad8810150dcbe1d88c5e33c8123286cb3333287292fbde5eb4dc71f1c52e496c3c7
+SHA512 (package-notes-0.18.tar.gz) = f378bf78cfc9295d18688dc268fd697ef07eea6a8892f1e5706299a2f3ac9cb268952686b7027d946494285c777f81d385a94d6c2c010f51ccc5b0fdd472a26c

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-02 16:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-02 16:28 [rpms/package-notes] rawhide: Version 0.18 

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox