sat-solver: Fix solution DB generation and general cleanup

Uprev sat-solver to the latest git version.  This corrects the solv db
generation with RPM5.

Refactor the patches for RPM5 support, cleaning up components of the
cmake.patch for submission upstream.  (Also fix a problem remaining
in the upstream with a mismatched function name.)

(From OE-Core rev: 89a5ad96eef411dccea817a6c37cb1e24840fdc1)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mark Hatle 2011-03-16 17:15:09 -05:00 committed by Richard Purdie
parent 129c624333
commit 275241ea68
6 changed files with 78 additions and 139 deletions

View File

@ -165,7 +165,7 @@ SRCREV_pn-qemu-nativesdk ??= "${QEMUSRCREV}"
SRCREV_pn-qemu ??= "${QEMUSRCREV}"
SRCREV_pn-qemugl ??= "d888bbc723c00d197d34a39b5b7448660ec1b1c0"
SRCREV_pn-qemugl-nativesdk ??= "d888bbc723c00d197d34a39b5b7448660ec1b1c0"
SRCREV_pn-sat-solver = "20212ccd92c6b3a5a93a83da5d7d60e9c305e75c"
SRCREV_pn-sat-solver = "0a7378d5f482f477a01cf1690d76871ab8bdcc32"
SRCREV_pn-screenshot ??= "292"
SRCREV_pn-settings-daemon ??= "0f174f463dfed500b65533e249cd22942e439c77"
SRCREV_pn-swabber-native ??= "a0792390c5d6d5a5bade7ab155c80eef3f30fa52"

View File

@ -1,59 +1,15 @@
check rpm
Enable debugging for all builds
not building docs (need oxygen)
8/19/2010 - created by Qing He <qing.he@intel.com>
1/24/2011 - Disable Fedora/Debian checking/settings by Mark Hatle <mark.hatle@windriver.com>
3/15/2011 - Updated to newer version of sat-solver by Mark Hatle <mark.hatle@windriver.com>
3/16/2011 - Split original patch and simplify by Mark Hatle <mark.hatle@windriver.com>
diff -ur git.orig/CMakeLists.txt git/CMakeLists.txt
--- git.orig/CMakeLists.txt 2011-03-15 17:14:22.000000000 -0500
+++ git/CMakeLists.txt 2011-03-15 17:20:09.648880770 -0500
@@ -35,22 +35,15 @@
FIND_PACKAGE(Check REQUIRED)
FIND_PACKAGE(ZLIB REQUIRED)
-IF ( FEDORA )
-MESSAGE(STATUS "Building for Fedora")
-ADD_DEFINITIONS( -DFEDORA )
-ENDIF ( FEDORA)
-
-IF ( DEBIAN )
-MESSAGE(STATUS "Building for Debian")
-ADD_DEFINITIONS( -DDEBIAN -DDEBIAN_SEMANTICS)
-ENDIF ( DEBIAN )
-
IF ( MULTI_SEMANTICS )
MESSAGE(STATUS "Enabling multi dist support")
ADD_DEFINITIONS( -DMULTI_SEMANTICS)
ENDIF ( MULTI_SEMANTICS )
-IF ( NOT DEBIAN )
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(RPM REQUIRED rpm)
+INCLUDE_DIRECTORIES( ${RPM_INCLUDE_DIRS} )
+
FIND_LIBRARY(RPMDB_LIBRARY NAMES rpmdb)
IF ( NOT RPMDB_LIBRARY )
FIND_LIBRARY(RPMDB_LIBRARY NAMES rpm)
@@ -59,13 +52,14 @@
IF ( RPMIO_LIBRARY )
SET( RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY} )
ENDIF ( RPMIO_LIBRARY )
-IF ( FEDORA )
+FIND_LIBRARY(RPMMISC_LIBRARY NAMES rpmmisc)
+IF ( RPMMISC_LIBRARY )
+SET( RPMDB_LIBRARY ${RPMMISC_LIBRARY} ${RPMDB_LIBRARY} )
+ENDIF ( RPMMISC_LIBRARY )
FIND_LIBRARY(DB_LIBRARY NAMES db)
IF ( DB_LIBRARY )
SET( RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY} )
ENDIF ( DB_LIBRARY )
-ENDIF ( FEDORA )
-ENDIF ( NOT DEBIAN )
INCLUDE ( CheckFunctionExists )
INCLUDE ( TestBigEndian )
@@ -164,7 +158,7 @@
diff -ur git.orig2/CMakeLists.txt git/CMakeLists.txt
--- git.orig2/CMakeLists.txt 2011-03-16 16:29:43.532032285 -0500
+++ git/CMakeLists.txt 2011-03-16 16:32:59.982034501 -0500
@@ -177,7 +177,7 @@
MESSAGE(STATUS "Looking modules in ${CMAKE_MODULE_PATH}")
@ -62,7 +18,7 @@ diff -ur git.orig/CMakeLists.txt git/CMakeLists.txt
set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -g -O3" )
set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g3 -O0" )
@@ -173,7 +167,7 @@
@@ -186,7 +186,7 @@
ADD_SUBDIRECTORY(tools)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(examples)

