Commit 73742f0b authored by Bernhard Link's avatar Bernhard Link

add support for libdb-4.4 and libdb-4.3

parent cdc46509
2006-05-14 Bernhard R. Link <brlink@debian.org>
* add support for libdb4.3 and libdb4.4,
default is libdb4.4 now.
2006-05-13 Bernhard R. Link <brlink@debian.org>
* add support for contents file when compiled
without libarchive.
......
......@@ -12,8 +12,8 @@ ARCHIVE_USED = extractcontrol.c
ARCHIVE_UNUSED = ar.c debfile.c
endif
AM_CPPFLAGS = -D_GNU_SOURCE=1 -Wall $(ARCHIVECPP)
reprepro_LDADD = $(ARCHIVELIBS)
AM_CPPFLAGS = -D_GNU_SOURCE=1 -Wall $(ARCHIVECPP) $(DBCPPFLAGS)
reprepro_LDADD = $(ARCHIVELIBS) $(DBLIBS)
reprepro_SOURCES = guesscomponent.c files.c md5.c md5sum.c dirs.c chunks.c reference.c packages.c binaries.c sources.c names.c dpkgversions.c release.c mprintf.c updates.c strlist.c signature.c distribution.c checkindeb.c checkindsc.c checkin.c copyfile.c upgradelist.c target.c aptmethod.c downloadcache.c main.c override.c terms.c ignore.c filterlist.c exports.c tracking.c optionsfile.c readrelease.c donefile.c pull.c contents.c filelist.c $(ARCHIVE_USED)
EXTRA_reprepro_SOURCE = $(ARCHIVE_UNUSED)
......
......@@ -12,6 +12,7 @@ Updates since 0.8.2:
to some binary distribution or to binary package type.
- add support to use libarchive instead of calling ar and tar
- added Contents file generation support
- now supporting libdb-4.4, libdb-4.3 and libdb3
Updates since 0.8.1:
- mark process list files and only skip those not marked
......
......@@ -12,12 +12,67 @@ AC_PROG_CC
AC_PROG_INSTALL
AC_CHECK_LIB(z,gzopen,,[AC_MSG_ERROR(["no zlib found"])],)
AC_CHECK_LIB(db3,db_create,,[AC_MSG_ERROR(["no libdb3 found"])],)
AC_CHECK_LIB(gpgme,gpgme_check_version,,[AC_MSG_ERROR(["no libgpgme found"])],)
AC_CHECK_HEADER(gpgme.h,,[AC_MSG_ERROR(["no gpgme.h found"])])
AH_TEMPLATE([HASGPGMEGOODEXP],[Defined if libgpgme contains GPGME_SIG_STAT_GOOD_EXP])
CHECK_ENUM(GPGME_SIG_STAT_GOOD_EXP,[gpgme.h],[AC_DEFINE_UNQUOTED(AS_TR_CPP(HASGPGMEGOODEXP))],[],)
DBLIBS=""
DBCPPFLAGS=""
AH_TEMPLATE([LIBDB_VERSION],[variant of libdb used])
AC_ARG_WITH(libdb,
[ --with-libdb=path|4.4|4.3|3 Give prefix of libdb-4.4 or older version to use],[dnl
case "$withval" in
no)
AC_MSG_ERROR(["Cannot compile without libdb"]);
;;
3)
AC_CHECK_LIB(db3,db_create,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),3)
DBLIBS="-ldb3"
],[AC_MSG_ERROR(["no libdb3 found"])],)
;;
4.3)
AC_CHECK_LIB(db-4.3,db_create,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),43)
DBLIBS="-ldb-4.3"
],[AC_MSG_ERROR(["no libdb-4.3 found"])],)
;;
yes|4.4)
AC_CHECK_LIB(db-4.4,db_create,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),44)
DBLIBS="-ldb-4.4"
],[AC_MSG_ERROR(["no libdb-4.4 found"])],)
;;
*)
AC_CHECK_LIB(db-4.4,db_create,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),44)
DBLIBS="-ldb-4.4 -L$withval/lib"
DBCPPFLAGS="-I$withval/include"
],[AC_MSG_ERROR(["no libdb-4.4 found in $withval/lib"])],[-L$withval/lib])
;;
esac
],[dnl without --with-libdb-4.4 we look for first for libdb-4.4 then for libdb3
AC_CHECK_LIB(db-4.4,db_create,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),44)
DBLIBS="-ldb-4.4"
],[AC_CHECK_LIB(db-4.3,db_create,[dnl
AC_MSG_WARN([using libdb3 instead of libdb-4.3])
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),43)
DBLIBS="-ldb-4.3"
],[AC_CHECK_LIB(db3,db_create,[dnl
AC_MSG_WARN([using libdb3 instead of libdb-4.4])
AC_DEFINE_UNQUOTED(AS_TR_CPP(LIBDB_VERSION),3)
DBLIBS="-ldb3"
],[AC_MSG_ERROR(["no libdb-4.4 or libdb3 found"])],)],)],)
])
mysave_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $DBCPPFLAGS"
AC_CHECK_HEADER(db.h,,[AC_MSG_ERROR(["no db.h found"])])
CPPFLAGS="$mysave_CPPFLAGS"
AC_SUBST([DBLIBS])
AC_SUBST([DBCPPFLAGS])
AC_ARG_WITH(libbz2,
[ --with-libbz2=path|yes|no Give path to prefix libbz2 was installed with],[dnl
case "$withval" in
......@@ -49,7 +104,7 @@ AC_ARG_WITH(libarchive,
yes)
AC_CHECK_LIB(archive,archive_read_new,[dnl
AC_CHECK_HEADER(archive.h,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE))
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
ARCHIVELIBS="-larchive"
],[AC_MSG_ERROR([Could not find archive.h])])
],[AC_MSG_ERROR([Could not find libarchive])])
......@@ -59,7 +114,7 @@ AC_ARG_WITH(libarchive,
mysave_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="-I$withval/include $CPPFLAGS"
AC_CHECK_HEADER(archive.h,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE))
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
ARCHIVELIBS="-L$withval/lib -larchive"
ARCHIVECPP="-I$withval/include"
],[AC_MSG_ERROR([Could not find archive.h])])
......@@ -70,7 +125,7 @@ AC_ARG_WITH(libarchive,
],[dnl without --with-libarchive we look for it but not finding it is no error:
AC_CHECK_LIB(archive,archive_read_new,[dnl
AC_CHECK_HEADER(archive.h,[dnl
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE))
AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_LIBARCHIVE),1)
ARCHIVELIBS="-larchive"
],)
],)
......
......@@ -2,7 +2,7 @@ Source: reprepro
Section: utils
Priority: extra
Maintainer: Bernhard R. Link <brlink@debian.org>
Build-Depends: debhelper (>= 4.0.0), libgpgme-dev, libdb3-dev, libz-dev, libbz2-dev
Build-Depends: debhelper (>= 4.0.0), libgpgme-dev, libdb4.4-dev, libz-dev, libbz2-dev
Standards-Version: 3.6.2
Package: reprepro
......
......@@ -22,7 +22,7 @@ config.status: configure
dh_testdir
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --mandir=\$${prefix}/share/man \
--without-libarchive --with-libbz2 \
--without-libarchive --with-libbz2 --with-libdb=4.4 \
CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,syms"
build: build-stamp
......
......@@ -85,7 +85,8 @@ retvalue files_initialize(filesdb *fdb,const char *dbpath,const char *mirrordir)
free(db);
return RET_DBERR(dbret);
}
if ((dbret = db->database->open(db->database, filename, "md5sums", DB_BTREE, DB_CREATE, 0664)) != 0) {
dbret = DB_OPEN(db->database, filename, "md5sums", DB_BTREE,DB_CREATE);
if (dbret != 0) {
db->database->err(db->database, dbret, "%s", filename);
(void)db->database->close(db->database,0);
free(filename);
......@@ -109,8 +110,7 @@ retvalue files_initialize(filesdb *fdb,const char *dbpath,const char *mirrordir)
free(db);
return RET_DBERR(dbret);
}
dbret = db->contents->open(db->contents, filename, "filelists", DB_BTREE,
DB_CREATE, 0664);
dbret = DB_OPEN(db->contents,filename,"filelists",DB_BTREE,DB_CREATE);
if( dbret != 0 ) {
db->contents->err(db->contents, dbret, "%s", filename);
(void)db->contents->close(db->contents,0);
......
......@@ -32,5 +32,16 @@ enum config_option_owner { CONFIG_OWNER_DEFAULT=0,
CONFIG_OWNER_FILE,
CONFIG_OWNER_ENVIRONMENT,
CONFIG_OWNER_CMDLINE};
#if LIBDB_VERSION == 44
#define DB_OPEN(database,filename,name,type,flags) database->open(database,NULL,filename,name,type,flags,0664)
#elif LIBDB_VERSION == 43
#define DB_OPEN(database,filename,name,type,flags) database->open(database,NULL,filename,name,type,flags,0664)
#else
#if LIBDB_VERSION == 3
#define DB_OPEN(database,filename,name,type,flags) database->open(database,filename,name,type,flags,0664)
#else
#error Unexpected LIBDB_VERSION!
#endif
#endif
#endif
......@@ -115,7 +115,8 @@ retvalue packages_initialize(packagesdb *db,const char *dbpath,const char *ident
isopen++;
if( isopen > 1 )
fprintf(stderr,"isopen: %d\n",isopen);
if ((dbret = pkgs->database->open(pkgs->database, filename, identifier, DB_BTREE, DB_CREATE, 0664)) != 0) {
dbret = DB_OPEN(pkgs->database, filename, identifier, DB_BTREE, DB_CREATE);
if (dbret != 0) {
pkgs->database->err(pkgs->database, dbret, "%s(%s)", filename,identifier);
(void)pkgs->database->close(pkgs->database,0);
free(filename);
......
......@@ -87,7 +87,8 @@ retvalue references_initialize(references *refs,const char *dbpath) {
free(ref);
return RET_DBERR(ret);
}
if( (ret = ref->db->open(ref->db, filename, "references", DB_BTREE, DB_CREATE, 0664)) != 0) {
ret = DB_OPEN(ref->db, filename, "references", DB_BTREE, DB_CREATE);
if( ret != 0) {
ref->db->err(ref->db, ret, "db_open:%s", filename);
(void)ref->db->close(ref->db,0);
free(filename);
......
......@@ -145,8 +145,7 @@ retvalue release_init(const char *dbdir, const char *distdir, const char *codena
(void)n->cachedb->close(n->cachedb,0);
return RET_ERROR_OOM;
}
dbret = n->cachedb->open(n->cachedb,filename,codename,
DB_HASH, DB_CREATE, 0664);
dbret = DB_OPEN(n->cachedb,filename,codename, DB_HASH, DB_CREATE);
if( dbret < 0 ) {
n->cachedb->err(n->cachedb, dbret, "%s(%s)",
filename,codename);
......
......@@ -120,8 +120,8 @@ retvalue tracking_initialize(/*@out@*/trackingdb *db,const char *dbpath,const st
return RET_DBERR(dbret);
}
if ((dbret = t->db->open(t->db,filename,t->codename,
DB_BTREE,DB_CREATE,0664)) != 0 ) {
dbret = DB_OPEN(t->db,filename, t->codename, DB_BTREE, DB_CREATE);
if( dbret != 0 ) {
t->db->err(t->db, dbret, "db_open:%s:%s", filename, t->codename);
(void)t->db->close(t->db,0);
free(filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment