summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2000-03-26 22:45:02 +0000
committerjbj <devnull@localhost>2000-03-26 22:45:02 +0000
commit22a911a3b36c9cde5159e0343632246ba9fa007c (patch)
treedb7180d7fcca97a838fd246f2de2a332062ad895 /lib
parentc47d8f3f6311435f60402a6230429a89bb7e23a4 (diff)
downloadrpm-22a911a3b36c9cde5159e0343632246ba9fa007c.tar.gz
rpm-22a911a3b36c9cde5159e0343632246ba9fa007c.tar.bz2
rpm-22a911a3b36c9cde5159e0343632246ba9fa007c.zip
Add --preferdb for now to permit testing db0/db1/db2.
CVS patchset: 3641 CVS date: 2000/03/26 22:45:02
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.am46
-rw-r--r--lib/dbindex.c8
-rw-r--r--lib/rebuilddb.c12
-rw-r--r--lib/rpmlib.h3
4 files changed, 23 insertions, 46 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ee21c3ee7..b0f2ed639 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -29,42 +29,16 @@ librpm_la_SOURCES = \
librpm_la_LIBADD = $(subst .c,.lo,$(DBLIBOBJS))
#librpm_la_LIBADD = -lpopt
-Xdb0.o: db0.c
- @echo '$(COMPILE) -c $<'; \
- $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
- @-cp .deps/$(*F).pp .deps/$(*F).P; \
- tr ' ' '\012' < .deps/$(*F).pp \
- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
- >> .deps/$(*F).P; \
- rm .deps/$(*F).pp
- @__LD@ -r -o $@.o $@ -L/usr/lib -ldb1
- @__OBJCOPY@ `\
- @__NM@ -g --defined-only $@.o | \
- sed -e '/ [TWD] /!d' -e 's/.* [TWD] /-L /' | \
- grep -v '^-L $*'` $@.o $@
- rm -f $@.o
-
-db0.lo: db0.c
- @echo '$(LTCOMPILE) -c $<'; \
- $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $<
- @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \
- < .deps/$(*F).pp > .deps/$(*F).P; \
- tr ' ' '\012' < .deps/$(*F).pp \
- | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \
- >> .deps/$(*F).P; \
- rm -f .deps/$(*F).pp
- @__LD@ -r -o $*.o.o $*.o -L/usr/lib -ldb1
- @__OBJCOPY@ `\
- @__NM@ -g --defined-only $*.o.o | \
- sed -e '/ [TWD] /!d' -e 's/.* [TWD] /-L /' | \
- grep -v '^-L $*'` $*.o.o $*.o
- rm -f $*.o.o
- @__LD@ -r -o $@.o $@ -L/usr/lib -ldb1
- @__OBJCOPY@ `\
- @__NM@ -g --defined-only $@.o | \
- sed -e '/ [TWD] /!d' -e 's/.* [TWD] /-L /' | \
- grep -v '^-L $*'` $@.o $@
- rm -f $@.o
+db0.lo: db0.c $(top_srcdir)/system.h rpmlib.h dbindex.h db0.h
+ $(LIBTOOL) --mode=compile $(COMPILE) -c $<
+ for F in $*.o $*.lo ; do \
+ @__LD@ -r -o $${F}.o $${F} -L/usr/lib -ldb1 ; \
+ @__OBJCOPY@ `\
+ @__NM@ -g --defined-only $${F}.o | \
+ sed -e '/ [TWD] /!d' -e 's/.* [TWD] /-L /' | \
+ grep -v '^-L $*'` $${F}.o $${F} ; \
+ rm -f $${F}.o ; \
+ done
tagtable.c: rpmlib.h
@echo '#include "system.h"' > tagtable.c
diff --git a/lib/dbindex.c b/lib/dbindex.c
index 843005416..19ef3b346 100644
--- a/lib/dbindex.c
+++ b/lib/dbindex.c
@@ -55,8 +55,8 @@ static void freeDBI( /*@only@*/ /*@null@*/ dbiIndex dbi) {
}
}
-int prefer_dbi_major = 2; /* XXX shared with rebuilddb.c */
-int use_dbi_major = -1;
+int _preferDbiMajor = 0; /* XXX shared with rebuilddb.c */
+int _useDbiMajor = -1;
typedef int (*_dbopen) (dbiIndex dbi);
@@ -93,7 +93,7 @@ dbiIndex dbiOpenIndex(const char * urlfn, int flags, int perms, DBI_TYPE type) {
dbi->dbi_perms = perms;
dbi->dbi_type = type;
dbi->dbi_openinfo = NULL;
- dbi->dbi_major = use_dbi_major;
+ dbi->dbi_major = _useDbiMajor;
switch (dbi->dbi_major) {
case 3:
@@ -126,7 +126,7 @@ fprintf(stderr, "*** loop db%d rc %d errno %d %s\n", dbi->dbi_major, rc, errno,
dbi->dbi_major--; /* XXX don't bother with db_185 */
}
}
- use_dbi_major = dbi->dbi_major;
+ _useDbiMajor = dbi->dbi_major;
break;
}
diff --git a/lib/rebuilddb.c b/lib/rebuilddb.c
index de646bbe8..89479e9f5 100644
--- a/lib/rebuilddb.c
+++ b/lib/rebuilddb.c
@@ -5,8 +5,8 @@
#include "rpmdb.h"
-extern int prefer_dbi_major; /* XXX shared with rebuilddb.c */
-extern int use_dbi_major;
+extern int _preferDbiMajor; /* XXX shared with rebuilddb.c */
+extern int _useDbiMajor;
/** */
int rpmdbRebuild(const char * rootdir)
@@ -69,18 +69,18 @@ int rpmdbRebuild(const char * rootdir)
goto exit;
}
- use_dbi_major = prefer_dbi_major;
+ _useDbiMajor = ((_preferDbiMajor >= 0) ? (_preferDbiMajor & 0x03) : -1);
rpmMessage(RPMMESS_DEBUG, _("opening old database with dbi_major %d\n"),
- use_dbi_major);
+ _useDbiMajor);
if (openDatabase(rootdir, dbpath, &olddb, O_RDONLY, 0644,
RPMDB_FLAG_MINIMAL)) {
rc = 1;
goto exit;
}
- use_dbi_major = prefer_dbi_major;
+ _useDbiMajor = ((_preferDbiMajor >= 0) ? (_preferDbiMajor & 0x03) : -1);
rpmMessage(RPMMESS_DEBUG, _("opening new database with dbi_major %d\n"),
- use_dbi_major);
+ _useDbiMajor);
if (openDatabase(rootdir, newdbpath, &newdb, O_RDWR | O_CREAT, 0644, 0)) {
rc = 1;
goto exit;
diff --git a/lib/rpmlib.h b/lib/rpmlib.h
index 8d3d51e8d..f70abded2 100644
--- a/lib/rpmlib.h
+++ b/lib/rpmlib.h
@@ -26,6 +26,9 @@ extern "C" {
*/
void dbiFreeIndexSet(/*@only@*/ /*@null@*/ dbiIndexSet set);
+/* XXX API compatibility */
+#define dbiFreeIndexRecord(_a) dbiFreeIndexSet(_a)
+
/**
* Count items in index database set.
* @param set set of index database items