summaryrefslogtreecommitdiffstats
path: root/import-layers/yocto-poky/meta/recipes-devtools/rpm/files
diff options
context:
space:
mode:
Diffstat (limited to 'import-layers/yocto-poky/meta/recipes-devtools/rpm/files')
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch30
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch20
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch16
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Factor-out-and-unify-setting-CLOEXEC.patch148
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch66
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch31
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-configure.ac-add-option-for-dbus.patch42
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0002-Optimize-rpmSetCloseOnExec.patch100
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch53
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch54
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch11
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch36
-rw-r--r--import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0013-Add-a-new-option-alldeps-to-rpmdeps.patch152
13 files changed, 420 insertions, 339 deletions
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch
deleted file mode 100644
index b809332f2..000000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From 36cf0ff26ece53e529e8b4f2d2f09acd8794b055 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Fri, 24 Mar 2017 15:35:47 +0200
-Subject: [PATCH] Add PYTHON_ABI when searching for python libraries.
-
-It has a value of 'm' when using Python3, and so without it
-configure will not find the libraries.
-
-Upstream-Status: Inappropriate [oe-core specific]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 9c58467c1..a506ec819 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -642,7 +642,7 @@ AS_IF([test "$enable_python" = yes],[
- ])
- CPPFLAGS="$save_CPPFLAGS"
- save_LIBS="$LIBS"
-- AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
-+ AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION}${PYTHON_ABI} python],[
- WITH_PYTHON_LIB="$ac_res"
- ],[AC_MSG_ERROR([missing python library])
- ])
---
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
index 1f61acaf4..5604cb903 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch
@@ -1,10 +1,10 @@
-From d82691b8d58201dd03e30585daacd8ffd1556ae2 Mon Sep 17 00:00:00 2001
+From c82c19dc583843b1a975f2e3f2e151656a6f377c Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 27 Feb 2017 09:43:30 +0200
-Subject: [PATCH] Do not hardcode "lib/rpm" as the installation path for
+Subject: [PATCH 06/14] Do not hardcode "lib/rpm" as the installation path for
default configuration and macros.
-Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/263]
+Upstream-Status: Denied [https://github.com/rpm-software-management/rpm/pull/263]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
@@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
-index 4f3be8770..92ffd3d68 100644
+index 7155d9f00..21b95ae5f 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -875,7 +875,7 @@ else
+@@ -1047,7 +1047,7 @@ else
usrprefix=$prefix
fi
@@ -27,10 +27,10 @@ index 4f3be8770..92ffd3d68 100644
AC_SUBST(OBJDUMP)
diff --git a/macros.in b/macros.in
-index c6d5a6b03..84ae25275 100644
+index d08624856..68a972f1e 100644
--- a/macros.in
+++ b/macros.in
-@@ -877,7 +877,7 @@ package or when debugging this package.\
+@@ -954,7 +954,7 @@ package or when debugging this package.\
%_sharedstatedir %{_prefix}/com
%_localstatedir %{_prefix}/var
%_lib lib
@@ -40,7 +40,7 @@ index c6d5a6b03..84ae25275 100644
%_infodir %{_datadir}/info
%_mandir %{_datadir}/man
diff --git a/rpm.am b/rpm.am
-index 1f43ad8a0..6854ff6ba 100644
+index 51225892d..e0c834d37 100644
--- a/rpm.am
+++ b/rpm.am
@@ -1,10 +1,10 @@
@@ -55,7 +55,7 @@ index 1f43ad8a0..6854ff6ba 100644
+rpmconfigdir = $(libdir)/rpm
# Libtool version (current-revision-age) for all our libraries
- rpm_version_info = 7:0:0
+ rpm_version_info = 8:1:0
--
-2.11.0
+2.15.1
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch
index a38675f89..bf24d43eb 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch
@@ -6,6 +6,9 @@ Subject: [PATCH 1/2] Do not reset the PATH environment variable before running
We add lots of native stuff into it and scriptlets rely on that.
+Also need to remove the xx test later in the function since the
+value could now be used un-initialised.
+
Upstream-Status: Inappropriate [oe-core specific]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
@@ -25,6 +28,13 @@ index 92f949fa2..7c1aa75a8 100644
free(ipath);
}
---
-2.11.0
-
+@@ -206,9 +206,7 @@ static void doScriptExec(ARGV_const_t ar
+ /* XXX Don't mtrace into children. */
+ unsetenv("MALLOC_CHECK_");
+
+- if (xx == 0) {
+ xx = execv(argv[0], argv);
+- }
+ }
+ _exit(127); /* exit 127 for compatibility with bash(1) */
+ }
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Factor-out-and-unify-setting-CLOEXEC.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Factor-out-and-unify-setting-CLOEXEC.patch
new file mode 100644
index 000000000..6f440c617
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Factor-out-and-unify-setting-CLOEXEC.patch
@@ -0,0 +1,148 @@
+From 9c3e5de3240554c8ea1b29d52eeadee4840fefac Mon Sep 17 00:00:00 2001
+From: Kir Kolyshkin <kolyshkin@gmail.com>
+Date: Tue, 29 May 2018 17:37:05 -0700
+Subject: [PATCH 1/3] Factor out and unify setting CLOEXEC
+
+Commit 7a7c31f5 ("Set FD_CLOEXEC on opened files before exec from
+lua script is called") copied the code that sets CLOEXEC flag on all
+possible file descriptors from lib/rpmscript.c to luaext/lposix.c,
+essentially creating two copies of the same code (modulo comments
+and the unused assignment).
+
+This commit moves the functionality into its own function, without
+any code modifications, using the version from luaext/lposix.c.
+
+Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
+Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/444]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ lib/rpmscript.c | 18 ++----------------
+ luaext/lposix.c | 13 ++-----------
+ rpmio/rpmio.c | 16 ++++++++++++++++
+ rpmio/rpmio_internal.h | 6 ++++++
+ 4 files changed, 26 insertions(+), 27 deletions(-)
+
+diff --git a/lib/rpmscript.c b/lib/rpmscript.c
+index 747385a5b..b4ccd3246 100644
+--- a/lib/rpmscript.c
++++ b/lib/rpmscript.c
+@@ -3,7 +3,6 @@
+ #include <sys/types.h>
+ #include <sys/wait.h>
+ #include <errno.h>
+-#include <unistd.h>
+
+ #include <rpm/rpmfileutil.h>
+ #include <rpm/rpmmacro.h>
+@@ -14,6 +13,7 @@
+
+ #include "rpmio/rpmlua.h"
+ #include "lib/rpmscript.h"
++#include "rpmio/rpmio_internal.h"
+
+ #include "lib/rpmplugins.h" /* rpm plugins hooks */
+
+@@ -170,26 +170,12 @@ static const char * const SCRIPT_PATH = "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr
+ static void doScriptExec(ARGV_const_t argv, ARGV_const_t prefixes,
+ FD_t scriptFd, FD_t out)
+ {
+- int flag;
+- int fdno;
+ int xx;
+- int open_max;
+
+ /* SIGPIPE is ignored in rpm, reset to default for the scriptlet */
+ (void) signal(SIGPIPE, SIG_DFL);
+
+- /* XXX Force FD_CLOEXEC on all inherited fdno's. */
+- open_max = sysconf(_SC_OPEN_MAX);
+- if (open_max == -1) {
+- open_max = 1024;
+- }
+- for (fdno = 3; fdno < open_max; fdno++) {
+- flag = fcntl(fdno, F_GETFD);
+- if (flag == -1 || (flag & FD_CLOEXEC))
+- continue;
+- xx = fcntl(fdno, F_SETFD, FD_CLOEXEC);
+- /* XXX W2DO? debug msg for inheirited fdno w/o FD_CLOEXEC */
+- }
++ rpmSetCloseOnExec();
+
+ if (scriptFd != NULL) {
+ int sfdno = Fileno(scriptFd);
+diff --git a/luaext/lposix.c b/luaext/lposix.c
+index 0a7c26c71..5d7ad3c87 100644
+--- a/luaext/lposix.c
++++ b/luaext/lposix.c
+@@ -27,6 +27,7 @@
+ #include <unistd.h>
+ #include <utime.h>
+ #include <rpm/rpmutil.h>
++#include "rpmio/rpmio_internal.h"
+
+ #define MYNAME "posix"
+ #define MYVERSION MYNAME " library for " LUA_VERSION " / Nov 2003"
+@@ -335,21 +336,11 @@ static int Pexec(lua_State *L) /** exec(path,[args]) */
+ const char *path = luaL_checkstring(L, 1);
+ int i,n=lua_gettop(L);
+ char **argv;
+- int flag, fdno, open_max;
+
+ if (!have_forked)
+ return luaL_error(L, "exec not permitted in this context");
+
+- open_max = sysconf(_SC_OPEN_MAX);
+- if (open_max == -1) {
+- open_max = 1024;
+- }
+- for (fdno = 3; fdno < open_max; fdno++) {
+- flag = fcntl(fdno, F_GETFD);
+- if (flag == -1 || (flag & FD_CLOEXEC))
+- continue;
+- fcntl(fdno, F_SETFD, FD_CLOEXEC);
+- }
++ rpmSetCloseOnExec();
+
+ argv = malloc((n+1)*sizeof(char*));
+ if (argv==NULL) return luaL_error(L,"not enough memory");
+diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
+index c7cbc32aa..ea111d2ec 100644
+--- a/rpmio/rpmio.c
++++ b/rpmio/rpmio.c
+@@ -1759,3 +1759,19 @@ DIGEST_CTX fdDupDigest(FD_t fd, int id)
+
+ return ctx;
+ }
++
++void rpmSetCloseOnExec(void)
++{
++ int flag, fdno, open_max;
++
++ open_max = sysconf(_SC_OPEN_MAX);
++ if (open_max == -1) {
++ open_max = 1024;
++ }
++ for (fdno = 3; fdno < open_max; fdno++) {
++ flag = fcntl(fdno, F_GETFD);
++ if (flag == -1 || (flag & FD_CLOEXEC))
++ continue;
++ fcntl(fdno, F_SETFD, FD_CLOEXEC);
++ }
++}
+diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h
+index fbed183b0..370cbdc75 100644
+--- a/rpmio/rpmio_internal.h
++++ b/rpmio/rpmio_internal.h
+@@ -41,6 +41,12 @@ DIGEST_CTX fdDupDigest(FD_t fd, int id);
+ int rpmioSlurp(const char * fn,
+ uint8_t ** bp, ssize_t * blenp);
+
++/**
++ * Set close-on-exec flag for all opened file descriptors, except
++ * stdin/stdout/stderr.
++ */
++void rpmSetCloseOnExec(void);
++
+ #ifdef __cplusplus
+ }
+ #endif
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
index edf9ec089..0b1d6298a 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
@@ -1,24 +1,21 @@
-From 211c2d11200e6657132c52e7ac68f8c118231262 Mon Sep 17 00:00:00 2001
+From d076de030deb9cafd9b2e82be5d506cebdefad0b Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Mon, 27 Feb 2017 14:43:21 +0200
-Subject: [PATCH] Fix build with musl C library.
+Subject: [PATCH 1/9] Fix build with musl C library.
-Upstream-Status: Inappropriate [problem already solved in master branch]
+Upstream-Status: Pending
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
-
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
---
- configure.ac | 3 ++-
- misc/Makefile.am | 3 +--
- misc/rpmxprogname.c | 3 +--
- 3 files changed, 4 insertions(+), 5 deletions(-)
+ configure.ac | 3 ++-
+ rpmio/digest_nss.c | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
-index 92ffd3d68..9c58467c1 100644
+index c04a2e8d1..c9d9ac16d 100644
--- a/configure.ac
+++ b/configure.ac
-@@ -229,6 +229,7 @@ AC_SEARCH_LIBS(dlopen, [dl])
+@@ -255,6 +255,7 @@ AC_SEARCH_LIBS(dlopen, [dl])
# Check for libelf library. Prefer external, otherwise none.
WITH_LIBELF_LIB=
AC_CHECK_HEADER([libelf.h])
@@ -26,7 +23,7 @@ index 92ffd3d68..9c58467c1 100644
AC_CHECK_HEADERS([gelf.h], [
AC_CHECK_LIB(elf, gelf_getvernaux, [
AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
-@@ -237,7 +238,7 @@ AC_CHECK_HEADERS([gelf.h], [
+@@ -263,7 +264,7 @@ AC_CHECK_HEADERS([gelf.h], [
])
])
AC_SUBST(WITH_LIBELF_LIB)
@@ -35,40 +32,17 @@ index 92ffd3d68..9c58467c1 100644
AC_CHECK_HEADERS([dwarf.h], [
WITH_LIBDWARF=yes
-diff --git a/misc/Makefile.am b/misc/Makefile.am
-index 8bf0093d9..b9db3d31a 100644
---- a/misc/Makefile.am
-+++ b/misc/Makefile.am
-@@ -5,10 +5,9 @@ AM_CPPFLAGS += -I$(top_srcdir)/misc
-
- EXTRA_DIST = \
- fnmatch.c fnmatch.h \
-- rpmxprogname.c rpmxprogname.h \
- stpcpy.c stpncpy.c
-
- noinst_LTLIBRARIES = libmisc.la
-
--libmisc_la_SOURCES = fts.c fts.h
-+libmisc_la_SOURCES = fts.c fts.h rpmxprogname.c rpmxprogname.h
- libmisc_la_LIBADD = @LTLIBOBJS@
-diff --git a/misc/rpmxprogname.c b/misc/rpmxprogname.c
-index f89600613..e94625ea8 100644
---- a/misc/rpmxprogname.c
-+++ b/misc/rpmxprogname.c
-@@ -13,7 +13,7 @@ char *_rpmxgetprogname(void)
- {
- const char *empty = "";
-
-- if (_rpmxprognam != NULL) /* never return NULL string */
-+ if (_rpmxprogname != NULL) /* never return NULL string */
- return _rpmxprogname;
- else
- return empty;
-@@ -30,4 +30,3 @@ void _rpmxsetprogname(const char *pn)
- }
- }
+diff --git a/rpmio/digest_nss.c b/rpmio/digest_nss.c
+index 992d9acf6..e11920e3e 100644
+--- a/rpmio/digest_nss.c
++++ b/rpmio/digest_nss.c
+@@ -1,5 +1,6 @@
+ #include "system.h"
--#endif /* _RPMXPROGNAME_H */
++#include <signal.h>
+ #include <pthread.h>
+ #include <nss.h>
+ #include <sechash.h>
--
-2.11.0
+2.14.2
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch
deleted file mode 100644
index 9648cac7c..000000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From d42ece6fa15b98d7f9221b90b85b78631df2c0a0 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <alex.kanavin@gmail.com>
-Date: Tue, 14 Feb 2017 13:51:19 +0200
-Subject: [PATCH] When nice value cannot be reset, issue a notice instead of a
- warning
-
-Otherwise build logs on the autobuilder get very clutter, as it
-doesn't allow the nice value to be reset for some reason.
-
-Upstream-Status: Inappropriate [oe specific]
-Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
----
- lib/rpmscript.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/rpmscript.c b/lib/rpmscript.c
-index 5e1e99906..3975aead8 100644
---- a/lib/rpmscript.c
-+++ b/lib/rpmscript.c
-@@ -347,7 +347,7 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
- int ret;
- ret = setpriority(PRIO_PROCESS, 0, 0);
- if (ret == -1) {
-- rpmlog(RPMLOG_WARNING, _("Unable to reset nice value: %s"),
-+ rpmlog(RPMLOG_NOTICE, _("Unable to reset nice value: %s\n"),
- strerror(errno));
- }
-
---
-2.11.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-configure.ac-add-option-for-dbus.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-configure.ac-add-option-for-dbus.patch
new file mode 100644
index 000000000..dc71d9b18
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0001-configure.ac-add-option-for-dbus.patch
@@ -0,0 +1,42 @@
+From dfb422c744fdc1838afc40b8e1f161bb46093d92 Mon Sep 17 00:00:00 2001
+From: Chen Qi <Qi.Chen@windriver.com>
+Date: Sun, 8 Apr 2018 12:06:42 +0800
+Subject: [PATCH] configure.ac: add option for dbus
+
+Add option for dbus so that users could choose to build with dbus
+or with no dbus.
+
+Upstream-Status: Pending
+
+Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
+---
+ configure.ac | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 4db15c7909..493f393d31 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -976,12 +976,15 @@ AS_IF([test "$enable_plugins" = yes],[
+ ])
+ AM_CONDITIONAL(ENABLE_PLUGINS,[test "$enable_plugins" = yes])
+
+-with_dbus=no
+-AS_IF([test "$enable_plugins" != no],[
++AC_ARG_WITH([dbus], [AS_HELP_STRING([--with-dbus], [build with dbus support])],
++ [],
++ [with_dbus=yes])
++
++AS_IF([test "$with_dbus" != no],[
+ PKG_CHECK_MODULES([DBUS],
+ [dbus-1 >= 1.3],
+- [AC_DEFINE(DBUS, 1, [Build with dbus support?]) with_dbus=yes],
+- [with_dbus=no])
++ [AC_DEFINE(DBUS, 1, [Build with dbus support?])],
++ [AC_MSG_ERROR([dbus not present (--without-dbus to disable)])])
+ AC_SUBST(DBUS_CFLAGS)
+ AC_SUBST(DBUS_LIBS)
+ ])
+--
+2.11.0
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0002-Optimize-rpmSetCloseOnExec.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0002-Optimize-rpmSetCloseOnExec.patch
new file mode 100644
index 000000000..a27f8e623
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0002-Optimize-rpmSetCloseOnExec.patch
@@ -0,0 +1,100 @@
+From 5e6f05cd8dad6c1ee6bd1e6e43f176976c9c3416 Mon Sep 17 00:00:00 2001
+From: Kir Kolyshkin <kolyshkin@gmail.com>
+Date: Tue, 29 May 2018 17:52:56 -0700
+Subject: [PATCH 2/3] Optimize rpmSetCloseOnExec
+
+In case maximum number of open files limit is set too high, both
+luaext/Pexec() and lib/doScriptExec() spend way too much time
+trying to set FD_CLOEXEC flag for all those file descriptors,
+resulting in severe increase of time it takes to execute say
+rpm or dnf.
+
+This becomes increasingly noticeable when running with e.g. under
+Docker, the reason being:
+
+> $ docker run fedora ulimit -n
+> 1048576
+
+One obvious fix is to use procfs to get the actual list of opened fds
+and iterate over it. My quick-n-dirty benchmark shows the /proc approach
+is about 10x faster than iterating through a list of just 1024 fds,
+so it's an improvement even for default ulimit values.
+
+Note that the old method is still used in case /proc is not available.
+
+While at it,
+
+ 1. fix the function by making sure we modify (rather than set)
+ the existing flags. As the only known flag is FD_CLOEXEC,
+ this change is currently purely aesthetical, but in case
+ other flags will appear it will become a real bug fix.
+
+ 2. get rid of magic number 3; use STDERR_FILENO
+
+Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
+
+Fixes #444
+
+Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/444]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ rpmio/rpmio.c | 43 ++++++++++++++++++++++++++++++++++---------
+ 1 file changed, 34 insertions(+), 9 deletions(-)
+
+diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
+index ea111d2ec..55351c221 100644
+--- a/rpmio/rpmio.c
++++ b/rpmio/rpmio.c
+@@ -1760,18 +1760,43 @@ DIGEST_CTX fdDupDigest(FD_t fd, int id)
+ return ctx;
+ }
+
++static void set_cloexec(int fd)
++{
++ int flags = fcntl(fd, F_GETFD);
++
++ if (flags == -1 || (flags & FD_CLOEXEC))
++ return;
++
++ fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
++}
++
+ void rpmSetCloseOnExec(void)
+ {
+- int flag, fdno, open_max;
++ const int min_fd = STDERR_FILENO; /* don't touch stdin/out/err */
++ int fd;
++
++ DIR *dir = opendir("/proc/self/fd");
++ if (dir == NULL) { /* /proc not available */
++ /* iterate over all possible fds, might be slow */
++ int open_max = sysconf(_SC_OPEN_MAX);
++ if (open_max == -1)
++ open_max = 1024;
+
+- open_max = sysconf(_SC_OPEN_MAX);
+- if (open_max == -1) {
+- open_max = 1024;
++ for (fd = min_fd + 1; fd < open_max; fd++)
++ set_cloexec(fd);
++
++ return;
+ }
+- for (fdno = 3; fdno < open_max; fdno++) {
+- flag = fcntl(fdno, F_GETFD);
+- if (flag == -1 || (flag & FD_CLOEXEC))
+- continue;
+- fcntl(fdno, F_SETFD, FD_CLOEXEC);
++
++ /* iterate over fds obtained from /proc */
++ struct dirent *entry;
++ while ((entry = readdir(dir)) != NULL) {
++ fd = atoi(entry->d_name);
++ if (fd > min_fd)
++ set_cloexec(fd);
+ }
++
++ closedir(dir);
++
++ return;
+ }
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch
new file mode 100644
index 000000000..389b41b42
--- /dev/null
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0003-rpmSetCloseOnExec-use-getrlimit.patch
@@ -0,0 +1,53 @@
+From 307e28b4cb08b05bc044482058eeebc9f59bb9a9 Mon Sep 17 00:00:00 2001
+From: Kir Kolyshkin <kolyshkin@gmail.com>
+Date: Tue, 29 May 2018 18:09:27 -0700
+Subject: [PATCH 3/3] rpmSetCloseOnExec: use getrlimit()
+
+In case /proc is not available to get the actual list of opened fds,
+we fall back to iterating through the list of all possible fds.
+
+It is possible that during the course of the program execution the limit
+on number of open file descriptors might be lowered, so using the
+current limit, as returned by sysconf(_SC_OPEN_MAX), might omit some
+fds. Therefore, it is better to use rlim_max from the structure
+filled in by gertlimit(RLIMIT_NOFILE) to make sure we're checking
+all fds.
+
+This slows down the function, but only in the case /proc is not
+available, which should be rare in practice.
+
+Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
+Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/444]
+Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+---
+ rpmio/rpmio.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
+index 55351c221..e051c9863 100644
+--- a/rpmio/rpmio.c
++++ b/rpmio/rpmio.c
+@@ -10,6 +10,7 @@
+ #include <sys/personality.h>
+ #endif
+ #include <sys/utsname.h>
++#include <sys/resource.h>
+
+ #include <rpm/rpmlog.h>
+ #include <rpm/rpmmacro.h>
+@@ -1778,7 +1779,14 @@ void rpmSetCloseOnExec(void)
+ DIR *dir = opendir("/proc/self/fd");
+ if (dir == NULL) { /* /proc not available */
+ /* iterate over all possible fds, might be slow */
+- int open_max = sysconf(_SC_OPEN_MAX);
++ struct rlimit rl;
++ int open_max;
++
++ if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY)
++ open_max = rl.rlim_max;
++ else
++ open_max = sysconf(_SC_OPEN_MAX);
++
+ if (open_max == -1)
+ open_max = 1024;
+
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch
index 64a5651f7..8989dcebd 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch
@@ -1,7 +1,7 @@
-From ec305795a302d226343e69031ff2024dfcde69c0 Mon Sep 17 00:00:00 2001
+From 8ce9fbab2990609bdace457e146160334e931c89 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Thu, 8 Jun 2017 17:08:09 +0300
-Subject: [PATCH 3/3] build/pack.c: remove static local variables from
+Subject: [PATCH 14/15] build/pack.c: remove static local variables from
buildHost() and getBuildTime()
Their use is causing difficult to diagnoze data races when building multiple
@@ -11,8 +11,8 @@ difficult to reason about code.
Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/226]
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
-
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
+
---
build/build.c | 54 ++++++++++++++++++++++++++++--
build/pack.c | 84 +++++++++--------------------------------------
@@ -20,7 +20,7 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
3 files changed, 74 insertions(+), 72 deletions(-)
diff --git a/build/build.c b/build/build.c
-index 5f99c8db7..09a1311c5 100644
+index 81152e53e..6001f9e52 100644
--- a/build/build.c
+++ b/build/build.c
@@ -6,6 +6,8 @@
@@ -83,7 +83,7 @@ index 5f99c8db7..09a1311c5 100644
/**
*/
static rpmRC doRmSource(rpmSpec spec)
-@@ -203,6 +249,9 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
+@@ -201,6 +247,9 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
rpmRC rc = RPMRC_OK;
int test = (what & RPMBUILD_NOBUILD);
char *cookie = buildArgs->cookie ? xstrdup(buildArgs->cookie) : NULL;
@@ -93,7 +93,7 @@ index 5f99c8db7..09a1311c5 100644
if (rpmExpandNumeric("%{?source_date_epoch_from_changelog}") &&
getenv("SOURCE_DATE_EPOCH") == NULL) {
-@@ -271,11 +320,11 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
+@@ -269,11 +318,11 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
goto exit;
if (((what & RPMBUILD_PACKAGESOURCE) && !test) &&
@@ -107,7 +107,7 @@ index 5f99c8db7..09a1311c5 100644
goto exit;
if ((what & RPMBUILD_CLEAN) &&
-@@ -295,6 +344,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
+@@ -293,6 +342,7 @@ static rpmRC buildSpec(BTA_t buildArgs, rpmSpec spec, int what)
(void) unlink(spec->specFile);
exit:
@@ -116,7 +116,7 @@ index 5f99c8db7..09a1311c5 100644
spec->rootDir = NULL;
if (rc != RPMRC_OK && rpmlogGetNrecs() > 0) {
diff --git a/build/pack.c b/build/pack.c
-index ed5b9ab4e..62427065a 100644
+index df15876ff..17a4b0905 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -6,8 +6,6 @@
@@ -128,7 +128,7 @@ index ed5b9ab4e..62427065a 100644
#include <sys/wait.h>
#include <rpm/rpmlib.h> /* RPMSIGTAG*, rpmReadPackageFile */
-@@ -151,57 +149,6 @@ exit:
+@@ -152,57 +150,6 @@ exit:
return rc;
}
@@ -186,9 +186,9 @@ index ed5b9ab4e..62427065a 100644
static rpmRC processScriptFiles(rpmSpec spec, Package pkg)
{
struct TriggerFileEntry *p;
-@@ -308,7 +255,8 @@ static int haveRichDep(Package pkg)
- }
-
+@@ -476,7 +423,8 @@ exit:
+ * order to how the RPM format is laid on disk.
+ */
static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
- const char *fileName, char **cookie)
+ const char *fileName, char **cookie,
@@ -196,7 +196,7 @@ index ed5b9ab4e..62427065a 100644
{
FD_t fd = NULL;
char * rpmio_flags = NULL;
-@@ -397,7 +345,7 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
+@@ -500,7 +448,7 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
/* Create and add the cookie */
if (cookie) {
@@ -204,8 +204,8 @@ index ed5b9ab4e..62427065a 100644
+ rasprintf(cookie, "%s %d", buildHost, buildTime);
headerPutString(pkg->header, RPMTAG_COOKIE, *cookie);
}
-
-@@ -546,7 +494,7 @@ static rpmRC checkPackages(char *pkgcheck)
+
+@@ -641,7 +589,7 @@ static rpmRC checkPackages(char *pkgcheck)
return RPMRC_OK;
}
@@ -214,7 +214,7 @@ index ed5b9ab4e..62427065a 100644
{
const char *errorString;
rpmRC rc = RPMRC_OK;
-@@ -565,8 +513,8 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
+@@ -660,8 +608,8 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
headerCopyTags(spec->packages->header, pkg->header, copyTags);
headerPutString(pkg->header, RPMTAG_RPMVERSION, VERSION);
@@ -225,7 +225,7 @@ index ed5b9ab4e..62427065a 100644
if (spec->sourcePkgId != NULL) {
headerPutBin(pkg->header, RPMTAG_SOURCEPKGID, spec->sourcePkgId,16);
-@@ -604,7 +552,7 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
+@@ -699,7 +647,7 @@ static rpmRC packageBinary(rpmSpec spec, Package pkg, const char *cookie, int ch
free(binRpm);
}
@@ -234,7 +234,7 @@ index ed5b9ab4e..62427065a 100644
if (rc == RPMRC_OK) {
/* Do check each written package if enabled */
char *pkgcheck = rpmExpand("%{?_build_pkgcheck} ", *filename, NULL);
-@@ -624,7 +572,7 @@ struct binaryPackageTaskData
+@@ -719,7 +667,7 @@ struct binaryPackageTaskData
struct binaryPackageTaskData *next;
};
@@ -243,7 +243,7 @@ index ed5b9ab4e..62427065a 100644
{
struct binaryPackageTaskData *tasks = NULL;
struct binaryPackageTaskData *task = NULL;
-@@ -636,7 +584,7 @@ static struct binaryPackageTaskData* runBinaryPackageTasks(rpmSpec spec, const c
+@@ -731,7 +679,7 @@ static struct binaryPackageTaskData* runBinaryPackageTasks(rpmSpec spec, const c
if (pkg == spec->packages) {
// the first package needs to be processed ahead of others, as they copy
// changelog data from it, and so otherwise data races would happen
@@ -252,7 +252,7 @@ index ed5b9ab4e..62427065a 100644
rpmlog(RPMLOG_NOTICE, _("Finished binary package job, result %d, filename %s\n"), task->result, task->filename);
tasks = task;
}
-@@ -653,7 +601,7 @@ static struct binaryPackageTaskData* runBinaryPackageTasks(rpmSpec spec, const c
+@@ -748,7 +696,7 @@ static struct binaryPackageTaskData* runBinaryPackageTasks(rpmSpec spec, const c
if (task != tasks)
#pragma omp task
{
@@ -261,7 +261,7 @@ index ed5b9ab4e..62427065a 100644
rpmlog(RPMLOG_NOTICE, _("Finished binary package job, result %d, filename %s\n"), task->result, task->filename);
}
}
-@@ -671,11 +619,11 @@ static void freeBinaryPackageTasks(struct binaryPackageTaskData* tasks)
+@@ -766,11 +714,11 @@ static void freeBinaryPackageTasks(struct binaryPackageTaskData* tasks)
}
}
@@ -275,7 +275,7 @@ index ed5b9ab4e..62427065a 100644
for (struct binaryPackageTaskData *task = tasks; task != NULL; task = task->next) {
if (task->result == RPMRC_OK) {
-@@ -702,22 +650,22 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
+@@ -797,7 +745,7 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
return RPMRC_OK;
}
@@ -284,6 +284,7 @@ index ed5b9ab4e..62427065a 100644
{
Package sourcePkg = spec->sourcePackage;
rpmRC rc;
+@@ -805,8 +753,8 @@ rpmRC packageSources(rpmSpec spec, char **cookie)
/* Add some cruft */
headerPutString(sourcePkg->header, RPMTAG_RPMVERSION, VERSION);
@@ -291,9 +292,10 @@ index ed5b9ab4e..62427065a 100644
- headerPutUint32(sourcePkg->header, RPMTAG_BUILDTIME, getBuildTime(), 1);
+ headerPutString(sourcePkg->header, RPMTAG_BUILDHOST, buildHost);
+ headerPutUint32(sourcePkg->header, RPMTAG_BUILDTIME, &buildTime, 1);
+ headerPutUint32(sourcePkg->header, RPMTAG_SOURCEPACKAGE, &one, 1);
/* XXX this should be %_srpmdir */
- { char *fn = rpmGetPath("%{_srcrpmdir}/", spec->sourceRpmName,NULL);
+@@ -814,7 +762,7 @@ rpmRC packageSources(rpmSpec spec, char **cookie)
char *pkgcheck = rpmExpand("%{?_build_pkgcheck_srpm} ", fn, NULL);
spec->sourcePkgId = NULL;
@@ -303,10 +305,10 @@ index ed5b9ab4e..62427065a 100644
/* Do check SRPM package if enabled */
if (rc == RPMRC_OK && pkgcheck[0] != ' ') {
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
-index 8351a6a34..797337ca7 100644
+index 439b7d3b5..07e8338ad 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
-@@ -408,19 +408,23 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags);
+@@ -427,19 +427,23 @@ rpmRC processSourceFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags);
* @param spec spec file control structure
* @param cookie build identifier "cookie" or NULL
* @param cheating was build shortcircuited?
@@ -333,5 +335,5 @@ index 8351a6a34..797337ca7 100644
RPM_GNUC_INTERNAL
int addLangTag(rpmSpec spec, Header h, rpmTagVal tag,
--
-2.11.0
+2.14.2
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch
index c910a478e..4ac5c38f0 100644
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch
+++ b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch
@@ -1,7 +1,7 @@
-From d65d6e8760afbd7f70b22a1f3297a037bc475fea Mon Sep 17 00:00:00 2001
+From 5141d50d7b3d3c209a22c53deedb4ceef014401d Mon Sep 17 00:00:00 2001
From: Peter Kjellerstedt <pkj@axis.com>
Date: Mon, 15 May 2017 10:21:08 +0200
-Subject: [PATCH 11/13] Do not require that ELF binaries are executable to be
+Subject: [PATCH 09/15] Do not require that ELF binaries are executable to be
identifiable
There is nothing that requires, e.g., a DSO to be executable, but it
@@ -14,19 +14,20 @@ or not.
Upstream-Status: Inappropriate
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
+
---
fileattrs/elf.attr | 1 -
1 file changed, 1 deletion(-)
diff --git a/fileattrs/elf.attr b/fileattrs/elf.attr
-index 595b33e09..bac52649d 100644
+index 5805dd0ee..3516f309d 100644
--- a/fileattrs/elf.attr
+++ b/fileattrs/elf.attr
@@ -1,4 +1,3 @@
%__elf_provides %{_rpmconfigdir}/elfdeps --provides %{?__filter_GLIBC_PRIVATE:--filter-private}
%__elf_requires %{_rpmconfigdir}/elfdeps --requires %{?__filter_GLIBC_PRIVATE:--filter-private}
- %__elf_magic ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*$
+ %__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$
-%__elf_flags exeonly
--
-2.12.0
+2.14.2
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch
deleted file mode 100644
index 996da90d4..000000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch
+++ /dev/null
@@ -1,36 +0,0 @@
-From 77808db4036dc4a012c47aca36255549ed764a6a Mon Sep 17 00:00:00 2001
-From: Peter Kjellerstedt <pkj@axis.com>
-Date: Tue, 16 May 2017 10:58:18 +0200
-Subject: [PATCH 12/13] Use conditional to access %{_docdir} in macros.in
-
-This avoids the following warning:
-
-warning: Ignoring invalid regex %{_docdir}
-
-when runing `rpmdeps -R <file>`, since %{_docdir} is only defined when
-parsing a spec file (in parseSpec()).
-
-Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/216]
-Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
----
- macros.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/macros.in b/macros.in
-index 84ae25275..cca67a500 100644
---- a/macros.in
-+++ b/macros.in
-@@ -200,8 +200,8 @@ package or when debugging this package.\
- # Their purpouse is to set up global filtering for all packages. If you need
- # to set up specific filtering for your package use %__requires_exclude_from
- # and %__provides_exclude_from instead.
--%__global_requires_exclude_from %{_docdir}
--%__global_provides_exclude_from %{_docdir}
-+%__global_requires_exclude_from %{?_docdir:%{_docdir}}
-+%__global_provides_exclude_from %{?_docdir:%{_docdir}}
-
- # The path to the gzip executable (legacy, use %{__gzip} instead).
- %_gzipbin %{__gzip}
---
-2.12.0
-
diff --git a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0013-Add-a-new-option-alldeps-to-rpmdeps.patch b/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0013-Add-a-new-option-alldeps-to-rpmdeps.patch
deleted file mode 100644
index faaf62960..000000000
--- a/import-layers/yocto-poky/meta/recipes-devtools/rpm/files/0013-Add-a-new-option-alldeps-to-rpmdeps.patch
+++ /dev/null
@@ -1,152 +0,0 @@
-From 3bf20a6116ae3e1a5a3a6907bee7e881b17efb2f Mon Sep 17 00:00:00 2001
-From: Peter Kjellerstedt <pkj@axis.com>
-Date: Mon, 15 May 2017 11:23:26 +0200
-Subject: [PATCH 13/13] Add a new option --alldeps to rpmdeps
-
-This will send the output from rpmfcPrint() to stdout. This is an
-alternative to using the --rpmfcdebug option, which will send the same
-output to stderr. The two options have totally different use cases
-though. While --alldeps is used when the output from rpmfcPrint() is
-what is wanted, --rpmfcdebug can be used together with the other
-output options, e.g., --requires, without affecting their output.
-
-Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/220]
-Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
----
- build/rpmfc.c | 27 ++++++++++++++-------------
- build/rpmfc.h | 1 -
- tools/rpmdeps.c | 44 +++++++++++++++++++++++++-------------------
- 3 files changed, 39 insertions(+), 33 deletions(-)
-
-diff --git a/build/rpmfc.c b/build/rpmfc.c
-index c8e2f876a..44f1cdc9a 100644
---- a/build/rpmfc.c
-+++ b/build/rpmfc.c
-@@ -732,7 +732,6 @@ static rpm_color_t rpmfcColor(const char * fmstr)
-
- void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
- {
-- rpm_color_t fcolor;
- int ndx;
- int dx;
- int fx;
-@@ -744,21 +743,23 @@ void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
-
- if (fc)
- for (fx = 0; fx < fc->nfiles; fx++) {
-- rpmsid cx = fc->fcdictx[fx] + 1; /* id's are one off */
-- fcolor = fc->fcolor[fx];
-- ARGV_t fattrs = fc->fattrs[fx];
--
- fprintf(fp, "%3d %s", fx, fc->fn[fx]);
-- if (fcolor != RPMFC_BLACK)
-+ if (_rpmfc_debug) {
-+ rpmsid cx = fc->fcdictx[fx] + 1; /* id's are one off */
-+ rpm_color_t fcolor = fc->fcolor[fx];
-+ ARGV_t fattrs = fc->fattrs[fx];
-+
-+ if (fcolor != RPMFC_BLACK)
- fprintf(fp, "\t0x%x", fc->fcolor[fx]);
-- else
-+ else
- fprintf(fp, "\t%s", rpmstrPoolStr(fc->cdict, cx));
-- if (fattrs) {
-- char *attrs = argvJoin(fattrs, ",");
-- fprintf(fp, " [%s]", attrs);
-- free(attrs);
-- } else {
-- fprintf(fp, " [none]");
-+ if (fattrs) {
-+ char *attrs = argvJoin(fattrs, ",");
-+ fprintf(fp, " [%s]", attrs);
-+ free(attrs);
-+ } else {
-+ fprintf(fp, " [none]");
-+ }
- }
- fprintf(fp, "\n");
-
-diff --git a/build/rpmfc.h b/build/rpmfc.h
-index dae8ea5b1..3d87b31cf 100644
---- a/build/rpmfc.h
-+++ b/build/rpmfc.h
-@@ -45,7 +45,6 @@ typedef const struct rpmfcTokens_s * rpmfcToken;
-
- /** \ingroup rpmfc
- * Print results of file classification.
-- * @todo Remove debugging routine.
- * @param msg message prefix (NULL for none)
- * @param fc file classifier
- * @param fp output file handle (NULL for stderr)
-diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c
-index a414b6343..f260a38c4 100644
---- a/tools/rpmdeps.c
-+++ b/tools/rpmdeps.c
-@@ -23,6 +23,8 @@ static int print_conflicts;
-
- static int print_obsoletes;
-
-+static int print_alldeps;
-+
- static void rpmdsPrint(const char * msg, rpmds ds, FILE * fp)
- {
- if (fp == NULL) fp = stderr;
-@@ -57,6 +59,8 @@ static struct poptOption optionsTable[] = {
- NULL, NULL },
- { "obsoletes", '\0', POPT_ARG_VAL, &print_obsoletes, -1,
- NULL, NULL },
-+ { "alldeps", '\0', POPT_ARG_VAL, &print_alldeps, -1,
-+ NULL, NULL },
-
- POPT_AUTOALIAS
- POPT_AUTOHELP
-@@ -100,25 +104,27 @@ main(int argc, char *argv[])
- if (rpmfcClassify(fc, av, NULL) || rpmfcApply(fc))
- goto exit;
-
-- if (_rpmfc_debug)
-- rpmfcPrint(buf, fc, NULL);
--
-- if (print_provides)
-- rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
-- if (print_requires)
-- rpmdsPrint(NULL, rpmfcRequires(fc), stdout);
-- if (print_recommends)
-- rpmdsPrint(NULL, rpmfcRecommends(fc), stdout);
-- if (print_suggests)
-- rpmdsPrint(NULL, rpmfcSuggests(fc), stdout);
-- if (print_supplements)
-- rpmdsPrint(NULL, rpmfcSupplements(fc), stdout);
-- if (print_enhances)
-- rpmdsPrint(NULL, rpmfcEnhances(fc), stdout);
-- if (print_conflicts)
-- rpmdsPrint(NULL, rpmfcConflicts(fc), stdout);
-- if (print_obsoletes)
-- rpmdsPrint(NULL, rpmfcObsoletes(fc), stdout);
-+ if (print_alldeps || _rpmfc_debug)
-+ rpmfcPrint(NULL, fc, print_alldeps ? stdout : NULL);
-+
-+ if (!print_alldeps) {
-+ if (print_provides)
-+ rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
-+ if (print_requires)
-+ rpmdsPrint(NULL, rpmfcRequires(fc), stdout);
-+ if (print_recommends)
-+ rpmdsPrint(NULL, rpmfcRecommends(fc), stdout);
-+ if (print_suggests)
-+ rpmdsPrint(NULL, rpmfcSuggests(fc), stdout);
-+ if (print_supplements)
-+ rpmdsPrint(NULL, rpmfcSupplements(fc), stdout);
-+ if (print_enhances)
-+ rpmdsPrint(NULL, rpmfcEnhances(fc), stdout);
-+ if (print_conflicts)
-+ rpmdsPrint(NULL, rpmfcConflicts(fc), stdout);
-+ if (print_obsoletes)
-+ rpmdsPrint(NULL, rpmfcObsoletes(fc), stdout);
-+ }
-
- ec = 0;
-
---
-2.12.0
-
OpenPOWER on IntegriCloud