[packages/rpm-specdump] - define rpm version from pkg-config - drop support for antiquated rpm

baggins baggins at pld-linux.org
Mon Oct 19 00:24:26 CEST 2020


commit 74900489aa4de2877e4e4828393ec513aa27c1c9
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Oct 19 00:23:47 2020 +0200

    - define rpm version from pkg-config
    - drop support for antiquated rpm

 Makefile       |  3 +++
 rpm-specdump.c | 26 ++------------------------
 2 files changed, 5 insertions(+), 24 deletions(-)
---
diff --git a/Makefile b/Makefile
index 992fbaa..0dcbb6c 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@ CFLAGS := -Wall -Wno-unused-result $(RPMCFLAGS)
 LDFLAGS := $(RPMLDFLAGS)
 INCLUDES := `pkg-config --cflags rpm`
 LIBS := `pkg-config --libs rpm`
+RPM_FORMAT_VERSION := `pkg-config --modversion rpm | cut -d . -f 1`
+RPM_MAJOR_VERSION := `pkg-config --modversion rpm | cut -d . -f 1`
+RPM_MINOR_VERSION := `pkg-config --modversion rpm | cut -d . -f 1`
 
 rpm-specdump: rpm-specdump.o
 	$(CC) $(LDFLAGS) $< -o $@ $(LIBS)
diff --git a/rpm-specdump.c b/rpm-specdump.c
index f1a8200..deaa22a 100644
--- a/rpm-specdump.c
+++ b/rpm-specdump.c
@@ -80,24 +80,7 @@
 // macros from kernel
 #define RPM_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
 
-#if !defined(RPM_FORMAT_VERSION)
-#include <rpmversion.h>
-#if defined(RPMLIB_VERSION) && RPMLIB_VENDOR_EQ('R','P','M','5')
-#	if RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,4,r,0,0,_)
-#		define	RPM_VERSION_CODE RPM_VERSION(5, 4, 0)
-#	elif RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,3,r,0,0,_)
-#		define	RPM_VERSION_CODE RPM_VERSION(5, 3, 0)
-#	elif RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,2,r,0,0,_)
-#		define	RPM_VERSION_CODE RPM_VERSION(5, 2, 0)
-#	elif RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,1,r,0,0,_)
-#		define	RPM_VERSION_CODE RPM_VERSION(5, 1, 0)
-#	elif RPMLIB_VERSION >= RPMLIB_VERSION_ENCODE(5,0,r,0,0,_)
-#		define	RPM_VERSION_CODE RPM_VERSION(5, 0, 0)
-#	endif
-#endif
-#else
-#	define	RPM_VERSION_CODE RPM_VERSION(RPM_FORMAT_VERSION, RPM_MAJOR_VERSION, RPM_MINOR_VERSION)
-#endif
+#define RPM_VERSION_CODE RPM_VERSION(RPM_FORMAT_VERSION, RPM_MAJOR_VERSION, RPM_MINOR_VERSION)
 
 #include <rpmio.h>
 #include <rpmbuild.h>
@@ -118,11 +101,6 @@
 #define ARG_UID		1030
 #define ARG_GID		1031
 
-// RPM 4.4.2
-#if RPM_VERSION_CODE < RPM_VERSION(4,4,9)
-#	define RPMFILE_SOURCE RPMBUILD_ISSOURCE
-#endif
-
 #if !defined(EXIT_FAILURE)
 #	define EXIT_FAILURE 1
 #endif
@@ -243,7 +221,7 @@ parseArgs(struct Arguments *args, int argc, char *argv[])
     int		c = getopt_long(argc, argv, "", CMDLINE_OPTIONS, 0);
     if (c==-1) break;
     switch (c) {
-      case 'h'		:  showHelp(1, argv[0], 0);
+      case 'h'		:  showHelp(1, argv[0], 0); break;
       case ARG_TARGET	:  args->target = optarg; break;
       case ARG_RCFILE	:  args->rcfile = optarg; break;
       case ARG_CHROOT	:  args->chroot = optarg; break;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/rpm-specdump.git/commitdiff/74900489aa4de2877e4e4828393ec513aa27c1c9



More information about the pld-cvs-commit mailing list