diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:57:51 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-27 14:57:51 +0900 |
commit | bc8d0a48b41d6cc4d79f1c062dda7ed230841644 (patch) | |
tree | e12a8d822c2abccdbdcb194e5953d498652c84ba /ext | |
parent | a52345de1f81f92a1bd69365def64a91cfd782ff (diff) | |
download | libsolv-upstream/0.6.21.tar.gz libsolv-upstream/0.6.21.tar.bz2 libsolv-upstream/0.6.21.zip |
Imported Upstream version 0.6.21upstream/0.6.21
Change-Id: Ie4bb940b0be2c8a3064162f4e8c40b241f2b1838
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'ext')
-rw-r--r-- | ext/CMakeLists.txt | 2 | ||||
-rw-r--r-- | ext/libsolvext.ver | 1 | ||||
-rw-r--r-- | ext/pool_fileconflicts.c | 12 | ||||
-rw-r--r-- | ext/repo_deb.c | 6 | ||||
-rw-r--r-- | ext/repo_rpmdb.c | 8 | ||||
-rw-r--r-- | ext/repo_rpmmd.c | 4 | ||||
-rw-r--r-- | ext/testcase.c | 77 | ||||
-rw-r--r-- | ext/testcase.h | 1 |
8 files changed, 96 insertions, 15 deletions
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index ad52495..ec5f20c 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -48,6 +48,8 @@ IF (ENABLE_COMPLEX_DEPS) IF (ENABLE_SUSEREPO OR ENABLE_RPMMD OR ENABLE_RPMDB) SET (libsolvext_SRCS ${libsolvext_SRCS} pool_parserpmrichdep.c) + SET (libsolvext_HEADERS ${libsolvext_HEADERS} + pool_parserpmrichdep.h) ENDIF (ENABLE_SUSEREPO OR ENABLE_RPMMD OR ENABLE_RPMDB) ENDIF (ENABLE_COMPLEX_DEPS) diff --git a/ext/libsolvext.ver b/ext/libsolvext.ver index 654469b..8774fd4 100644 --- a/ext/libsolvext.ver +++ b/ext/libsolvext.ver @@ -2,6 +2,7 @@ SOLV_1.0 { global: pool_deb_get_autoinstalled; pool_findfileconflicts; + pool_parserpmrichdep; repo_add_appdata; repo_add_appdata_dir; repo_add_arch_local; diff --git a/ext/pool_fileconflicts.c b/ext/pool_fileconflicts.c index 4238d2d..6c9119f 100644 --- a/ext/pool_fileconflicts.c +++ b/ext/pool_fileconflicts.c @@ -640,7 +640,7 @@ findfileconflicts2_cb(void *cbdatav, const char *fn, struct filelistinfo *info) strncpy(md5padded, info->digest, 32); md5padded[32] = 0; md5padded[33] = info->color; - /* printf("%d, hx %x -> %s %d %s\n", cbdata->idx, hx, fn, info->mode, info->digest); */ + /* printf("%d, hx %x -> %s %d %s %d\n", cbdata->idx, hx, fn, info->mode, info->digest, info->color); */ off = addfilesspace(cbdata, strlen(fn) + (34 + 1)); memcpy(cbdata->filesspace + off, (unsigned char *)md5padded, 34); strcpy((char *)cbdata->filesspace + off + 34, fn); @@ -805,7 +805,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, in void *handle; Repo *installed = pool->installed; Id p; - int obsoleteusescolors = pool_get_flag(pool, POOL_FLAG_OBSOLETEUSESCOLORS); + int usefilecolors; int hdrfetches; queue_empty(conflicts); @@ -813,8 +813,10 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, in return 0; now = start = solv_timems(0); + /* Hmm, should we have a different flag for this? */ + usefilecolors = pool_get_flag(pool, POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS); POOL_DEBUG(SOLV_DEBUG_STATS, "searching for file conflicts\n"); - POOL_DEBUG(SOLV_DEBUG_STATS, "packages: %d, cutoff %d\n", pkgs->count, cutoff); + POOL_DEBUG(SOLV_DEBUG_STATS, "packages: %d, cutoff %d, usefilecolors %d\n", pkgs->count, cutoff, usefilecolors); memset(&cbdata, 0, sizeof(cbdata)); cbdata.aliases = flags & FINDFILECONFLICTS_CHECK_DIRALIASING; @@ -1026,7 +1028,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, in { Id idx = cbdata.lookat.elements[i + 1]; int iterflags = RPM_ITERATE_FILELIST_WITHMD5 | RPM_ITERATE_FILELIST_NOGHOSTS; - if (obsoleteusescolors) + if (usefilecolors) iterflags |= RPM_ITERATE_FILELIST_WITHCOL; p = pkgs->elements[idx]; handle = (*handle_cb)(pool, p, handle_cbdata); @@ -1098,7 +1100,7 @@ pool_findfileconflicts(Pool *pool, Queue *pkgs, int cutoff, Queue *conflicts, in } if (!strcmp(fsi, fsj)) continue; /* file digests match, no conflict */ - if (obsoleteusescolors && fsi[33] && fsj[33] && (fsi[33] & fsj[33]) == 0) + if (usefilecolors && fsi[33] && fsj[33] && (fsi[33] & fsj[33]) == 0) continue; /* colors do not conflict */ queue_push(conflicts, pool_str2id(pool, fsi + 34, 1)); queue_push(conflicts, pkgs->elements[pidx]); diff --git a/ext/repo_deb.c b/ext/repo_deb.c index 35dcc84..812f3d9 100644 --- a/ext/repo_deb.c +++ b/ext/repo_deb.c @@ -388,12 +388,10 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags) if (!(p = strchr(p, '\n'))) { int l3; - if (l + 1024 >= bufl) + while (l + 1024 >= bufl) { buf = solv_realloc(buf, bufl + 4096); bufl += 4096; - p = buf + l; - continue; } p = buf + l; ll = fread(p, 1, bufl - l - 1, fp); @@ -403,6 +401,8 @@ repo_add_debpackages(Repo *repo, FILE *fp, int flags) while ((l3 = strlen(p)) < ll) p[l3] = '\n'; l += ll; + if (p != buf) + p--; continue; } p++; diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 308cfe5..92aef31 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -54,7 +54,8 @@ /* 3: added triggers */ /* 4: fixed triggers */ /* 5: fixed checksum copying */ -#define RPMDB_COOKIE_VERSION 5 +/* 6: add SOLVABLE_PREREQ_IGNOREINST support */ +#define RPMDB_COOKIE_VERSION 6 #define TAG_NAME 1000 #define TAG_VERSION 1001 @@ -2434,7 +2435,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * if ((flags & RPM_ITERATE_FILELIST_WITHCOL) != 0) { co = headint32array(rpmhead, TAG_FILECOLORS, &cnt2); - if (!co || cnt != cnt2) + if (co && cnt != cnt2) { solv_free(co); solv_free(md); @@ -2512,8 +2513,7 @@ rpm_iterate_filelist(void *rpmhandle, int flags, void (*cb)(void *, const char * info.digest = md5; } } - if (co) - info.color = co[i]; + info.color = co ? co[i] : 0; (*cb)(cbdata, space, &info); } solv_free(space); diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index 78264cc..729f4f7 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -651,13 +651,13 @@ put_in_cshash(struct parsedata *pd, const unsigned char *key, int keyl, Id id) while (ht[h]) { unsigned char *d = pd->csdata + ht[h]; - if (d[-1] == keyl && !memcmp(key, d, keyl)) + if (d[-1] == keyl - 1 && !memcmp(key, d, keyl)) return; /* XXX: first id wins... */ h = HASHCHAIN_NEXT(h, hh, hm); } } /* a new entry. put in csdata */ - pd->csdata = solv_extend(pd->csdata, pd->ncsdata, 1, 1 + keyl + sizeof(Id), 4095); + pd->csdata = solv_extend(pd->csdata, pd->ncsdata, 1 + keyl + sizeof(Id), 1, 4095); d = pd->csdata + pd->ncsdata; d[0] = keyl - 1; memcpy(d + 1, key, keyl); diff --git a/ext/testcase.c b/ext/testcase.c index 536875c..6e2b574 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -46,6 +46,8 @@ static struct job2str { { SOLVER_DROP_ORPHANED, "droporphaned" }, { SOLVER_USERINSTALLED, "userinstalled" }, { SOLVER_ALLOWUNINSTALL, "allowuninstall" }, + { SOLVER_FAVOR, "favor" }, + { SOLVER_DISFAVOR, "disfavor" }, { 0, 0 } }; @@ -81,6 +83,7 @@ static struct resultflags2str { { TESTCASE_RESULT_ALTERNATIVES, "alternatives" }, { TESTCASE_RESULT_RULES, "rules" }, { TESTCASE_RESULT_GENID, "genid" }, + { TESTCASE_RESULT_REASON, "reason" }, { 0, 0 } }; @@ -111,6 +114,7 @@ static struct solverflags2str { { SOLVER_FLAG_FOCUS_INSTALLED, "focusinstalled", 0 }, { SOLVER_FLAG_YUM_OBSOLETES, "yumobsoletes", 0 }, { SOLVER_FLAG_NEED_UPDATEPROVIDE, "needupdateprovide", 0 }, + { SOLVER_FLAG_URPM_REORDER, "urpmreorder", 0 }, { 0, 0, 0 } }; @@ -1553,7 +1557,11 @@ testcase_setsolverflags(Solver *solv, const char *str) pool_debug(solv->pool, SOLV_ERROR, "setsolverflags: unknown flag '%.*s'\n", (int)(p - s), s); return 0; } - solver_set_flag(solv, solverflags2str[i].flag, v); + if (solver_set_flag(solv, solverflags2str[i].flag, v) == -1) + { + pool_debug(solv->pool, SOLV_ERROR, "setsolverflags: unsupported flag '%s'\n", solverflags2str[i].str); + return 0; + } } return 1; } @@ -1700,6 +1708,35 @@ static struct class2str { { 0, 0 } }; +static struct reason2str { + Id reason; + const char *str; +} reason2str[] = { + { SOLVER_REASON_UNRELATED, "unrelated" }, + { SOLVER_REASON_UNIT_RULE, "unit" }, + { SOLVER_REASON_KEEP_INSTALLED, "keep" }, + { SOLVER_REASON_RESOLVE_JOB, "job" }, + { SOLVER_REASON_UPDATE_INSTALLED, "update" }, + { SOLVER_REASON_CLEANDEPS_ERASE, "cleandeps" }, + { SOLVER_REASON_RESOLVE, "resolve" }, + { SOLVER_REASON_WEAKDEP, "weakdep" }, + { SOLVER_REASON_RESOLVE_ORPHAN, "orphan" }, + + { SOLVER_REASON_RECOMMENDED, "recommended" }, + { SOLVER_REASON_SUPPLEMENTED, "supplemented" }, + { 0, 0 } +}; + +static const char * +testcase_reason2str(Id reason) +{ + int i; + for (i = 0; reason2str[i].str; i++) + if (reason == reason2str[i].reason) + return reason2str[i].str; + return "?"; +} + static int dump_genid(Pool *pool, Strqueue *sq, Id id, int cnt) { @@ -2017,6 +2054,44 @@ testcase_solverresult(Solver *solv, int resultflags) dump_genid(pool, &sq, id, 1); } } + if ((resultflags & TESTCASE_RESULT_REASON) != 0) + { + Queue whyq; + queue_init(&whyq); + FOR_POOL_SOLVABLES(p) + { + Id info, p2, id; + int reason = solver_describe_decision(solv, p, &info); + if (reason == SOLVER_REASON_UNRELATED) + continue; + if (reason == SOLVER_REASON_WEAKDEP) + { + solver_describe_weakdep_decision(solv, p, &whyq); + if (whyq.count) + { + for (i = 0; i < whyq.count; i += 3) + { + reason = whyq.elements[i]; + p2 = whyq.elements[i + 1]; + id = whyq.elements[i + 2]; + s = pool_tmpjoin(pool, "reason ", testcase_solvid2str(pool, p), 0); + s = pool_tmpappend(pool, s, " ", testcase_reason2str(reason)); + s = pool_tmpappend(pool, s, " ", testcase_dep2str(pool, id)); + if (p2) + s = pool_tmpappend(pool, s, " ", testcase_solvid2str(pool, p2)); + strqueue_push(&sq, s); + } + continue; + } + } + s = pool_tmpjoin(pool, "reason ", testcase_solvid2str(pool, p), 0); + s = pool_tmpappend(pool, s, " ", testcase_reason2str(reason)); + if (info) + s = pool_tmpappend(pool, s, " ", testcase_ruleid(solv, info)); + strqueue_push(&sq, s); + } + queue_free(&whyq); + } strqueue_sort(&sq); result = strqueue_join(&sq); strqueue_free(&sq); diff --git a/ext/testcase.h b/ext/testcase.h index 4903e6c..d3ad505 100644 --- a/ext/testcase.h +++ b/ext/testcase.h @@ -17,6 +17,7 @@ #define TESTCASE_RESULT_ALTERNATIVES (1 << 5) #define TESTCASE_RESULT_RULES (1 << 6) #define TESTCASE_RESULT_GENID (1 << 7) +#define TESTCASE_RESULT_REASON (1 << 8) extern Id testcase_str2dep(Pool *pool, const char *s); extern const char *testcase_dep2str(Pool *pool, Id id); |