summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-10-15 12:10:06 +0200
committerMichael Schroeder <mls@suse.de>2012-10-15 12:10:06 +0200
commitd5597d3b349415e684814541d33b1b460a0481b9 (patch)
tree820f839caf3b8bcfcc72e26052c651e78d40531b /ext
parenta9bc7b08e9fb6dd1dd18d922d90fb773ca6ecdf8 (diff)
downloadlibsolv-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
Diffstat (limited to 'ext')
-rw-r--r--ext/libsolvext.ver1
-rw-r--r--ext/repo_rpmdb.c37
-rw-r--r--ext/repo_rpmdb.h4
3 files changed, 40 insertions, 2 deletions
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);