View File

@ -1,30 +0,0 @@
sat-solver rpmdb based solv database construction
The first time the database is created on an RPM5 system it works
correctly. However any subsequent rebuilds cause an empty database to
occur.
The following is from Michael Schroeder <mls@suse.de>:
> rpmdb2solv contains a hack that makes it use the unchanged already
> converted packages. To do this, it needs to get the database id
> for every installed packages by reading the "Name" index. This
> somehow doesn't seem to work with rpm5.
>
> As a workaround you can add a "ref = 0;" line at the top of the
> repo_add_rpmdb() function in ext/repo_rpmdb.c.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
diff -ur git.orig/ext/repo_rpmdb.c git/ext/repo_rpmdb.c
--- git.orig/ext/repo_rpmdb.c 2011-03-16 09:43:50.470008215 -0500
+++ git/ext/repo_rpmdb.c 2011-03-16 09:47:55.503989694 -0500
@@ -1344,6 +1344,9 @@
memset(&dbkey, 0, sizeof(dbkey));
memset(&dbdata, 0, sizeof(dbdata));
+ /* Workaround for RPM 5 database construction */
+ ref = 0;
+
if (!rootdir)
rootdir = "";

View File

@ -1,53 +0,0 @@
fix rpm5 build
8/19/2010 - created by Qing He <qing.he@intel.com>
pgpDigNew/pgpDigFree has changed in RPM 5.4.0
Signed-off-by: Qing He <qing.he@intel.com>
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
index 34f2b65..3c6ab9a 100644
--- a/ext/repo_rpmdb.c
+++ b/ext/repo_rpmdb.c
@@ -21,10 +21,11 @@
#include <string.h>
#include <unistd.h>
#include <assert.h>
+#include <stdint.h>
#include <rpm/rpmio.h>
#include <rpm/rpmpgp.h>
-#include <rpm/header.h>
+//#include <rpm/header.h>
#include <rpm/rpmdb.h>
#ifndef DB_CREATE
@@ -2466,7 +2467,7 @@ rpm_byrpmh(Header h, void **statep)
int sigdsize, sigcnt, l;
RpmHead *rpmhead;
- uh = headerUnload(h);
+ uh = headerUnload(h, NULL);
if (!uh)
return 0;
sigcnt = getu32(uh);
@@ -2982,7 +2983,7 @@ pubkey2solvable(Solvable *s, Repodata *data, char *pubkey)
parsekeydata(s, data, pkts, pktsl);
/* only rpm knows how to do the release calculation, we don't dare
* to recreate all the bugs */
- dig = pgpNewDig();
+ dig = pgpDigNew(RPMVSF_DEFAULT, 0);
(void) pgpPrtPkts(pkts, pktsl, dig, 0);
btime = dig->pubkey.time[0] << 24 | dig->pubkey.time[1] << 16 | dig->pubkey.time[2] << 8 | dig->pubkey.signid[3];
sprintf(evrbuf, "%02x%02x%02x%02x-%02x%02x%02x%02x", dig->pubkey.signid[4], dig->pubkey.signid[5], dig->pubkey.signid[6], dig->pubkey.signid[7], dig->pubkey.time[0], dig->pubkey.time[1], dig->pubkey.time[2], dig->pubkey.time[3]);
@@ -2996,7 +2997,7 @@ pubkey2solvable(Solvable *s, Repodata *data, char *pubkey)
repodata_set_str(data, s - s->repo->pool->solvables, PUBKEY_KEYID, keyid);
if (dig->pubkey.userid)
setutf8string(data, s - s->repo->pool->solvables, SOLVABLE_SUMMARY, dig->pubkey.userid);
- pgpFreeDig(dig);
+ (void) pgpDigFree(dig);
sat_free((void *)pkts);
return 1;
}

