diff options
author | Michael Schroeder <mls@suse.de> | 2012-10-15 12:10:06 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2012-10-15 12:10:06 +0200 |
commit | d5597d3b349415e684814541d33b1b460a0481b9 (patch) | |
tree | 820f839caf3b8bcfcc72e26052c651e78d40531b | |
parent | a9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8 (diff) | |
download | libsolv-d5597d3b349415e684814541d33b1b460a0481b9.tar.gz libsolv-d5597d3b349415e684814541d33b1b460a0481b9.tar.bz2 libsolv-d5597d3b349415e684814541d33b1b460a0481b9.zip |
add repo_add_rpm_handle, add ENABLE_RPMDB_BYRPMHEADER so that we don't need to link against rpm if rpm_byrpmh is not needed
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | ext/libsolvext.ver | 1 | ||||
-rw-r--r-- | ext/repo_rpmdb.c | 37 | ||||
-rw-r--r-- | ext/repo_rpmdb.h | 4 |
4 files changed, 42 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d5b86a..ae536ba 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ OPTION (USE_VENDORDIRS "Install the bindings in vendor directories?" OFF) OPTION (ENABLE_RPMDB "Build with rpm database support?" OFF) OPTION (ENABLE_RPMDB_PUBKEY "Build with rpmdb pubkey support?" OFF) +OPTION (ENABLE_RPMDB_BYRPMHEADER "Build with rpmdb Header support?" OFF) OPTION (ENABLE_RPMMD "Build with rpmmd repository support?" OFF) OPTION (ENABLE_SUSEREPO "Build with suse repository support?" OFF) OPTION (ENABLE_COMPS "Build with fedora comps support?" OFF) @@ -77,6 +78,7 @@ MESSAGE (STATUS "Building for SUSE") ADD_DEFINITIONS (-DSUSE) SET (ENABLE_RPMDB ON) SET (ENABLE_RPMDB_PUBKEY ON) +SET (ENABLE_RPMDB_BYRPMHEADER ON) SET (ENABLE_RPMMD ON) SET (ENABLE_SUSEREPO ON) SET (ENABLE_HELIXREPO ON) diff --git a/ext/libsolvext.ver b/ext/libsolvext.ver index 3758ce9..a8998a2 100644 --- a/ext/libsolvext.ver +++ b/ext/libsolvext.ver @@ -20,6 +20,7 @@ SOLV_1.0 { repo_add_releasefile_products; repo_add_repomdxml; repo_add_rpm; + repo_add_rpm_handle; repo_add_rpmdb; repo_add_rpmdb_pubkeys; repo_add_rpmmd; diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 61c31f2..38de58a 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -2034,6 +2034,39 @@ repo_add_rpm(Repo *repo, const char *rpm, int flags) return s - pool->solvables; } +Id +repo_add_rpm_handle(Repo *repo, void *rpmhandle, int flags) +{ + Pool *pool = repo->pool; + Repodata *data; + RpmHead *rpmhead = rpmhandle; + Solvable *s; + char *payloadformat; + + data = repo_add_repodata(repo, flags); + if (headexists(rpmhead, TAG_PATCHESNAME)) + { + pool_error(pool, -1, "is a patch rpm"); + return 0; + } + payloadformat = headstring(rpmhead, TAG_PAYLOADFORMAT); + if (payloadformat && !strcmp(payloadformat, "drpm")) + { + /* this is a delta rpm */ + pool_error(pool, -1, "is a delta rpm"); + return 0; + } + s = pool_id2solvable(pool, repo_add_solvable(repo)); + if (!rpm2solv(pool, repo, data, s, rpmhead, flags)) + { + repo_free_solvable(repo, s - pool->solvables, 1); + return 0; + } + if (!(flags & REPO_NO_INTERNALIZE)) + repodata_internalize(data); + return s - pool->solvables; +} + static inline void linkhash(const char *lt, char *hash) { @@ -2575,6 +2608,8 @@ rpm_byfp(FILE *fp, const char *name, void **statep) return rpmhead; } +#ifdef ENABLE_RPMDB_BYRPMHEADER + void * rpm_byrpmh(Header h, void **statep) { @@ -2613,6 +2648,8 @@ rpm_byrpmh(Header h, void **statep) return rpmhead; } +#endif + #ifdef ENABLE_RPMDB_PUBKEY diff --git a/ext/repo_rpmdb.h b/ext/repo_rpmdb.h index 7b3156a..5bd436d 100644 --- a/ext/repo_rpmdb.h +++ b/ext/repo_rpmdb.h @@ -33,8 +33,8 @@ extern Id repo_add_pubkey(Repo *repo, const char *key, int flags); extern void *rpm_byrpmdbid(Id rpmdbid, const char *rootdir, void **statep); extern void *rpm_byfp(FILE *fp, const char *name, void **statep); extern void *rpm_byrpmh(struct headerToken_s *h, void **statep); - +extern int rpm_installedrpmdbids(const char *rootdir, const char *index, const char *match, Queue *rpmdbidq); extern char *rpm_query(void *rpmhandle, Id what); extern void rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char *, int, const char *), void *cbdata); -extern int rpm_installedrpmdbids(const char *rootdir, const char *index, const char *match, Queue *rpmdbidq); +extern Id repo_add_rpm_handle(Repo *repo, void *rpmhandle, int flags); |