diff mbox series

rpm: avoid empty plugindir error

Message ID 20250103070927.3908610-1-Qi.Chen@windriver.com
State Accepted, archived
Commit 3a54d93052cb7f3d591517a873e516136e965ba8
Headers show
Series rpm: avoid empty plugindir error | expand

Commit Message

ChenQi Jan. 3, 2025, 7:09 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

When using dnf/rpm, we'll see error messages like below:

  error: /usr/lib64/rpm/macros: line 1183: Macro %__plugindir has empty body

The problem was introduced by the following commit in RPM upstream:
https://github.com/rpm-software-management/rpm/commit/ab28534f9e68aff8be65cd1adbac86b5a2cafde4

We'll need to move RPM_PLUGINDIR definition to top-level CMakefile.txt
to solve this problem.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 ...LUGINDIR-in-top-level-CMakeLists.txt.patch | 57 +++++++++++++++++++
 meta/recipes-devtools/rpm/rpm_4.20.0.bb       |  1 +
 2 files changed, 58 insertions(+)
 create mode 100644 meta/recipes-devtools/rpm/files/0001-Set-RPM_PLUGINDIR-in-top-level-CMakeLists.txt.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/rpm/files/0001-Set-RPM_PLUGINDIR-in-top-level-CMakeLists.txt.patch b/meta/recipes-devtools/rpm/files/0001-Set-RPM_PLUGINDIR-in-top-level-CMakeLists.txt.patch
new file mode 100644
index 0000000000..5db69340ad
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0001-Set-RPM_PLUGINDIR-in-top-level-CMakeLists.txt.patch
@@ -0,0 +1,57 @@ 
+From 2d6beb620896a59cfd685b51a19057e5c5c4ab41 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Thu, 19 Dec 2024 11:54:54 +0800
+Subject: [PATCH] Set RPM_PLUGINDIR in top level CMakeLists.txt
+
+We have in macros.in:
+  %__plugindir          @RPM_PLUGINDIR@
+
+This means, if RPM_PLUGINDIR is not set, %__plugindir will be empty.
+This in turn results in error message when running 'dnf'.
+
+e.g.,
+dnf --help >/dev/null
+error: /usr/lib64/rpm/macros: line 1183: Macro %__plugindir has empty body
+error: /usr/lib64/rpm/macros: line 1183: Macro %__plugindir has empty body
+
+So we should move this directory setting into the top level CMakeLists.txt.
+
+Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/3496]
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ CMakeLists.txt         | 3 +++
+ plugins/CMakeLists.txt | 3 ---
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 758ba73f4..e694b9650 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -453,6 +453,9 @@ if (ENABLE_PYTHON)
+ 	add_subdirectory(python)
+ endif()
+ 
++set(RPM_PLUGINDIR ${CMAKE_INSTALL_FULL_LIBDIR}/rpm-plugins
++       CACHE PATH "rpm plugin directory")
++
+ if (ENABLE_PLUGINS)
+ 	add_subdirectory(plugins)
+ endif()
+diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt
+index a44056fe3..6e61a7c20 100644
+--- a/plugins/CMakeLists.txt
++++ b/plugins/CMakeLists.txt
+@@ -42,9 +42,6 @@ if (HAVE_UNSHARE)
+ 	add_library(unshare MODULE unshare.c)
+ endif()
+ 
+-set(RPM_PLUGINDIR ${CMAKE_INSTALL_FULL_LIBDIR}/rpm-plugins
+-	CACHE PATH "rpm plugin directory")
+-
+ get_property(plugins DIRECTORY PROPERTY BUILDSYSTEM_TARGETS)
+ foreach(plugin ${plugins})
+ 	target_link_libraries(${plugin} PRIVATE librpmio librpm ${Intl_LIBRARIES})
+-- 
+2.25.1
+
diff --git a/meta/recipes-devtools/rpm/rpm_4.20.0.bb b/meta/recipes-devtools/rpm/rpm_4.20.0.bb
index 97483f7ddd..6c995ff50c 100644
--- a/meta/recipes-devtools/rpm/rpm_4.20.0.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.20.0.bb
@@ -38,6 +38,7 @@  SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.20.x;protoc
            file://0001-CMakeLists.txt-look-for-lua-with-pkg-config-rather-t.patch \
            file://0002-rpmio-rpmglob.c-avoid-using-GLOB_BRACE-if-undefined-.patch \
            file://0001-CMakeLists.txt-set-libdir-to-CMAKE_INSTALL_FULL_LIBD.patch \
+           file://0001-Set-RPM_PLUGINDIR-in-top-level-CMakeLists.txt.patch \
            "
 
 PE = "1"