Skip to contentSkip to conversation

rpm-sequoia-crypto-policy: New recipe

PATCH New Zoltán Böszörményi 1 participant 5 messages Feb 13, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 rpm-sequoia-crypto-policy: New recipe

This ships a crypto policy file for rpm-sequoia.

---
 meta/conf/distro/include/maintainers.inc      |  1 +
 .../rpm-sequoia-crypto-policy_git.bb          | 38 +++++++++++++++++++
 2 files changed, 39 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crypto-policy_git.bb
meta/conf/distro/include/maintainers.inc +1 -0
index bec55a7c1c..648c8fceb8 100644
@@ -744,6 +744,7 @@ RECIPE_MAINTAINER:pn-rpcbind = "Hongxu Jia <[email protected]>"
 RECIPE_MAINTAINER:pn-rng-tools = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-rpcsvc-proto = "Khem Raj <[email protected]>"
 RECIPE_MAINTAINER:pn-rpm = "Robert Yang <[email protected]>"
+RECIPE_MAINTAINER:pn-rpm-sequoia-crypto-policy = "Zoltán Böszörményi <[email protected]>"
 RECIPE_MAINTAINER:pn-rsync = "Yi Zhao <[email protected]>"
 RECIPE_MAINTAINER:pn-rt-tests = "Unassigned <[email protected]>"
 RECIPE_MAINTAINER:pn-ruby = "Ross Burton <[email protected]>"
meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crypto-policy_git.bb new file +38 -0
new file mode 100644
index 0000000000..098881e3da
@@ -0,0 +1,38 @@
+SUMMARY = "Crypto policy for rpm-sequoia"
+HOMEPAGE = "https://gitlab.com/redhat-crypto/fedora-crypto-policies/"
+
+LICENSE = "LGPL-2.1-or-later"
+
+LIC_FILES_CHKSUM = "file://COPYING.LESSER;md5=a6f89e2100d9b6cdffcea4f398e37343"
+
+DEPENDS = "coreutils-native openssl-native make-native"
+
+inherit allarch python3native
+
+SRC_URI = "git://gitlab.com/redhat-crypto/fedora-crypto-policies.git;protocol=https;branch=master"
+
+SRCREV = "032b418a6db842f0eab330eb5909e4604e888728"
+UPSTREAM_CHECK_COMMITS = "1"
+
+S = "${UNPACKDIR}/git"
+
+do_compile () {
+	# Remove most policy variants, leave DEFAULT.pol
+	# It speeds up the build and we only need DEFAULT/rpm-sequoia.
+	rm -f $(ls -1 policies/*.pol | grep -v DEFAULT.pol) || echo nothing to delete
+
+	# Don't validate openssh policy variants.
+	# Validation may fail and these variants are not needed.
+	export OLD_OPENSSH=1
+
+	make ASCIIDOC=echo XSLTPROC=echo
+}
+
+do_install () {
+	install -d -m755 ${D}${datadir}/crypto-policies/back-ends
+	install -m644 ${S}/output/DEFAULT/rpm-sequoia.txt ${D}${datadir}/crypto-policies/back-ends/rpm-sequoia.config
+}
+
+FILES:${PN} = "${datadir}/crypto-policies/back-ends/*"
+
+BBCLASSEXTEND = "native"
Signature · 1 line
2.48.1
#1 lore raw

PATCH 2/5 rpm-sequoia: New recipe for version 1.7.0

rpm 4.20 removed the built-in code to handle signed packages and uses rpm-sequoia as a more feature complete library.

Runtime-depend on rpm-sequoia-crypto-policy.

---
 meta/conf/distro/include/maintainers.inc      |   1 +
 .../rpm-sequoia/rpm-sequoia-crates.inc        | 486 ++++++++++++++++++
 .../rpm-sequoia/rpm-sequoia_1.7.0.bb          |  60 +++
 3 files changed, 547 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crates.inc
 create mode 100644 meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb
meta/conf/distro/include/maintainers.inc +1 -0
index 648c8fceb8..24c8a850ec 100644
@@ -744,6 +744,7 @@ RECIPE_MAINTAINER:pn-rpcbind = "Hongxu Jia <[email protected]>"
 RECIPE_MAINTAINER:pn-rng-tools = "Anuj Mittal <[email protected]>"
 RECIPE_MAINTAINER:pn-rpcsvc-proto = "Khem Raj <[email protected]>"
 RECIPE_MAINTAINER:pn-rpm = "Robert Yang <[email protected]>"
+RECIPE_MAINTAINER:pn-rpm-sequoia = "Zoltán Böszörményi <[email protected]>"
 RECIPE_MAINTAINER:pn-rpm-sequoia-crypto-policy = "Zoltán Böszörményi <[email protected]>"
 RECIPE_MAINTAINER:pn-rsync = "Yi Zhao <[email protected]>"
 RECIPE_MAINTAINER:pn-rt-tests = "Unassigned <[email protected]>"
meta/recipes-devtools/rpm-sequoia/rpm-sequoia-crates.inc new file +486 -0

486 lines not on this page · raw message

meta/recipes-devtools/rpm-sequoia/rpm-sequoia_1.7.0.bb new file +60 -0

60 lines not on this page · raw message

Signature · 1 line
2.48.1
#2 lore raw

PATCH 3/5 rpm: Set SEQUOIA_CRYPTO_POLICY in wrapped tools

In reply to Zoltán Böszörményi

Point to the crypto policy file so RPM signing may work.

---
 meta/recipes-devtools/rpm/rpm_4.20.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/rpm/rpm_4.20.0.bb +1 -0
index 45487ad32c..281fde1c82 100644
@@ -100,6 +100,7 @@ WRAPPER_TOOLS = " \
 do_install:append:class-native() {
         for tool in ${WRAPPER_TOOLS}; do
                 test -x ${D}$tool && create_wrapper ${D}$tool \
+                        SEQUOIA_CRYPTO_POLICY=${STAGING_DATADIR_NATIVE}/crypto-policies/back-ends/rpm-sequoia.config \
                         RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
                         RPM_ETCCONFIGDIR=${STAGING_DIR_NATIVE} \
                         MAGIC=${STAGING_DIR_NATIVE}${datadir_native}/misc/magic.mgc \
Signature · 1 line
2.48.1
#3 lore raw

PATCH 4/5 dnf: Set SEQUOIA_CRYPTO_POLICY in wrapped tools

In reply to Zoltán Böszörményi

Point to the crypto policy file so dnf can work with signed packages.

---
 meta/recipes-devtools/dnf/dnf_4.22.0.bb | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-devtools/dnf/dnf_4.22.0.bb +1 -0
index f9d6ea1fa6..e5ac3c9824 100644
@@ -69,6 +69,7 @@ do_install:append() {
 # Direct dnf-native to read rpm configuration from our sysroot, not the one it was compiled in
 do_install:append:class-native() {
         create_wrapper ${D}/${bindir}/dnf \
+                SEQUOIA_CRYPTO_POLICY=${STAGING_DATADIR_NATIVE}/crypto-policies/back-ends/rpm-sequoia.config \
                 RPM_CONFIGDIR=${STAGING_LIBDIR_NATIVE}/rpm \
                 RPM_NO_CHROOT_FOR_SCRIPTS=1
 }
Signature · 1 line
2.48.1
#4 lore raw

PATCH 5/5 oeqa/selftest/cases/signing.py: Re-enable self-test

In reply to Zoltán Böszörményi

With all the pieces in place, the self test can be re-enabled.

---
 meta/lib/oeqa/selftest/cases/signing.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/oeqa/selftest/cases/signing.py +2 -1
index 51d1c3fa64..4df45ba032 100644
@@ -71,7 +71,6 @@ class Signing(OESelftestTestCase):
         """
         import oe.packagedata
 
-        self.skipTest('This test requires rpm-sequoia support in rpm')
         self.setup_gpg()
 
         package_classes = get_bb_var('PACKAGE_CLASSES')
@@ -84,6 +83,8 @@ class Signing(OESelftestTestCase):
         feature += 'RPM_GPG_PASSPHRASE = "test123"\n'
         feature += 'RPM_GPG_NAME = "testuser"\n'
         feature += 'GPG_PATH = "%s"\n' % self.gpg_dir
+        feature += 'PACKAGECONFIG:append:pn-rpm-native = " sequoia"\n'
+        feature += 'PACKAGECONFIG:append:pn-rpm = " sequoia"\n'
 
         self.write_config(feature)
 
Signature · 1 line
2.48.1