summaryrefslogtreecommitdiff
path: root/tools/rpmdb2solv.c
diff options
context:
space:
mode:
authorKlaus Kaempf <kkaempf@suse.de>2007-10-02 12:40:07 +0000
committerKlaus Kaempf <kkaempf@suse.de>2007-10-02 12:40:07 +0000
commit8f8a9ed5192a6737d63364029cb05d91f1d0e399 (patch)
tree287434efe18f662976f8dad334d489dd60ff6e88 /tools/rpmdb2solv.c
downloadlibsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.tar.gz
libsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.tar.bz2
libsolv-8f8a9ed5192a6737d63364029cb05d91f1d0e399.zip
current state of 'sat-solver'
Diffstat (limited to 'tools/rpmdb2solv.c')
-rw-r--r--tools/rpmdb2solv.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/tools/rpmdb2solv.c b/tools/rpmdb2solv.c
new file mode 100644
index 0000000..e4239fb
--- /dev/null
+++ b/tools/rpmdb2solv.c
@@ -0,0 +1,51 @@
+/*
+ * rpmdb2solv
+ *
+ */
+
+#include <sys/types.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "pool.h"
+#include "source_rpmdb.h"
+#include "source_solv.h"
+#include "source_write.h"
+
+int
+main(int argc, char **argv)
+{
+ Pool *pool = pool_create();
+ Source *ref = NULL;
+ FILE *fp;
+
+ if (argc != 1)
+ {
+ Pool *refpool = pool;
+ if ((fp = fopen(argv[1], "r")) == NULL)
+ {
+ perror(argv[1]);
+ exit(0);
+ }
+ ref = pool_addsource_solv(refpool, fp, "rpmdb");
+ fclose(fp);
+ }
+
+ Source *source = pool_addsource_rpmdb(pool, ref);
+ if (ref)
+ {
+ if (ref->pool != pool)
+ pool_free(ref->pool);
+ else
+ pool_freesource(pool, ref);
+ ref = NULL;
+ }
+
+ pool_writesource(pool, source, stdout);
+ pool_free(pool);
+
+ exit(0);
+}