APT-RPM and rpm 4.5?

Panu Matilainen pmatilai at laiskiainen.org
Mon May 28 13:47:46 PDT 2007


On Mon, 28 May 2007, Panu Matilainen wrote:

> On Sun, 27 May 2007, Gary L. Greene, Jr. wrote:
>
>> I'm interested in getting apt-rpm working with rpm 4.5. Have there been any
>> attempts at getting the code working against it?
>
> No by me at least, I don't usually look at new (jbj's) rpm releases until
> somebody reports a problem building/using apt with one :)
>
>> From the wording, I take it you tried it and it failed... any specifics
> what kind of problems you encountered?

Uh, I see.

The attached quick and dirty patch makes the current apt-rpm git head 
kinda build against rpm-4.5-0.3, once you patch rpm a bit to make g++ 
accept rpmevr.h (second attached patch).

Whether it actually works with these kludges... I'd be more than a little 
surprised if it does, considering the amount and type of changes that 
went into rpm 4.4.9.

 	- Panu -
-------------- next part --------------
diff --git a/apt-pkg/rpm/rpmhandler.cc b/apt-pkg/rpm/rpmhandler.cc
index 803eceb..a160a2c 100644
--- a/apt-pkg/rpm/rpmhandler.cc
+++ b/apt-pkg/rpm/rpmhandler.cc
@@ -38,6 +38,10 @@
 
 #include <apti18n.h>
 
+#if RPM_VERSION >= 0x040500
+#define _RPMEVR_INTERNAL
+#endif
+
 #if RPM_VERSION >= 0x040100
 #include <rpm/rpmts.h>
 #include <rpm/rpmdb.h>
@@ -310,7 +314,7 @@ bool RPMHdrHandler::PRCO(unsigned int Type, vector<Dependency*> &Deps)
 	 break;
 #if RPM_VERSION >= 0x040403
       case pkgCache::Dep::Suggests:
-	 deptype = RPMTAG_SUGGESTNAME;
+	 deptype = RPMTAG_SUGGESTSNAME;
 	 break;
 #if 0 // Enhances dep type is not even known to apt, sigh..
       case pkgCache::Dep::Enhances:
diff --git a/apt-pkg/rpm/rpmpm.cc b/apt-pkg/rpm/rpmpm.cc
index f7ab343..86aaf97 100644
--- a/apt-pkg/rpm/rpmpm.cc
+++ b/apt-pkg/rpm/rpmpm.cc
@@ -34,6 +34,11 @@
 #include <stdio.h>
 #include <iostream>
 
+#if RPM_VERSION >= 0x040500
+#define _RPMPS_INTERNAL
+#include <rpm/rpmps.h>
+#endif
+
 #if RPM_VERSION >= 0x040100
 #include <rpm/rpmdb.h>
 #else
@@ -850,7 +855,11 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
    if (_config->FindB("RPM::NoDeps", false) == false) {
       rc = rpmtsCheck(TS);
       probs = rpmtsProblems(TS);
+#if RPM_VERSION >= 0x040500
+      if (rc || rpmpsNumProblems(probs)) {
+#else
       if (rc || probs->numProblems > 0) {
+#endif
 	 rpmpsPrint(NULL, probs);
 	 rpmpsFree(probs);
 	 _error->Error(_("Transaction set check failed"));
@@ -906,7 +915,11 @@ bool pkgRPMLibPM::Process(vector<const char*> &install,
 
    if (rc > 0) {
       _error->Error(_("Error while running transaction"));
+#if RPM_VERSION >= 0x040500
+      if (rpmpsNumProblems(probs) > 0) 
+#else
       if (probs->numProblems > 0)
+#endif
 	 rpmpsPrint(stderr, probs);
    } else {
       Success = true;
@@ -952,8 +965,10 @@ bool pkgRPMLibPM::ParseRpmOpts(const char *Cnf, int *tsFlags, int *probFilter)
 	 else if (Opts->Value == "--test")
 	    *tsFlags |= RPMTRANS_FLAG_TEST;
 #if RPM_VERSION >= 0x040000
+#if RPM_VERSION < 0x040500
 	 else if (Opts->Value == "--nomd5")
 	    *tsFlags |= RPMTRANS_FLAG_NOMD5;
+#endif
 	 else if (Opts->Value == "--repackage")
 	    *tsFlags |= RPMTRANS_FLAG_REPACKAGE;
 #endif
diff --git a/apt-pkg/rpm/rpmversion.cc b/apt-pkg/rpm/rpmversion.cc
index 9338d41..d79a1b9 100644
--- a/apt-pkg/rpm/rpmversion.cc
+++ b/apt-pkg/rpm/rpmversion.cc
@@ -22,6 +22,10 @@
 #include <apt-pkg/rpmversion.h>
 #include <apt-pkg/pkgcache.h>
 
+#if RPM_VERSION >= 0x040500
+#define _RPMEVR_INTERNAL
+#endif
+
 #include <rpm/rpmlib.h>
 #include <rpm/misc.h>
 
-------------- next part --------------
--- rpm-4.5/lib/rpmevr.h.orig	2007-05-28 23:40:52.000000000 +0300
+++ rpm-4.5/lib/rpmevr.h	2007-05-28 23:41:35.000000000 +0300
@@ -18,8 +18,6 @@
 /**
  * Dependency Attributes.
  */
-typedef	enum evrFlags_e rpmsenseFlags;
-typedef	enum evrFlags_e evrFlags;
 
 /*@-matchfields@*/
 enum evrFlags_e {
@@ -67,6 +65,9 @@
 };
 /*@=matchfields@*/
 
+typedef	enum evrFlags_e rpmsenseFlags;
+typedef	enum evrFlags_e evrFlags;
+
 #define	RPMSENSE_SENSEMASK	0x0e	 /* Mask to get senses, ie serial, */
                                          /* less, greater, equal.          */
 #define	RPMSENSE_NOTEQUAL	(RPMSENSE_EQUAL ^ RPMSENSE_SENSEMASK)


More information about the Apt-Rpm mailing list