Re: [CVS] RPM: rpm/lib/ rpm4compat.h
The real problem is that include files shouldn't have AutoFu inside. I still don't know what the best thing to do is. I just got tired srestling with dbsql and splitting db out of rpm. But feel free to have at ripping WITH_DB out if ya got a better idea. 73 de Jeff On Dec 9, 2010, at 4:20 PM, Per Øyvind Karlsen wrote: RPM Package Manager, CVS Repository http://rpm5.org/cvs/ Server: rpm5.org Name: Per Øyvind Karlsen Root: /v/rpm/cvs Email: pkarl...@rpm5.org Module: rpm Date: 09-Dec-2010 22:20:38 Branch: HEAD Handle: 2010120921203800 Modified files: rpm/lib rpm4compat.h Log: add WITH_DB, required for _RPMDB_INTERNAL Summary: RevisionChanges Path 2.35+1 -0 rpm/lib/rpm4compat.h patch -p0 '@@ .' Index: rpm/lib/rpm4compat.h $ cvs diff -u -r2.34 -r2.35 rpm4compat.h --- rpm/lib/rpm4compat.h 9 Dec 2010 20:50:06 - 2.34 +++ rpm/lib/rpm4compat.h 9 Dec 2010 21:20:38 - 2.35 @@ -1,7 +1,7 @@ /* * Copyright © 2008 Per Øyvind Karlsen peroyv...@mandriva.org * - * $Id: rpm4compat.h,v 2.34 2010/12/09 20:50:06 pkarlsen Exp $ + * $Id: rpm4compat.h,v 2.35 2010/12/09 21:20:38 pkarlsen Exp $ */ #ifndef H_RPM4COMPAT @@ -42,6 +42,7 @@ #include unistd.h #include stdio.h +#define WITH_DB #define _RPMDB_INTERNAL #define _RPMTAG_INTERNAL #define _RPMEVR_INTERNAL @@ . __ RPM Package Managerhttp://rpm5.org CVS Sources Repositoryrpm-...@rpm5.org __ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org
Re: [CVS] RPM: rpm/lib/ rpm4compat.h
On Friday 18 July 2008 17.12:31 Jeff Johnson wrote: - rpm4compat: fix: rpmdsSingle() is a C, not a C++, routine. That was right before - the purpose of rpmdsSingle() in rpm4compat.h (intentionally in #ifdef __cplusplus) is a workaround for a difference between C and C++: In rpm4, rpmdsSingle was: rpmds rpmdsSingle(rpmTag tagN, const char *N, const char *EVR, int_32 Flags) in rpm5, it is: rpmds rpmdsSingle(rpmTag tagN, const char *N, const char *EVR, evrFlags Flags) In terms of C, those provide an identical API, in terms of C++, it means old code doesn't compile unless you add a cast to evrFlags for the last parameter. The purpose of the inline function in rpm4compat.h is to provide a function with the rpm4 conventions that just casts the last parameter and then calls the new function (in C++, you can have 2 functions with the same name as long as they take different parameters). The apt hang was caused by the missing #include rpm/rpmds.h I added earlier: Since the inline function didn't know about the real rpmdsSingle (because of the missing include), it just kept calling itself (a cast from an enum (such as evrFlags) to an int is automatic, while a cast from an enum to int is not). If the function knows about the real one (which it does after #include rpm/rpmds.h), it sees that the real one is a better match for what it is calling, and therefore calls that as opposed to itself -- which is the intended behavior. __ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org
Re: [CVS] RPM: rpm/lib/ rpm4compat.h
On Jul 18, 2008, at 1:30 PM, Bernhard Rosenkränzer wrote: On Friday 18 July 2008 17.12:31 Jeff Johnson wrote: - rpm4compat: fix: rpmdsSingle() is a C, not a C++, routine. That was right before - the purpose of rpmdsSingle() in rpm4compat.h (intentionally in #ifdef __cplusplus) is a workaround for a difference between C and C++: OK. But *why* should any rpm function, all of rpm is written in C, be attempting to supply a cast for use by a C++ application like apt- rpm? rpm4compat.h does not seem like the right place to attempt retrofitting a cast needed by a C++ application, supplying a prototype that can overloaded in C+ +. JMHO ... Shouldn't the cast be left to C++ applications to deal with as they wish? OTOH, I'm not at all averse to reverting rpmdsSingle() to a simpler and more maintainable prototype if necessary. I depend on C++ developers to report problems, that includes the *ahem* apt-rpm maintainer as well. (aside) And truly, there's better (because simpler) API's available these days than rpmdsSingle(). Look in rpmdb/rpmevr.h, there's a full vectorizable comparison function for the entire {E,V,R} triple that likely is easier to use than whatever rpmdsSingle() is currently being used for in apt-rpm, and more general than the hoary rpmvercmp() that rpmlib originally offered. So what is needed to fix? Delete the C++ prototype from rpm4compat.h? Revert today's change from me to restore rpmdsSingle() as before? Revert the evrFlags change in the API and just use an int? (int_32 is not part of rpm-5.x, stdint.h should be way more sensible than Yet Another Bunch of names for various integers. I don't do the C++, but am perfectly comfortable providing whatever is requested if the reasoning is suppled. Thanks for the detailed explanation however ... 73 de Jeff__ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org
Re: [CVS] RPM: rpm/lib/ rpm4compat.h
På Torsdag 06 mars 2008 , 19:11:48 skrev Jeff Johnson: Um, hard to say what you are being compatible with. Only rpm-4.4.2.2 has chosen to rename the function. Well, I renamed it for rpm-5_0 rpm-4_5 earlier. Regardless, compatibility with them all is tried at achieving.. ;p -- Regards, Per Øyvind Karlsen Mandriva Norway __ RPM Package Managerhttp://rpm5.org Developer Communication Listrpm-devel@rpm5.org