2020-10-27 11:36:01 +01:00
|
|
|
--- ./Makefile.am.orig 2020-09-30 12:47:19.181371209 +0000
|
|
|
|
+++ ./Makefile.am 2020-09-30 12:47:25.797356566 +0000
|
|
|
|
@@ -198,6 +198,10 @@ rpmgraph_LDADD = lib/librpm.la rpmio/lib
|
2011-05-16 18:07:44 +02:00
|
|
|
|
|
|
|
dist_bin_SCRIPTS = scripts/gendiff
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2009-08-28 15:54:03 +02:00
|
|
|
+bin_PROGRAMS += rpmqpack
|
|
|
|
+rpmqpack_SOURCES = rpmqpack.c
|
|
|
|
+rpmqpack_LDADD = lib/librpm.la
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
2009-08-28 15:54:03 +02:00
|
|
|
rpmconfig_DATA = rpmrc
|
|
|
|
rpmrc: $(top_srcdir)/rpmrc.in
|
|
|
|
@$(SED) \
|
2020-10-27 11:36:01 +01:00
|
|
|
--- ./doc/Makefile.am.orig 2020-09-30 12:47:25.797356566 +0000
|
|
|
|
+++ ./doc/Makefile.am 2020-09-30 12:48:22.709230608 +0000
|
2011-05-16 18:07:44 +02:00
|
|
|
@@ -8,7 +8,7 @@ EXTRA_DIST += $(man_man1_DATA)
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2009-08-28 15:54:03 +02:00
|
|
|
man_man8dir = $(mandir)/man8
|
2017-12-05 11:46:24 +01:00
|
|
|
man_man8_DATA = rpm.8 rpm-misc.8 rpmbuild.8 rpmdeps.8 rpmgraph.8 rpm2cpio.8
|
2011-05-16 18:07:44 +02:00
|
|
|
-man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8
|
|
|
|
+man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8 rpmqpack.8
|
2020-10-27 11:36:01 +01:00
|
|
|
|
2009-08-28 15:54:03 +02:00
|
|
|
EXTRA_DIST += $(man_man8_DATA)
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2020-10-27 11:36:01 +01:00
|
|
|
--- ./doc/rpmqpack.8.orig 2020-09-30 12:47:25.797356566 +0000
|
|
|
|
+++ ./doc/rpmqpack.8 2020-09-30 12:47:25.797356566 +0000
|
2006-12-19 00:17:44 +01:00
|
|
|
@@ -0,0 +1,25 @@
|
|
|
|
+.TH RPMQPACK 8 "Mar 2002"
|
|
|
|
+.SH NAME
|
|
|
|
+rpmqpack \- check for installed rpm packages
|
|
|
|
+
|
|
|
|
+.SH SYNOPSIS
|
|
|
|
+.B rpmqpack
|
|
|
|
+.RI [ pack1 "] [" pack2 ]...
|
|
|
|
+
|
|
|
|
+.SH DESCRIPTION
|
|
|
|
+rpmqpack checks if packages given as arguments are installed in
|
|
|
|
+the system. It prints each installed package to stdout.
|
|
|
|
+If no arguments are given all installed packages are printed.
|
|
|
|
+
|
|
|
|
+.SH EXIT STATUS
|
|
|
|
+rpmqpack returns 0 if all given packages are installed, otherwise
|
|
|
|
+1.
|
|
|
|
+
|
|
|
|
+.SH SEE ALSO
|
|
|
|
+.BR rpm (1)
|
|
|
|
+
|
|
|
|
+.SH COPYRIGHT
|
2014-08-18 15:03:18 +02:00
|
|
|
+2002 SUSE Linux AG Nuernberg, Germany.
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
|
|
|
+.SH AUTHOR
|
|
|
|
+Michael Schroeder <mls@suse.de>
|
2020-10-27 11:36:01 +01:00
|
|
|
--- ./rpmqpack.c.orig 2020-09-30 12:47:25.797356566 +0000
|
|
|
|
+++ ./rpmqpack.c 2020-09-30 12:47:25.797356566 +0000
|
2020-01-17 11:30:30 +01:00
|
|
|
@@ -0,0 +1,60 @@
|
2006-12-19 00:17:44 +01:00
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <limits.h>
|
|
|
|
+#include <fcntl.h>
|
|
|
|
+#include <stdio.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+
|
2020-01-17 11:30:30 +01:00
|
|
|
+#include <rpm/rpmts.h>
|
|
|
|
+#include <rpm/rpmdb.h>
|
|
|
|
+#include <rpm/rpmmacro.h>
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
|
|
|
+int
|
|
|
|
+main(int argc, char **argv)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmts ts;
|
2006-12-19 00:17:44 +01:00
|
|
|
+
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmDefineMacro(NULL, "_dbpath /var/lib/rpm", 0);
|
|
|
|
+ ts = rpmtsCreate();
|
|
|
|
+ if (!ts)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ {
|
2020-01-17 11:30:30 +01:00
|
|
|
+ fprintf(stderr, "rpmtsCreate failed\n");
|
2006-12-19 00:17:44 +01:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
2020-01-17 11:30:30 +01:00
|
|
|
+ if (rpmtsOpenDB(ts, O_RDONLY))
|
2006-12-19 00:17:44 +01:00
|
|
|
+ {
|
2020-01-17 11:30:30 +01:00
|
|
|
+ perror("rpmtsOpenDB");
|
2006-12-19 00:17:44 +01:00
|
|
|
+ exit(1);
|
|
|
|
+ }
|
2020-01-17 11:30:30 +01:00
|
|
|
+ if (argc <= 1)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ {
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmdbIndexIterator ii;
|
|
|
|
+ ii = rpmdbIndexIteratorInit(rpmtsGetRdb(ts), RPMDBI_NAME);
|
|
|
|
+ if (ii)
|
2006-12-19 00:17:44 +01:00
|
|
|
+ {
|
2020-01-17 11:30:30 +01:00
|
|
|
+ const void *key = 0;
|
|
|
|
+ size_t keylen = 0;
|
|
|
|
+ while ((rpmdbIndexIteratorNext(ii, &key, &keylen)) == 0)
|
|
|
|
+ printf("%*.*s\n", (int)keylen, (int)keylen, (char *)key);
|
2006-12-19 00:17:44 +01:00
|
|
|
+ }
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmdbIndexIteratorFree(ii);
|
2006-12-19 00:17:44 +01:00
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ argc--;
|
|
|
|
+ while (argc--)
|
|
|
|
+ {
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmdbMatchIterator mi;
|
2006-12-19 00:17:44 +01:00
|
|
|
+ argv++;
|
2020-01-17 11:30:30 +01:00
|
|
|
+ mi = rpmdbInitIterator(rpmtsGetRdb(ts), RPMDBI_NAME, (void *)*argv, strlen(*argv));
|
|
|
|
+ if (mi && rpmdbGetIteratorCount(mi))
|
2006-12-19 00:17:44 +01:00
|
|
|
+ printf("%s\n", *argv);
|
2020-01-17 11:30:30 +01:00
|
|
|
+ else
|
2006-12-19 00:17:44 +01:00
|
|
|
+ ret = 1;
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmdbFreeIterator(mi);
|
|
|
|
+ }
|
2006-12-19 00:17:44 +01:00
|
|
|
+ }
|
2020-01-17 11:30:30 +01:00
|
|
|
+ rpmtsFree(ts);
|
2006-12-19 00:17:44 +01:00
|
|
|
+ return ret;
|
|
|
|
+}
|