aboutsummaryrefslogtreecommitdiffstats
path: root/rpm-find-leaves.c
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-08-05 19:04:10 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-08-05 19:04:10 +0000
commit9be8d3b3407562628b07f0b2c27b673ef208f225 (patch)
tree90b9744ee4fc8b953fc120ff38671d44c35aa35f /rpm-find-leaves.c
parenteac9649e7ca04a812481abb66c922c2345ef9207 (diff)
downloadrpmtools-9be8d3b3407562628b07f0b2c27b673ef208f225.tar
rpmtools-9be8d3b3407562628b07f0b2c27b673ef208f225.tar.gz
rpmtools-9be8d3b3407562628b07f0b2c27b673ef208f225.tar.bz2
rpmtools-9be8d3b3407562628b07f0b2c27b673ef208f225.tar.xz
rpmtools-9be8d3b3407562628b07f0b2c27b673ef208f225.zip
- remove obsolete stuff4.5.2
- move packdrake.pm in its own directory to make MakeMaker happy
Diffstat (limited to 'rpm-find-leaves.c')
-rw-r--r--rpm-find-leaves.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/rpm-find-leaves.c b/rpm-find-leaves.c
deleted file mode 100644
index 45e2e29..0000000
--- a/rpm-find-leaves.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <rpm/rpmlib.h>
-#include <rpm/header.h>
-
-static Header header;
-
-#define die(f) { perror(f); exit(1); }
-
-rpmdb open_rpmdb(void) {
- rpmdb db;
- if (rpmdbOpen("", &db, O_RDONLY, 0644)) die("rpmdbOpen");
- return db;
-}
-
-char *get(int_32 tag) {
- int_32 type, count;
- char *s;
- if (headerGetEntry(header, tag, &type, (void **) &s, &count) != 1) die("bad header ??");
- return s;
-}
-
-
-int main() {
- rpmTransactionSet trans;
- struct rpmDependencyConflict *conflicts;
- int numConflicts;
- rpmdb db;
- int i;
- rpmdbMatchIterator mi;
-
- rpmReadConfigFiles(NULL, NULL);
-
- db = open_rpmdb();
-
- while(header = rpmdbNextIterator(mi)) {
- trans = rpmtransCreateSet(db, NULL);
- i=rpmdbGetIteratorOffset(mi);
- rpmtransRemovePackage(trans, i);
- if (rpmdepCheck(trans, &conflicts, &numConflicts)) die("rpmdepCheck");
- if (numConflicts == 0) {
- printf("%s-%s-%s\n", get(RPMTAG_NAME), get(RPMTAG_VERSION), get(RPMTAG_RELEASE));
- headerFree(header);
- }
- rpmdepFreeConflicts(conflicts, numConflicts);
- rpmtransFree(trans);
- }
- exit(0);
-}