View File

@ -0,0 +1,67 @@
Add RPM5 configuration support
Update the cmake configuration to detect additional files needed by RPM5.
Original work by Qing He <qing.he@intel.com>.
Merged and updated to make this more likely to be accepted upstream.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
diff -ur git.orig/CMakeLists.txt git/CMakeLists.txt
--- git.orig/CMakeLists.txt 2011-03-16 16:16:29.152786178 -0500
+++ git/CMakeLists.txt 2011-03-16 16:29:43.532032285 -0500
@@ -50,7 +50,16 @@
ADD_DEFINITIONS( -DMULTI_SEMANTICS)
ENDIF ( MULTI_SEMANTICS )
-IF ( NOT DEBIAN )
+if ( RPM5 )
+MESSAGE(STATUS "Enabling RPM 5 support")
+ADD_DEFINITIONS( -DRPM5)
+
+FIND_PACKAGE(PkgConfig REQUIRED)
+PKG_CHECK_MODULES(RPM REQUIRED rpm)
+INCLUDE_DIRECTORIES( ${RPM_INCLUDE_DIRS} )
+ENDIF ( RPM5 )
+
+IF ( RPM5 OR NOT DEBIAN )
FIND_LIBRARY(RPMDB_LIBRARY NAMES rpmdb)
IF ( NOT RPMDB_LIBRARY )
FIND_LIBRARY(RPMDB_LIBRARY NAMES rpm)
@@ -59,13 +68,17 @@
IF ( RPMIO_LIBRARY )
SET( RPMDB_LIBRARY ${RPMIO_LIBRARY} ${RPMDB_LIBRARY} )
ENDIF ( RPMIO_LIBRARY )
-IF ( FEDORA )
+FIND_LIBRARY(RPMMISC_LIBRARY NAMES rpmmisc)
+IF ( RPMMISC_LIBRARY )
+SET ( RPMDB_LIBRARY ${RPMMISC_LIBRARY} ${RPMDB_LIBRARY} )
+ENDIF ( RPMMISC_LIBRARY )
+IF ( RPM5 OR FEDORA )
FIND_LIBRARY(DB_LIBRARY NAMES db)
IF ( DB_LIBRARY )
SET( RPMDB_LIBRARY ${DB_LIBRARY} ${RPMDB_LIBRARY} )
ENDIF ( DB_LIBRARY )
-ENDIF ( FEDORA )
-ENDIF ( NOT DEBIAN )
+ENDIF ( RPM5 OR FEDORA )
+ENDIF ( RPM5 OR NOT DEBIAN )
INCLUDE ( CheckFunctionExists )
INCLUDE ( TestBigEndian )
diff -ur git.orig/ext/repo_rpmdb.c git/ext/repo_rpmdb.c
--- git.orig/ext/repo_rpmdb.c 2011-03-16 18:03:55.401907738 -0500
+++ git/ext/repo_rpmdb.c 2011-03-16 18:04:47.472989651 -0500
@@ -3039,7 +3039,11 @@
repodata_set_str(data, s - s->repo->pool->solvables, PUBKEY_KEYID, keyid);
if (dig->pubkey.userid)
setutf8string(data, s - s->repo->pool->solvables, SOLVABLE_SUMMARY, dig->pubkey.userid);
+#ifndef RPM5
(void)pgpFreeDig(dig);
+#else
+ (void)pgpDigFree(dig);
+#endif
sat_free((void *)pkts);
return 1;
}

View File

@ -7,12 +7,11 @@ LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8"
DEPENDS = "libcheck rpm zlib expat db"
PV = "0.0-git${SRCPV}"
PR = "r5"
PR = "r6"
SRC_URI = "git://gitorious.org/opensuse/sat-solver.git;protocol=git \
file://sat-solver_rpm5.patch \
file://cmake.patch \
file://rpm5.patch \
file://rpm5-solvdb.patch \
file://db5.patch \
file://builtin-arch.patch;apply=no \
file://no-builtin-arch.patch;apply=no \
@ -20,7 +19,7 @@ SRC_URI = "git://gitorious.org/opensuse/sat-solver.git;protocol=git \
S = "${WORKDIR}/git"
EXTRA_OECMAKE += "-DLIB=lib"
EXTRA_OECMAKE += "-DLIB=lib -DRPM5=RPM5"
inherit cmake pkgconfig