Author: mdz
Date: 2004-05-08 19:41:01 GMT
* Build apt-ftparchive with libdb4.2 rather than libdb2
- Patch from Clint Adams to do most of the work
- Build-Depends: s/libdb2-dev/libdb4.2-dev/
- Add AC_PREREQ(2.50) to configure.in
- Use db_strerror(err) rather than GlobalError::Errno (which uses strerror)
PYTHONPREFIX = @PYTHONPREFIX@
PYTHONEXECPREFIX = @PYTHONEXECPREFIX@
PYTHONINCLUDE = @PYTHONINCLUDE@
PYTHONPREFIX = @PYTHONPREFIX@
PYTHONEXECPREFIX = @PYTHONEXECPREFIX@
PYTHONINCLUDE = @PYTHONINCLUDE@
INTLLIBS = @INTLLIBS@
# Shim Headerfile control
INTLLIBS = @INTLLIBS@
# Shim Headerfile control
dnl 'make -f Makefile startup' will generate the configure file from
dnl configure.in correctly and can be run at any time
dnl 'make -f Makefile startup' will generate the configure file from
dnl configure.in correctly and can be run at any time
AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
AC_INIT(configure.in)
AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
dnl fi
dnl AC_MSG_ERROR(failed: I need posix threads, pthread)
dnl fi
-dnl Check for DB2
-AC_CHECK_HEADER(db2/db.h,
- [AC_CHECK_LIB(db2,db_open,
- [AC_DEFINE(HAVE_DB2) DB2LIB="-ldb2"])])
-AC_SUBST(DB2LIB)
+dnl Check for BDB
+saveLIBS="$LIBS"
+LIBS="$LIBS -ldb"
+
+AC_CHECK_HEADER(db.h,
+ [AC_MSG_CHECKING(if we can link against BerkeleyDB)
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <db.h>],
+ [int r, s, t; db_version(&r, &s, &t);]
+ )],
+ [AC_DEFINE(HAVE_BDB)
+ BDBLIB="-ldb"
+ AC_MSG_RESULT(yes)],
+ [BDBLIB=""
+ AC_MSG_RESULT(no)]
+ )]
+)
+
+LIBS="$saveLIBS"
+
+AC_SUBST(BDBLIB)
dnl Converts the ARCH to be something singular for this general CPU family
dnl This is often the dpkg architecture string.
dnl Converts the ARCH to be something singular for this general CPU family
dnl This is often the dpkg architecture string.
Maintainer: APT Development Team <deity@lists.debian.org>
Uploaders: Jason Gunthorpe <jgg@debian.org>, Adam Heath <doogie@debian.org>, Matt Zimmerman <mdz@debian.org>
Standards-Version: 3.6.1
Maintainer: APT Development Team <deity@lists.debian.org>
Uploaders: Jason Gunthorpe <jgg@debian.org>, Adam Heath <doogie@debian.org>, Matt Zimmerman <mdz@debian.org>
Standards-Version: 3.6.1
-Build-Depends: debhelper (>= 4.1.62), libdb2-dev, gettext (>= 0.11.5)
+Build-Depends: debhelper (>= 4.1.62), libdb4.2-dev, gettext (>= 0.11.5)
Build-Depends-Indep: debiandoc-sgml, docbook-utils (>= 0.6.12-1)
Package: apt
Build-Depends-Indep: debiandoc-sgml, docbook-utils (>= 0.6.12-1)
Package: apt
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cachedb.cc,v 1.6 2003/02/10 07:34:41 doogie Exp $
+// $Id: cachedb.cc,v 1.7 2004/05/08 19:41:01 mdz Exp $
/* ######################################################################
CacheDB
/* ######################################################################
CacheDB
/* This opens the DB2 file for caching package information */
bool CacheDB::ReadyDB(string DB)
{
/* This opens the DB2 file for caching package information */
bool CacheDB::ReadyDB(string DB)
{
ReadOnly = _config->FindB("APT::FTPArchive::ReadOnlyDB",false);
// Close the old DB
ReadOnly = _config->FindB("APT::FTPArchive::ReadOnlyDB",false);
// Close the old DB
if (DB.empty())
return true;
if (DB.empty())
return true;
-
- if ((errno = db_open(DB.c_str(),DB_HASH,
+
+ db_create(&Dbp, NULL, 0);
+ if ((err = Dbp->open(Dbp, NULL, DB.c_str(), NULL, DB_HASH,
(ReadOnly?DB_RDONLY:DB_CREATE),
(ReadOnly?DB_RDONLY:DB_CREATE),
- Dbp = 0;
- return _error->Errno("db_open",_("Unable to open DB2 file %s"),DB.c_str());
+ if (err == DB_OLD_VERSION)
+ {
+ _error->Warning(_("DB is old, attempting to upgrade %s"),DBFile.c_str());
+ err = Dbp->upgrade(Dbp, DB.c_str(), 0);
+ if (!err)
+ err = Dbp->open(Dbp, NULL, DB.c_str(), NULL, DB_HASH,
+ (ReadOnly?DB_RDONLY:DB_CREATE), 0644);
+
+ }
+ if (err)
+ {
+ Dbp = 0;
+ return _error->Error(_("Unable to open DB file %s: %s"),DB.c_str(), db_strerror(err));
+ }
/* I'm not sure what VERSION_MINOR should be here.. 2.4.14 certainly
needs the lower one and 2.7.7 needs the upper.. */
/* I'm not sure what VERSION_MINOR should be here.. 2.4.14 certainly
needs the lower one and 2.7.7 needs the upper.. */
-#if DB_VERSION_MAJOR >= 2 && DB_VERSION_MINOR >= 7
- if ((errno = Dbp->cursor(Dbp,0,&Cursor,0)) != 0)
+ if ((errno = Dbp->cursor(Dbp, NULL, &Cursor, 0)) != 0)
return _error->Error(_("Unable to get a cursor"));
return _error->Error(_("Unable to get a cursor"));
-#else
- DBC *Cursor;
- if ((errno = Dbp->cursor(Dbp,0,&Cursor)) != 0)
- return _error->Error(_("Unable to get a cursor"));
-#endif
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: cachedb.h,v 1.3 2002/11/22 07:19:51 doogie Exp $
+// $Id: cachedb.h,v 1.4 2004/05/08 19:41:01 mdz Exp $
/* ######################################################################
CacheDB
/* ######################################################################
CacheDB
#pragma interface "cachedb.h"
#endif
#pragma interface "cachedb.h"
#endif
#include <string>
#include <apt-pkg/debfile.h>
#include <inttypes.h>
#include <string>
#include <apt-pkg/debfile.h>
#include <inttypes.h>
include ../buildlib/defaults.mak
# The apt-ftparchive program
include ../buildlib/defaults.mak
# The apt-ftparchive program
-SLIBS = -lapt-pkg -lapt-inst $(DB2LIB)
+SLIBS = -lapt-pkg -lapt-inst $(BDBLIB)
LIB_MAKES = apt-pkg/makefile apt-inst/makefile
SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \
multicompress.cc
LIB_MAKES = apt-pkg/makefile apt-inst/makefile
SOURCE = apt-ftparchive.cc cachedb.cc writer.cc contents.cc override.cc \
multicompress.cc
PROGRAM=apt-ftparchive
MESSAGE="Must have db2 to build apt-ftparchive"
include $(FAIL_H)
PROGRAM=apt-ftparchive
MESSAGE="Must have db2 to build apt-ftparchive"
include $(FAIL_H)