[packages/rpm] - ignore non-existing files and backups specified in %{load:...} statement in macro files - rel 4

baggins baggins at pld-linux.org
Sun Dec 7 22:11:51 CET 2014


commit 10a92209fb37f7309de983774dea1c800a343044
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Sun Dec 7 22:10:58 2014 +0100

    - ignore non-existing files and backups specified in %{load:...}
      statement in macro files
    - rel 4

 rpm-ignore-missing-macro-files.patch | 51 ++++++++++++++++++++++++++++++++++++
 rpm.spec                             |  5 +++-
 2 files changed, 55 insertions(+), 1 deletion(-)
---
diff --git a/rpm.spec b/rpm.spec
index 18354ee..530644d 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -51,7 +51,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	5.4.15
-Release:	3
+Release:	4
 License:	LGPL v2.1
 Group:		Base
 # http://rpm5.org/files/rpm/rpm-5.4/rpm-5.4.15-0.20140824.src.rpm
@@ -168,6 +168,7 @@ Patch79:	%{name}-rpmspec.patch
 Patch80:	%{name}-revert-gpg-argv-parsing.patch
 Patch81:	%{name}-perl-magic.patch
 Patch82:	%{name}-5.4.15-use-DSA-sig.patch
+Patch83:	%{name}-ignore-missing-macro-files.patch
 
 # Patches imported from Mandriva
 
@@ -971,6 +972,8 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
 %patch1046 -p1
 %patch1047 -p1
 
+%patch83 -p1
+
 install %{SOURCE2} macros/pld.in
 install %{SOURCE8} scripts/php.prov.in
 install %{SOURCE9} scripts/php.req.in
diff --git a/rpm-ignore-missing-macro-files.patch b/rpm-ignore-missing-macro-files.patch
new file mode 100644
index 0000000..43c48e4
--- /dev/null
+++ b/rpm-ignore-missing-macro-files.patch
@@ -0,0 +1,51 @@
+--- rpm-5.4.15/rpmio/macro.c~	2014-12-07 20:24:53.000000000 +0100
++++ rpm-5.4.15/rpmio/macro.c	2014-12-07 20:44:45.739944044 +0100
+@@ -2965,7 +2965,17 @@
+ 	    se = rpmMCExpand(mc, s, NULL);
+ 	    rc = rpmGlob(se, &argc, &argv);
+ 	    for(i = 0; i < argc; i++) {
+-		rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1);
++		/* Skip backups, non existing files and %config leftovers. */
++#define	_suffix(_s, _x) \
++    (slen >= sizeof(_x) && !strcmp((_s)+slen-(sizeof(_x)-1), (_x)))
++		if (!(_suffix(fn, "~")
++		   || _suffix(fn, ".rpmnew")
++		   || _suffix(fn, ".rpmorig")
++		   || _suffix(fn, ".rpmsave"))
++		   && !Access(argv[i], R_OK)
++		   )
++		    rc |= rpmLoadMacroFile(mc, argv[i], nesting - 1);
++#undef _suffix
+ 		argv[i] = _free(argv[i]);
+ 	    }
+ 	    argv = _free(argv);
+--- rpm-5.4.15/macros/macros.in~	2014-12-07 21:43:59.000000000 +0100
++++ rpm-5.4.15/macros/macros.in	2014-12-07 22:07:57.383101292 +0100
+@@ -1019,13 +1019,7 @@
+ %{nil}
+ 
+ #==============================================================================
+-# XXX Caveat:
+-# XXX With %{load:...} being interpreted immediately -- not lazily --
+-# XXX within a macro init file, a failure to load causes immediate loading
+-# XXX termination silently.
+-# XXX
+-# XXX So the order as well as the existence of the %{load:...} macros below
+-# XXX are critically important.
++# XXX If a file specified in %{load:...} does not exist, it will be skipped.
+ # XXX
+ # XXX Note also that loaded macro files can NOT recursively load other
+ # XXX macro files; only a top-level (i.e. after --macros, or within a *.spec)
+@@ -1036,11 +1030,8 @@
+ # XXX for configuring RPM itself.
+ # XXX
+ # XXX Simple example(s):
+-# XXX	If the file %{_usrlibrpm}/macros.d/selinux doesn't exist,
+-# XXX	then %{_usrlibrpm}/macros.rpmbuild will NOT be loaded.
+-# XXX
+ # XXX	if the file %{_usrlibrpm}/macros.d/cmake attempts another
+-# XXX	%{load:...}, then loading will CEASE at that point in the file.
++# XXX	%{load:...}, then the statement will be IGNORED.
+ #==============================================================================
+ # ---- SELinux configuration macros.
+ %{load:%{_usrlibrpm}/macros.d/selinux}
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm.git/commitdiff/10a92209fb37f7309de983774dea1c800a343044



More information about the pld-cvs-commit mailing list