summaryrefslogtreecommitdiff
path: root/ext/repo_rpmmd.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2009-07-14 18:34:49 +0200
committerMichael Schroeder <mls@suse.de>2009-07-14 18:34:49 +0200
commit560f20469f373bc8779587b8692b9949f38fc4bb (patch)
tree3b5df04a4f706bd10261bcdb620dc2ae597cf20e /ext/repo_rpmmd.c
parent99ceec3e3b62689b8de08dcb2a38924687845268 (diff)
downloadlibsolv-560f20469f373bc8779587b8692b9949f38fc4bb.tar.gz
libsolv-560f20469f373bc8779587b8692b9949f38fc4bb.tar.bz2
libsolv-560f20469f373bc8779587b8692b9949f38fc4bb.zip
- add new flags for the load functions:
REPO_LOCALPOOL - create local pool REPO_EXTEND_SOLVABLES - extend existing solvables instead of creating new ones REPO_USE_LOADING - replace repodata in state loading - add repo_add_solv_flags to make repo_add_solv use flags - make repo_add_solv obey the flags instead of using defaults if this is a subload - change loadcallback definition to return a boolean, the callback is now responsible for the loading - change repo_write so that the keyfilter can select which repodata to use (hack) - change pool_addfileprovides to load the complete filelist if needed - add SEARCH_COMPLETE_FILELIST flag to searches - add transaction_create_installedmap/transaction_calc_installsizechange
Diffstat (limited to 'ext/repo_rpmmd.c')
-rw-r--r--ext/repo_rpmmd.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c
index 10dbf4e..8c97ab2 100644
--- a/ext/repo_rpmmd.c
+++ b/ext/repo_rpmmd.c
@@ -18,6 +18,7 @@
#define DISABLE_SPLIT
#include "tools_util.h"
#include "repo_rpmmd.h"
+#include "chksum.h"
enum state {
@@ -126,6 +127,7 @@ static struct stateswitch stateswitches[] = {
/** tags for different package data, we just ignore the tag **/
{ STATE_START, "metadata", STATE_START, 0 },
{ STATE_START, "otherdata", STATE_START, 0 },
+ { STATE_START, "filelists", STATE_START, 0 },
{ STATE_START, "diskusagedata", STATE_START, 0 },
{ STATE_START, "susedata", STATE_START, 0 },
@@ -1125,6 +1127,29 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags)
the package checksums we know about, to get an Id
we can use in a cache */
stringpool_init_empty(&pd.cspool);
+ if ((flags & REPO_EXTEND_SOLVABLES) != 0)
+ {
+ /* setup join data */
+ Dataiterator di;
+ dataiterator_init(&di, pool, repo, 0, SOLVABLE_CHECKSUM, 0, 0);
+ while (dataiterator_step(&di))
+ {
+ const char *str;
+ int index;
+
+ if (!sat_chksum_len(di.key->type))
+ continue;
+ str = repodata_chk2str(di.data, di.key->type, (const unsigned char *)di.kv.str);
+ index = stringpool_str2id(&pd.cspool, str, 1);
+ if (index >= pd.ncscache)
+ {
+ pd.cscache = sat_zextend(pd.cscache, pd.ncscache, index + 1 - pd.ncscache, sizeof(Id), 255);
+ pd.ncscache = index + 1;
+ }
+ pd.cscache[index] = di.solvid;
+ }
+ dataiterator_free(&di);
+ }
XML_Parser parser = XML_ParserCreate(NULL);
XML_SetUserData(parser, &pd);
@@ -1147,6 +1172,7 @@ repo_add_rpmmd(Repo *repo, FILE *fp, const char *language, int flags)
join_freemem();
stringpool_free(&pd.cspool);
sat_free(pd.cscache);
+
if (!(flags & REPO_NO_INTERNALIZE))
repodata_internalize(data);
POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_rpmmd took %d ms\n", sat_timems(now));