Apt-rpm and rpm5 once more

2009-02-09 Thread Bernhard Rosenkränzer
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 = 0x04
-// No prototype from rpm after 4.0.
+#if RPM_VERSION = 0x04  RPM_VERSION  0x05
+// 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

Re: Apt-rpm and rpm5 once more

2009-02-09 Thread Jeff Johnson


On Feb 9, 2009, at 8:30 AM, Bernhard Rosenkränzer wrote:


Hi,
the attached patch makes current git apt-rpm build with
rpm5 again, and shouldn't have any bad side effects.



Thanks. This is the 1st application check against HEAD
(which has a rather large API rearrangement a la rpmiotypes.h)
that I've seen. The effects of the rearrangement appear minor. Good.

And I'm sure the patch can be reduced somewhat as well,
burying rpmiotypes.h and rpmtag.h within rpm4compaat.h.

At some poing rewriting to use HE_t and headerGet() needs to
be undertaken, but since there are two incompatible headerGet()
methos rpm.,org - rpm5.org, I'll leave it to Panu to make the
1st move.


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?



The equivalent of rpm -vv (within apt-rpm) should show
where dependencies are resolved precisely and start
to pin down a reproducer for the problem.

There's also --rpmdsdebug, but that's probably less useful
for diagnosing a specific dependency failure.

73 de Jeff

smime.p7s
Description: S/MIME cryptographic signature