[packages/rpm/rpm.org] - disable expanding of rpm macros in %changelog and %description

baggins baggins at pld-linux.org
Fri Dec 18 20:16:05 CET 2020


commit ebb8d09343cd9d90f31fafdcfd81e6227a32789e
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Fri Dec 18 20:14:38 2020 +0100

    - disable expanding of rpm macros in %changelog and %description
    
    This is rebased commit 0a6e9fd18fb9abecd65b1b8e94de0fa0a27415ba

 noexpand.patch | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 rpm.spec       |  4 +++-
 2 files changed, 51 insertions(+), 1 deletion(-)
---
diff --git a/rpm.spec b/rpm.spec
index c54caf8..ae83ab7 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -26,7 +26,7 @@ Summary(ru.UTF-8):	Менеджер пакетов от RPM
 Summary(uk.UTF-8):	Менеджер пакетів від RPM
 Name:		rpm
 Version:	4.16.0
-Release:	0.12
+Release:	0.13
 Epoch:		1
 License:	GPL v2 / LGPL v2.1
 Group:		Base
@@ -82,6 +82,7 @@ Patch28:	default-patch-flags.patch
 Patch29:	%{name}-noarch_py_prov.patch
 Patch30:	missing-ghost-terminate-build.patch
 Patch31:	missing-doc-terminate-build.patch
+Patch32:	noexpand.patch
 URL:		https://rpm.org/
 BuildRequires:	acl-devel
 BuildRequires:	db-devel >= %{db_ver}
@@ -579,6 +580,7 @@ Dokumentacja API RPM-a oraz przewodniki w formacie HTML generowane ze
 %patch29 -p1
 %patch30 -p1
 %patch31 -p1
+%patch32 -p1
 
 install %{SOURCE15} scripts/perl.prov.in
 
diff --git a/noexpand.patch b/noexpand.patch
new file mode 100644
index 0000000..5de7900
--- /dev/null
+++ b/noexpand.patch
@@ -0,0 +1,48 @@
+diff -ur rpm-4.16.0/build/parseChangelog.c rpm-4.16.0-noexpand/build/parseChangelog.c
+--- rpm-4.16.0/build/parseChangelog.c	2020-12-18 20:09:28.341535424 +0100
++++ rpm-4.16.0-noexpand/build/parseChangelog.c	2020-12-18 20:01:53.963847399 +0100
+@@ -321,7 +321,7 @@
+ 	goto exit;
+     }
+     
+-    if ((res = parseLines(spec, STRIP_COMMENTS, &sb, NULL)) == PART_ERROR)
++    if ((res = parseLines(spec, STRIP_COMMENTS | STRIP_NOEXPAND, &sb, NULL)) == PART_ERROR)
+ 	goto exit;
+ 
+     if (sb && addChangelog(spec->packages->header, sb)) {
+diff -ur rpm-4.16.0/build/parseDescription.c rpm-4.16.0-noexpand/build/parseDescription.c
+--- rpm-4.16.0/build/parseDescription.c	2020-05-28 12:04:25.002136494 +0200
++++ rpm-4.16.0-noexpand/build/parseDescription.c	2020-12-18 20:02:38.770619734 +0100
+@@ -64,7 +64,7 @@
+     if (lookupPackage(spec, name, flag, &pkg))
+ 	goto exit;
+ 
+-    if ((nextPart = parseLines(spec, (STRIP_TRAILINGSPACE |STRIP_COMMENTS),
++    if ((nextPart = parseLines(spec, (STRIP_TRAILINGSPACE |STRIP_COMMENTS | STRIP_NOEXPAND),
+ 				NULL, &sb)) == PART_ERROR) {
+ 	goto exit;
+     }
+diff -ur rpm-4.16.0/build/parseSpec.c rpm-4.16.0-noexpand/build/parseSpec.c
+--- rpm-4.16.0/build/parseSpec.c	2020-05-28 12:04:25.007136522 +0200
++++ rpm-4.16.0-noexpand/build/parseSpec.c	2020-12-18 20:08:13.791373996 +0100
+@@ -242,6 +242,9 @@
+ 	if (!spec->readStack->reading)
+ 	    return 0;
+     }
++    /* Also don't expand macros in %changelog and %description, where we set STRIP_NOEXPAND flag */
++    if (strip & STRIP_NOEXPAND)
++	return 0;
+ 
+     if (specExpand(spec, ofi->lineNum, spec->lbuf, &lbuf))
+ 	return 1;
+diff -ur rpm-4.16.0/build/rpmbuild_internal.h rpm-4.16.0-noexpand/build/rpmbuild_internal.h
+--- rpm-4.16.0/build/rpmbuild_internal.h	2020-12-18 20:09:28.354868788 +0100
++++ rpm-4.16.0-noexpand/build/rpmbuild_internal.h	2020-12-18 20:09:09.054827168 +0100
+@@ -246,6 +246,7 @@
+ #define STRIP_NOTHING             0
+ #define STRIP_TRAILINGSPACE (1 << 0)
+ #define STRIP_COMMENTS      (1 << 1)
++#define STRIP_NOEXPAND      (1 << 2)
+ 
+ #define ALLOW_EMPTY         (1 << 16)
+ 
================================================================

---- gitweb:

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



More information about the pld-cvs-commit mailing list