Hi, the attached patch makes current git apt-rpm build with rpm5 again, and shouldn't have any bad side effects.
It doesn't work 100% though: It fails to resolve file dependencies (e.g. it complains about "xauth: Depends: /bin/sh but it is not installable" when rpm --whatprovides /bin/sh knows it's bash-4.0-0.rc1.1ark). Any ideas about that one? ttyl bero
--- apt/apt-pkg/rpm/aptcallback.cc.ark 2009-01-28 08:47:08.381260782 +0100 +++ apt/apt-pkg/rpm/aptcallback.cc 2009-01-28 08:48:26.161153245 +0100 @@ -1,6 +1,13 @@ #include <map> #include <sstream> +#include <config.h> +#include <cstdlib> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <dirent.h> +#include <rpm/rpmtag.h> +#endif #include <apti18n.h> #include <apt-pkg/progress.h> --- apt/apt-pkg/rpm/raptheader.cc.ark 2009-01-28 08:39:39.296134841 +0100 +++ apt/apt-pkg/rpm/raptheader.cc 2009-01-28 08:42:56.331885802 +0100 @@ -117,8 +117,8 @@ bool raptHeader::getTag(raptTag tag, vec return ret; } #else -#if RPM_VERSION >= 0x040000 -// No prototype from rpm after 4.0. +#if RPM_VERSION >= 0x040000 && RPM_VERSION < 0x050000 +// No prototype from rpm 4.x after 4.0. extern "C" { int headerGetRawEntry(Header h, raptTag tag, raptTagType * type, raptTagData p, raptTagCount *c); @@ -133,7 +133,11 @@ bool raptHeader::getTag(raptTag tag, vec raptTagCount count = 0; raptTagType type = RPM_NULL_TYPE; if (tag == RPMTAG_OLDFILENAMES) { +#ifndef HAVE_RPM_RPM4COMPAT_H rc = rpmHeaderGetEntry(Hdr, tag, &type, (void **) &val, &count); +#else + rc = headerGetEntry(Hdr, tag, &type, (void **) &val, &count); +#endif } else if (raw) { rc = headerGetRawEntry(Hdr, tag, &type, (void **) &val, &count); } else { --- apt/apt-pkg/rpm/raptheader.h.ark 2009-01-27 22:12:53.131137238 +0100 +++ apt/apt-pkg/rpm/raptheader.h 2009-01-27 22:35:11.182884829 +0100 @@ -9,8 +9,13 @@ #ifndef HAVE_RPM_RPMTAG_H #include <rpm/rpmlib.h> #else -#include <rpm/header.h> #include <rpm/rpmtag.h> +#ifdef HAVE_RPM_HEADER_H +#include <rpm/header.h> +#elif defined(HAVE_RPM_RPM4COMPAT_H) +#include <rpm/rpm4compat.h> +#include <rpm/rpmiotypes.h> +#endif #endif using std::vector; --- apt/apt-pkg/rpm/rapttypes.h.ark 2009-01-27 22:38:27.881015869 +0100 +++ apt/apt-pkg/rpm/rapttypes.h 2009-01-28 08:58:37.773256965 +0100 @@ -6,8 +6,15 @@ * C happily converts enum to int etc automatically, C++ doesn't... */ +#ifdef HAVE_RPM_RPMIOTYPES_H +#include <stdlib.h> +#include <rpm/rpmiotypes.h> +#include <rpm/rpmtag.h> +#endif #ifdef HAVE_RPM_RPMTYPES_H #include <rpm/rpmtypes.h> +#endif +#ifndef HAVE_RPM_RPM4COMPAT_H #include <rpm/rpmds.h> typedef rpm_data_t raptTagData; typedef rpm_count_t raptTagCount; @@ -19,7 +26,7 @@ typedef rpm_loff_t raptCallbackSize; typedef uint32_t raptInt; typedef uint32_t raptDbOffset; #define RAPT_FILENAMES RPMTAG_FILENAMES -#else +#elif defined(HAVE_RPM_HEADER_H) #include <rpm/header.h> typedef void * raptTagData; typedef int_32 raptTagCount; @@ -31,6 +38,17 @@ typedef long unsigned int raptCallbackSi typedef int_32 raptInt; typedef uint_32 raptDbOffset; #define RAPT_FILENAMES RPMTAG_OLDFILENAMES +#else +typedef void * raptTagData; +typedef rpmuint32_t raptTagCount; +typedef rpmTag raptTag; +typedef rpmuint32_t raptTagType; +typedef rpmint32_t raptDepFlags; +typedef rpmint32_t raptOffset; +typedef rpmuint64_t raptCallbackSize; +typedef rpmint32_t raptInt; +typedef rpmuint32_t raptDbOffset; +#define RAPT_FILENAMES RPMTAG_OLDFILENAMES #endif #if RPM_VERSION >= 0x040100 --- apt/apt-pkg/rpm/rpmhandler.cc.ark 2009-01-28 08:48:41.396884945 +0100 +++ apt/apt-pkg/rpm/rpmhandler.cc 2009-01-28 08:50:27.505027639 +0100 @@ -440,7 +440,13 @@ RPMFileHandler::RPMFileHandler(string Fi { _error->Error(_("could not open RPM package list file %s: %s"), - File.c_str(), rpmErrorString()); + File.c_str(), +#ifdef HAVE_RPM_RPM4COMPAT_H + rpmlogMessage() +#else + rpmErrorString() +#endif + ); _error->Error(_("... do you need to run \"apt-get update\" first?")); return; } --- apt/apt-pkg/rpm/rpmhandler.h.ark 2009-01-28 08:44:47.766259671 +0100 +++ apt/apt-pkg/rpm/rpmhandler.h 2009-01-28 08:46:35.138075511 +0100 @@ -21,7 +21,12 @@ #include "sqlite.h" #endif +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpmio.h> +#include <rpm/rpmtag.h> +#endif #include <rpm/rpmmacro.h> #include "rapttypes.h" --- apt/apt-pkg/rpm/rpmpackagedata.cc.ark 2009-01-28 08:51:40.667135806 +0100 +++ apt/apt-pkg/rpm/rpmpackagedata.cc 2009-01-28 08:52:16.487984426 +0100 @@ -12,7 +12,11 @@ #include <apti18n.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpm4compat.h> +#endif RPMPackageData::RPMPackageData() : --- apt/apt-pkg/rpm/rpmpm.h.ark 2009-01-28 08:53:24.890887452 +0100 +++ apt/apt-pkg/rpm/rpmpm.h 2009-01-28 08:53:45.823204225 +0100 @@ -11,7 +11,12 @@ #ifndef PKGLIB_rpmPM_H #define PKGLIB_rpmPM_H +#include <config.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpm4compat.h> +#endif #if RPM_VERSION >= 0x040100 #include <rpm/rpmts.h> #endif --- apt/apt-pkg/rpm/rpmsystem.cc.ark 2009-01-28 08:59:56.368259894 +0100 +++ apt/apt-pkg/rpm/rpmsystem.cc 2009-01-28 09:00:11.405134971 +0100 @@ -34,7 +34,11 @@ #include <stdlib.h> #include <dirent.h> #include <fcntl.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpmtag.h> +#endif #include <assert.h> #include <time.h> /*}}}*/ --- apt/apt-pkg/rpm/rpmversion.cc.ark 2009-01-28 09:00:26.231890627 +0100 +++ apt/apt-pkg/rpm/rpmversion.cc 2009-01-28 09:02:46.322017500 +0100 @@ -20,11 +20,16 @@ #define _RPMEVR_INTERNAL #endif +#include <cstdio> #include "rapttypes.h" #include "rpmversion.h" #include <apt-pkg/pkgcache.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpm4compat.h> +#endif #include <stdlib.h> #include <assert.h> --- apt/configure.ac.ark 2009-01-27 22:08:15.730009892 +0100 +++ apt/configure.ac 2009-01-27 22:39:21.109042970 +0100 @@ -64,7 +64,7 @@ PKG_CHECK_MODULES([RPM], [rpm], [ AC_MSG_CHECKING(for RPM version) RPM_VERSION_MAJOR= -RPM_VERSION_MINOR= +RPM_VERSION_MINOR= RPM_VERSION_MICRO= if test -z "" -o -z ""; then AC_MSG_ERROR([can't parse RPM version]) @@ -101,9 +101,10 @@ fi dnl Various rpm header checks.. AC_CHECK_HEADER(rpm/rpmlib.h, [], - [AC_MSG_ERROR([Can't find rpmlib.h])]) -AC_CHECK_HEADERS([rpm/rpmsx.h rpm/rpmcallback.h rpm/rpmcb.h - rpm/rpmmessages.h rpm/rpmevr.h rpm/rpmtypes.h rpm/rpmtd.h]) + [AC_CHECK_HEADER(rpm/rpm4compat.h, [], + [AC_MSG_ERROR([Can't find rpmlib.h or rpm4compat.h])])]) +AC_CHECK_HEADERS([rpm/rpmlib.h rpm/rpm4compat.h rpm/rpmsx.h rpm/rpmcallback.h rpm/rpmcb.h + rpm/rpmtag.h rpm/rpmiotypes.h rpm/rpmmessages.h rpm/rpmevr.h rpm/rpmtypes.h rpm/rpmtd.h]) dnl Various rpm variant capability checks AC_MSG_CHECKING(for headerFormat) --- apt/tools/cached_md5.cc.ark 2009-02-09 13:01:53.035624412 +0100 +++ apt/tools/cached_md5.cc 2009-02-09 13:03:06.952927343 +0100 @@ -6,9 +6,16 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> -#include <rpm/rpmlib.h> #include <stdlib.h> #include <string.h> +#include <config.h> +#ifdef HAVE_RPM_RPMLIB_H +#include <rpm/rpmlib.h> +#else +#include <cstdio> +#include <rpm/rpmtag.h> +#include <rpm/rpm4compat.h> +#endif #include <sys/stat.h> #include <unistd.h> #include <assert.h> --- apt/tools/countpkglist.cc.ark 2009-02-09 13:05:16.946243446 +0100 +++ apt/tools/countpkglist.cc 2009-02-09 13:05:57.564243704 +0100 @@ -1,8 +1,13 @@ #include <stdio.h> #include <errno.h> #include <string.h> +#include <config.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <rpm/rpm4compat.h> +#endif int main(int argc, char *argv[]) { --- apt/tools/genpkglist.cc.ark 2009-02-09 12:57:14.777368706 +0100 +++ apt/tools/genpkglist.cc 2009-02-09 13:01:05.858829835 +0100 @@ -6,7 +6,15 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <config.h> +#ifdef HAVE_RPM_RPMLIB_H #include <rpm/rpmlib.h> +#else +#include <cstdlib> +#include <cstdio> +#include <rpm/rpmtag.h> +#include <rpm/rpm4compat.h> +#endif #include <stdlib.h> #include <string.h> #include <sys/stat.h> @@ -215,12 +223,14 @@ bool loadUpdateInfo(char *path, map<stri } #if RPM_VERSION >= 0x040000 -// No prototype from rpm after 4.0. +// No prototype from rpm4 after 4.0. +#ifndef HAVE_RPM_RPM4COMPAT_H extern "C" { int headerGetRawEntry(Header h, raptTag tag, raptTagType * type, raptTagData p, raptTagCount *c); } #endif +#endif bool copyFields(Header h, Header newHeader, FILE *idxfile, const char *directory, char *filename, --- apt/tools/gensrclist.cc.ark 2009-02-09 13:03:24.453618086 +0100 +++ apt/tools/gensrclist.cc 2009-02-09 13:04:59.445243572 +0100 @@ -6,8 +6,15 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> -#include <rpm/rpmlib.h> #include <stdlib.h> +#include <config.h> +#ifdef HAVE_RPM_RPMLIB_H +#include <rpm/rpmlib.h> +#else +#include <cstdio> +#include <rpm/rpmtag.h> +#include <rpm/rpm4compat.h> +#endif #include <string.h> #include <sys/stat.h> #include <sys/types.h> @@ -109,9 +116,9 @@ void usage() cerr << " --cachedir=DIR use a custom directory for package md5sum cache"<<endl; } -#if RPM_VERSION >= 0x040000 +#if RPM_VERSION >= 0x040000 && !defined(HAVE_RPM_RPM4COMPAT_H) extern "C" { -// No prototype from rpm after 4.0. +// No prototype from rpm4 after 4.0. int headerGetRawEntry(Header h, raptTag tag, raptTagType * type, raptTagData p, raptTagCount *c); }