diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 4 | ||||
-rw-r--r-- | src/bitmap.c | 8 | ||||
-rw-r--r-- | src/chksum.c | 48 | ||||
-rw-r--r-- | src/chksum.h | 20 | ||||
-rw-r--r-- | src/dirpool.c | 18 | ||||
-rw-r--r-- | src/dirpool.h | 2 | ||||
-rw-r--r-- | src/evr.c | 22 | ||||
-rw-r--r-- | src/evr.h | 2 | ||||
-rw-r--r-- | src/knownid.h | 2 | ||||
-rw-r--r-- | src/libsolv.ver | 54 | ||||
-rw-r--r-- | src/md5.c | 6 | ||||
-rw-r--r-- | src/md5.h | 6 | ||||
-rw-r--r-- | src/policy.c | 14 | ||||
-rw-r--r-- | src/pool.c | 156 | ||||
-rw-r--r-- | src/pool.h | 34 | ||||
-rw-r--r-- | src/poolarch.c | 10 | ||||
-rw-r--r-- | src/poolid.c | 16 | ||||
-rw-r--r-- | src/poolvendor.c | 6 | ||||
-rw-r--r-- | src/problems.c | 28 | ||||
-rw-r--r-- | src/qsort_r.c | 4 | ||||
-rw-r--r-- | src/queue.c | 10 | ||||
-rw-r--r-- | src/repo.c | 46 | ||||
-rw-r--r-- | src/repo_solv.c | 166 | ||||
-rw-r--r-- | src/repodata.c | 166 | ||||
-rw-r--r-- | src/repopage.c | 14 | ||||
-rw-r--r-- | src/rules.c | 70 | ||||
-rw-r--r-- | src/satversion.c | 13 | ||||
-rw-r--r-- | src/sha1.c | 12 | ||||
-rw-r--r-- | src/sha1.h | 6 | ||||
-rw-r--r-- | src/sha2.c | 56 | ||||
-rw-r--r-- | src/sha2.h | 30 | ||||
-rw-r--r-- | src/solvable.c | 6 | ||||
-rw-r--r-- | src/solver.c | 282 | ||||
-rw-r--r-- | src/solverdebug.c | 186 | ||||
-rw-r--r-- | src/solvversion.c | 13 | ||||
-rw-r--r-- | src/solvversion.h.in (renamed from src/satversion.h.in) | 14 | ||||
-rw-r--r-- | src/strpool.c | 28 | ||||
-rw-r--r-- | src/transaction.c | 110 | ||||
-rw-r--r-- | src/util.c | 58 | ||||
-rw-r--r-- | src/util.h | 44 |
40 files changed, 895 insertions, 895 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c3750e0..6fe169d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,14 +16,14 @@ SET (libsolv_SRCS solver.c solverdebug.c repo_solv.c evr.c pool.c queue.c repo.c repodata.c repopage.c util.c policy.c solvable.c transaction.c rules.c problems.c - chksum.c md5.c sha1.c sha2.c satversion.c) + chksum.c md5.c sha1.c sha2.c solvversion.c) SET (libsolv_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h poolid.h pooltypes.h queue.h solvable.h solver.h solverdebug.h repo.h repodata.h repopage.h repo_solv.h util.h strpool.h dirpool.h knownid.h transaction.h rules.h problems.h - chksum.h ${CMAKE_BINARY_DIR}/src/satversion.h) + chksum.h ${CMAKE_BINARY_DIR}/src/solvversion.h) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") SET (CMAKE_SHARED_LINKER_FLAGS "${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver") diff --git a/src/bitmap.c b/src/bitmap.c index 0485945..d57971d 100644 --- a/src/bitmap.c +++ b/src/bitmap.c @@ -21,14 +21,14 @@ void map_init(Map *m, int n) { m->size = (n + 7) >> 3; - m->map = m->size ? sat_calloc(m->size, 1) : 0; + m->map = m->size ? solv_calloc(m->size, 1) : 0; } /* destructor */ void map_free(Map *m) { - m->map = sat_free(m->map); + m->map = solv_free(m->map); m->size = 0; } @@ -39,7 +39,7 @@ map_init_clone(Map *t, Map *s) t->size = s->size; if (s->size) { - t->map = sat_malloc(s->size); + t->map = solv_malloc(s->size); memcpy(t->map, s->map, s->size); } else @@ -53,7 +53,7 @@ map_grow(Map *m, int n) n = (n + 7) >> 3; if (m->size < n) { - m->map = sat_realloc(m->map, n); + m->map = solv_realloc(m->map, n); memset(m->map + m->size, 0, n - m->size); m->size = n; } diff --git a/src/chksum.c b/src/chksum.c index a070a86..fb252bc 100644 --- a/src/chksum.c +++ b/src/chksum.c @@ -24,21 +24,21 @@ struct ctxhandle { }; void * -sat_chksum_create(Id type) +solv_chksum_create(Id type) { struct ctxhandle *h; - h = sat_calloc(1, sizeof(*h)); + h = solv_calloc(1, sizeof(*h)); h->type = type; switch(type) { case REPOKEY_TYPE_MD5: - sat_MD5_Init(&h->c.md5); + solv_MD5_Init(&h->c.md5); return h; case REPOKEY_TYPE_SHA1: - sat_SHA1_Init(&h->c.sha1); + solv_SHA1_Init(&h->c.sha1); return h; case REPOKEY_TYPE_SHA256: - sat_SHA256_Init(&h->c.sha256); + solv_SHA256_Init(&h->c.sha256); return h; default: break; @@ -48,13 +48,13 @@ sat_chksum_create(Id type) } void * -sat_chksum_create_from_bin(Id type, const unsigned char *buf) +solv_chksum_create_from_bin(Id type, const unsigned char *buf) { struct ctxhandle *h; - int l = sat_chksum_len(type); + int l = solv_chksum_len(type); if (buf == 0 || l == 0) return 0; - h = sat_calloc(1, sizeof(*h)); + h = solv_calloc(1, sizeof(*h)); h->type = type; h->done = 1; memcpy(h->result, buf, l); @@ -62,7 +62,7 @@ sat_chksum_create_from_bin(Id type, const unsigned char *buf) } void -sat_chksum_add(void *handle, const void *data, int len) +solv_chksum_add(void *handle, const void *data, int len) { struct ctxhandle *h = handle; if (h->done) @@ -70,13 +70,13 @@ sat_chksum_add(void *handle, const void *data, int len) switch(h->type) { case REPOKEY_TYPE_MD5: - sat_MD5_Update(&h->c.md5, (void *)data, len); + solv_MD5_Update(&h->c.md5, (void *)data, len); return; case REPOKEY_TYPE_SHA1: - sat_SHA1_Update(&h->c.sha1, data, len); + solv_SHA1_Update(&h->c.sha1, data, len); return; case REPOKEY_TYPE_SHA256: - sat_SHA256_Update(&h->c.sha256, data, len); + solv_SHA256_Update(&h->c.sha256, data, len); return; default: return; @@ -84,31 +84,31 @@ sat_chksum_add(void *handle, const void *data, int len) } const unsigned char * -sat_chksum_get(void *handle, int *lenp) +solv_chksum_get(void *handle, int *lenp) { struct ctxhandle *h = handle; if (h->done) { if (lenp) - *lenp = sat_chksum_len(h->type); + *lenp = solv_chksum_len(h->type); return h->result; } switch(h->type) { case REPOKEY_TYPE_MD5: - sat_MD5_Final(h->result, &h->c.md5); + solv_MD5_Final(h->result, &h->c.md5); h->done = 1; if (lenp) *lenp = 16; return h->result; case REPOKEY_TYPE_SHA1: - sat_SHA1_Final(&h->c.sha1, h->result); + solv_SHA1_Final(&h->c.sha1, h->result); h->done = 1; if (lenp) *lenp = 20; return h->result; case REPOKEY_TYPE_SHA256: - sat_SHA256_Final(h->result, &h->c.sha256); + solv_SHA256_Final(h->result, &h->c.sha256); h->done = 1; if (lenp) *lenp = 32; @@ -121,21 +121,21 @@ sat_chksum_get(void *handle, int *lenp) } Id -sat_chksum_get_type(void *handle) +solv_chksum_get_type(void *handle) { struct ctxhandle *h = handle; return h->type; } int -sat_chksum_isfinished(void *handle) +solv_chksum_isfinished(void *handle) { struct ctxhandle *h = handle; return h->done != 0; } const char * -sat_chksum_type2str(Id type) +solv_chksum_type2str(Id type) { switch(type) { @@ -151,7 +151,7 @@ sat_chksum_type2str(Id type) } Id -sat_chksum_str2type(const char *str) +solv_chksum_str2type(const char *str) { if (!strcasecmp(str, "md5")) return REPOKEY_TYPE_MD5; @@ -163,17 +163,17 @@ sat_chksum_str2type(const char *str) } void * -sat_chksum_free(void *handle, unsigned char *cp) +solv_chksum_free(void *handle, unsigned char *cp) { if (cp) { const unsigned char *res; int l; - res = sat_chksum_get(handle, &l); + res = solv_chksum_get(handle, &l); if (l && res) memcpy(cp, res, l); } - sat_free(handle); + solv_free(handle); return 0; } diff --git a/src/chksum.h b/src/chksum.h index 948a01a..e6706df 100644 --- a/src/chksum.h +++ b/src/chksum.h @@ -1,16 +1,16 @@ #include "pool.h" -void *sat_chksum_create(Id type); -void *sat_chksum_create_from_bin(Id type, const unsigned char *buf); -void sat_chksum_add(void *handle, const void *data, int len); -Id sat_chksum_get_type(void *handle); -int sat_chksum_isfinished(void *handle); -const unsigned char *sat_chksum_get(void *handle, int *lenp); -void *sat_chksum_free(void *handle, unsigned char *cp); -const char *sat_chksum_type2str(Id type); -Id sat_chksum_str2type(const char *str); +void *solv_chksum_create(Id type); +void *solv_chksum_create_from_bin(Id type, const unsigned char *buf); +void solv_chksum_add(void *handle, const void *data, int len); +Id solv_chksum_get_type(void *handle); +int solv_chksum_isfinished(void *handle); +const unsigned char *solv_chksum_get(void *handle, int *lenp); +void *solv_chksum_free(void *handle, unsigned char *cp); +const char *solv_chksum_type2str(Id type); +Id solv_chksum_str2type(const char *str); -static inline int sat_chksum_len(Id type) +static inline int solv_chksum_len(Id type) { switch (type) { diff --git a/src/dirpool.c b/src/dirpool.c index 85197e4..4d3281c 100644 --- a/src/dirpool.c +++ b/src/dirpool.c @@ -73,8 +73,8 @@ dirpool_init(Dirpool *dp) void dirpool_free(Dirpool *dp) { - sat_free(dp->dirs); - sat_free(dp->dirtraverse); + solv_free(dp->dirs); + solv_free(dp->dirtraverse); } void @@ -83,8 +83,8 @@ dirpool_make_dirtraverse(Dirpool *dp) Id parent, i, *dirtraverse; if (!dp->ndirs) return; - dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); - dirtraverse = sat_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); + dirtraverse = solv_calloc_block(dp->ndirs, sizeof(Id), DIR_BLOCK); for (parent = 0, i = 0; i < dp->ndirs; i++) { if (dp->dirs[i] > 0) @@ -106,7 +106,7 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create) if (!create) return 0; dp->ndirs = 2; - dp->dirs = sat_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend_resize(dp->dirs, dp->ndirs, sizeof(Id), DIR_BLOCK); dp->dirs[0] = 0; dp->dirs[1] = 1; /* "" */ } @@ -141,16 +141,16 @@ dirpool_add_dir(Dirpool *dp, Id parent, Id comp, int create) if (dp->dirs[did] != -parent) { /* make room for parent entry */ - dp->dirs = sat_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); - dp->dirtraverse = sat_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirtraverse = solv_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); /* new parent block, link in */ dp->dirs[dp->ndirs] = -parent; dp->dirtraverse[dp->ndirs] = dp->dirtraverse[parent]; dp->dirtraverse[parent] = ++dp->ndirs; } /* make room for new entry */ - dp->dirs = sat_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); - dp->dirtraverse = sat_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirs = solv_extend(dp->dirs, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); + dp->dirtraverse = solv_extend(dp->dirtraverse, dp->ndirs, 1, sizeof(Id), DIR_BLOCK); dp->dirs[dp->ndirs] = comp; dp->dirtraverse[dp->ndirs] = 0; return dp->ndirs++; diff --git a/src/dirpool.h b/src/dirpool.h index e68f77c..29ed109 100644 --- a/src/dirpool.h +++ b/src/dirpool.h @@ -64,7 +64,7 @@ dirpool_child(Dirpool *dp, Id did) static inline void dirpool_free_dirtraverse(Dirpool *dp) { - sat_free(dp->dirtraverse); + solv_free(dp->dirtraverse); dp->dirtraverse = 0; } @@ -21,12 +21,12 @@ #if defined(DEBIAN_SEMANTICS) || defined(MULTI_SEMANTICS) #ifdef MULTI_SEMANTICS -# define sat_vercmp sat_vercmp_deb +# define solv_vercmp solv_vercmp_deb #endif /* debian type version compare */ int -sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) +solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) { int r, c1, c2; while (1) @@ -65,7 +65,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) } #ifdef MULTI_SEMANTICS -# undef sat_vercmp +# undef solv_vercmp #endif #endif @@ -76,7 +76,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) /* note: the code assumes that *q1 and *q2 are not alphanumeric! */ int -sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) +solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) { int r = 0; const char *e1, *e2; @@ -135,7 +135,7 @@ sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2) #endif #if defined(MULTI_SEMANTICS) -# define sat_vercmp (*(pool->disttype == DISTTYPE_DEB ? &sat_vercmp_deb : &sat_ver##cmp)) +# define solv_vercmp (*(pool->disttype == DISTTYPE_DEB ? &solv_vercmp_deb : &solv_ver##cmp)) #endif /* edition (e:v-r) compare */ @@ -172,7 +172,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) s2 = 0; if (s1 && s2) { - r = sat_vercmp(evr1, s1, evr2, s2); + r = solv_vercmp(evr1, s1, evr2, s2); if (r) return r; evr1 = s1 + 1; @@ -206,7 +206,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) r = 0; if (mode != EVRCMP_MATCH || (evr1 != (r1 ? r1 : s1) && evr2 != (r2 ? r2 : s2))) - r = sat_vercmp(evr1, r1 ? r1 : s1, evr2, r2 ? r2 : s2); + r = solv_vercmp(evr1, r1 ? r1 : s1, evr2, r2 ? r2 : s2); if (r) return r; @@ -222,7 +222,7 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode) if (r1 && r2) { if (s1 != ++r1 && s2 != ++r2) - r = sat_vercmp(r1, s1, r2, s2); + r = solv_vercmp(r1, s1, r2, s2); } return r; } @@ -253,7 +253,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version { if (epoch) { - r = sat_vercmp(evr1, s1, epoch, epoch + strlen(epoch)); + r = solv_vercmp(evr1, s1, epoch, epoch + strlen(epoch)); if (r) return r; } @@ -271,7 +271,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version r1 = s1; if (version) { - r = sat_vercmp(evr1, r1 ? r1 : s1, version, version + strlen(version)); + r = solv_vercmp(evr1, r1 ? r1 : s1, version, version + strlen(version)); if (r) return r; } @@ -279,7 +279,7 @@ pool_evrmatch(const Pool *pool, Id evrid, const char *epoch, const char *version { if (!r1) return -1; - r = sat_vercmp(r1 + 1, s1, release, release + strlen(release)); + r = solv_vercmp(r1 + 1, s1, release, release + strlen(release)); if (r) return r; } @@ -24,7 +24,7 @@ extern "C" { #define EVRCMP_MATCH 2 #define EVRCMP_COMPARE_EVONLY 3 -extern int sat_vercmp(const char *s1, const char *q1, const char *s2, const char *q2); +extern int solv_vercmp(const char *s1, const char *q1, const char *s2, const char *q2); extern int pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode); extern int pool_evrcmp(const Pool *pool, Id evr1id, Id evr2id, int mode); diff --git a/src/knownid.h b/src/knownid.h index 7757ae0..fdf7b0f 100644 --- a/src/knownid.h +++ b/src/knownid.h @@ -21,7 +21,7 @@ static const char *initpool_data[] = { #else # define KNOWNID(a, b) a -enum sat_knownid { +enum solv_knownid { #endif KNOWNID(ID_NULL, "<NULL>"), diff --git a/src/libsolv.ver b/src/libsolv.ver index 5080879..5fa4af6 100644 --- a/src/libsolv.ver +++ b/src/libsolv.ver @@ -193,33 +193,33 @@ SOLV_1.0 { repodata_str2dir; repodata_stringify; repopagestore_compress_page; - sat_bin2hex; - sat_calloc; - sat_chksum_add; - sat_chksum_create; - sat_chksum_create_from_bin; - sat_chksum_free; - sat_chksum_get; - sat_chksum_get_type; - sat_chksum_isfinished; - sat_chksum_str2type; - sat_chksum_type2str; - sat_dupappend; - sat_dupjoin; - sat_free; - sat_hex2bin; - sat_malloc; - sat_malloc2; - sat_oom; - sat_realloc; - sat_realloc2; - sat_sort; - sat_timems; - sat_vercmp; - sat_version; - sat_version_major; - sat_version_minor; - sat_version_patch; + solv_bin2hex; + solv_calloc; + solv_chksum_add; + solv_chksum_create; + solv_chksum_create_from_bin; + solv_chksum_free; + solv_chksum_get; + solv_chksum_get_type; + solv_chksum_isfinished; + solv_chksum_str2type; + solv_chksum_type2str; + solv_dupappend; + solv_dupjoin; + solv_free; + solv_hex2bin; + solv_malloc; + solv_malloc2; + solv_oom; + solv_realloc; + solv_realloc2; + solv_sort; + solv_timems; + solv_vercmp; + solv_version; + solv_version_major; + solv_version_minor; + solv_version_patch; solvable_get_location; solvable_identical; solvable_lookup_bin_checksum; @@ -173,7 +173,7 @@ static void *body(MD5_CTX *ctx, void *data, unsigned long size) return ptr; } -void sat_MD5_Init(MD5_CTX *ctx) +void solv_MD5_Init(MD5_CTX *ctx) { ctx->a = 0x67452301; ctx->b = 0xefcdab89; @@ -184,7 +184,7 @@ void sat_MD5_Init(MD5_CTX *ctx) ctx->hi = 0; } -void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) +void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) { MD5_u32plus saved_lo; unsigned long used, free; @@ -218,7 +218,7 @@ void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size) memcpy(ctx->buffer, data, size); } -void sat_MD5_Final(unsigned char *result, MD5_CTX *ctx) +void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx) { unsigned long used, free; @@ -16,6 +16,6 @@ typedef struct { MD5_u32plus block[16]; } MD5_CTX; -extern void sat_MD5_Init(MD5_CTX *ctx); -extern void sat_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); -extern void sat_MD5_Final(unsigned char *result, MD5_CTX *ctx); +extern void solv_MD5_Init(MD5_CTX *ctx); +extern void solv_MD5_Update(MD5_CTX *ctx, void *data, unsigned long size); +extern void solv_MD5_Final(unsigned char *result, MD5_CTX *ctx); diff --git a/src/policy.c b/src/policy.c index ab5f55b..9e6a01f 100644 --- a/src/policy.c +++ b/src/policy.c @@ -114,7 +114,7 @@ prune_to_highest_prio_per_name(Pool *pool, Queue *plist) Id name; queue_init(&pq); - sat_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); + solv_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); queue_push(&pq, plist->elements[0]); name = pool->solvables[pq.elements[0]].name; for (i = 1, j = 0; i < plist->count; i++) @@ -359,10 +359,10 @@ prune_to_best_version(Pool *pool, Queue *plist) if (plist->count < 2) /* no need to prune for a single entry */ return; - POOL_DEBUG(SAT_DEBUG_POLICY, "prune_to_best_version %d\n", plist->count); + POOL_DEBUG(SOLV_DEBUG_POLICY, "prune_to_best_version %d\n", plist->count); /* sort by name first, prefer installed */ - sat_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); + solv_sort(plist->elements, plist->count, sizeof(Id), prune_to_best_version_sortcmp, pool); /* now find best 'per name' */ best = 0; @@ -370,7 +370,7 @@ prune_to_best_version(Pool *pool, Queue *plist) { s = pool->solvables + plist->elements[i]; - POOL_DEBUG(SAT_DEBUG_POLICY, "- %s[%s]\n", + POOL_DEBUG(SOLV_DEBUG_POLICY, "- %s[%s]\n", pool_solvable2str(pool, s), (pool->installed && s->repo == pool->installed) ? "installed" : "not installed"); @@ -580,7 +580,7 @@ policy_create_obsolete_index(Solver *solv) if (!installed || installed->start == installed->end) return; cnt = installed->end - installed->start; - solv->obsoletes = obsoletes = sat_calloc(cnt, sizeof(Id)); + solv->obsoletes = obsoletes = solv_calloc(cnt, sizeof(Id)); for (i = 1; i < pool->nsolvables; i++) { s = pool->solvables + i; @@ -613,8 +613,8 @@ policy_create_obsolete_index(Solver *solv) n += obsoletes[i] + 1; obsoletes[i] = n; } - solv->obsoletes_data = obsoletes_data = sat_calloc(n + 1, sizeof(Id)); - POOL_DEBUG(SAT_DEBUG_STATS, "obsoletes data: %d entries\n", n + 1); + solv->obsoletes_data = obsoletes_data = solv_calloc(n + 1, sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "obsoletes data: %d entries\n", n + 1); for (i = pool->nsolvables - 1; i > 0; i--) { s = pool->solvables + i; @@ -40,17 +40,17 @@ pool_create(void) Pool *pool; Solvable *s; - pool = (Pool *)sat_calloc(1, sizeof(*pool)); + pool = (Pool *)solv_calloc(1, sizeof(*pool)); stringpool_init (&pool->ss, initpool_data); /* alloc space for RelDep 0 */ - pool->rels = sat_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend_resize(0, 1, sizeof(Reldep), REL_BLOCK); pool->nrels = 1; memset(pool->rels, 0, sizeof(Reldep)); /* alloc space for Solvable 0 and system solvable */ - pool->solvables = sat_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend_resize(0, 2, sizeof(Solvable), SOLVABLE_BLOCK); pool->nsolvables = 2; memset(pool->solvables, 0, 2 * sizeof(Solvable)); s = pool->solvables + SYSTEMSOLVABLE; @@ -60,7 +60,7 @@ pool_create(void) queue_init(&pool->vendormap); - pool->debugmask = SAT_DEBUG_RESULT; /* FIXME */ + pool->debugmask = SOLV_DEBUG_RESULT; /* FIXME */ #ifdef FEDORA pool->obsoleteusescolors = 1; #endif @@ -87,19 +87,19 @@ pool_free(Pool *pool) pool_freewhatprovides(pool); pool_freeidhashes(pool); repo_freeallrepos(pool, 1); - sat_free(pool->id2arch); - sat_free(pool->solvables); + solv_free(pool->id2arch); + solv_free(pool->solvables); stringpool_free(&pool->ss); - sat_free(pool->rels); + solv_free(pool->rels); pool_setvendorclasses(pool, 0); queue_free(&pool->vendormap); for (i = 0; i < POOL_TMPSPACEBUF; i++) - sat_free(pool->tmpspace.buf[i]); + solv_free(pool->tmpspace.buf[i]); for (i = 0; i < pool->nlanguages; i++) free((char *)pool->languages[i]); - sat_free(pool->languages); - sat_free(pool->languagecache); - sat_free(pool); + solv_free(pool->languages); + solv_free(pool->languagecache); + solv_free(pool); } #ifdef MULTI_SEMANTICS @@ -113,7 +113,7 @@ pool_setdisttype(Pool *pool, int disttype) Id pool_add_solvable(Pool *pool) { - pool->solvables = sat_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend(pool->solvables, pool->nsolvables, 1, sizeof(Solvable), SOLVABLE_BLOCK); memset(pool->solvables + pool->nsolvables, 0, sizeof(Solvable)); return pool->nsolvables++; } @@ -124,7 +124,7 @@ pool_add_solvable_block(Pool *pool, int count) Id nsolvables = pool->nsolvables; if (!count) return nsolvables; - pool->solvables = sat_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK); + pool->solvables = solv_extend(pool->solvables, pool->nsolvables, count, sizeof(Solvable), SOLVABLE_BLOCK); memset(pool->solvables + nsolvables, 0, sizeof(Solvable) * count); pool->nsolvables += count; return nsolvables; @@ -195,10 +195,10 @@ pool_shrink_whatprovides(Pool *pool) if (pool->ss.nstrings < 3) return; - sorted = sat_malloc2(pool->ss.nstrings, sizeof(Id)); + sorted = solv_malloc2(pool->ss.nstrings, sizeof(Id)); for (id = 0; id < pool->ss.nstrings; id++) sorted[id] = id; - sat_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool); + solv_sort(sorted + 1, pool->ss.nstrings - 1, sizeof(Id), pool_shrink_whatprovides_sortcmp, pool); last = 0; lastid = 0; for (i = 1; i < pool->ss.nstrings; i++) @@ -228,7 +228,7 @@ pool_shrink_whatprovides(Pool *pool) last = pool->whatprovidesdata + o; lastid = id; } - sat_free(sorted); + solv_free(sorted); dp = pool->whatprovidesdata + 2; for (id = 1; id < pool->ss.nstrings; id++) { @@ -251,12 +251,12 @@ pool_shrink_whatprovides(Pool *pool) ; } o = dp - pool->whatprovidesdata; - POOL_DEBUG(SAT_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o); + POOL_DEBUG(SOLV_DEBUG_STATS, "shrunk whatprovidesdata from %d to %d\n", pool->whatprovidesdataoff, o); if (pool->whatprovidesdataoff == o) return; r = pool->whatprovidesdataoff - o; pool->whatprovidesdataoff = o; - pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id)); + pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (o + pool->whatprovidesdataleft) * sizeof(Id)); if (r > pool->whatprovidesdataleft) r = pool->whatprovidesdataleft; memset(pool->whatprovidesdata + o, 0, r * sizeof(Id)); @@ -282,15 +282,15 @@ pool_createwhatprovides(Pool *pool) Repo *installed = pool->installed; unsigned int now; - now = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels); + now = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "number of solvables: %d\n", pool->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "number of ids: %d + %d\n", pool->ss.nstrings, pool->nrels); pool_freeidhashes(pool); /* XXX: should not be here! */ pool_freewhatprovides(pool); num = pool->ss.nstrings; - pool->whatprovides = whatprovides = sat_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK); - pool->whatprovides_rel = sat_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK); + pool->whatprovides = whatprovides = solv_calloc_block(num, sizeof(Offset), WHATPROVIDES_BLOCK); + pool->whatprovides_rel = solv_calloc_block(pool->nrels, sizeof(Offset), WHATPROVIDES_BLOCK); /* count providers for each name */ for (i = pool->nsolvables - 1; i > 0; i--) @@ -327,17 +327,17 @@ pool_createwhatprovides(Pool *pool) np++; /* inc # of provider 'slots' for stats */ } - POOL_DEBUG(SAT_DEBUG_STATS, "provide ids: %d\n", np); + POOL_DEBUG(SOLV_DEBUG_STATS, "provide ids: %d\n", np); /* reserve some space for relation data */ extra = 2 * pool->nrels; if (extra < 256) extra = 256; - POOL_DEBUG(SAT_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra); + POOL_DEBUG(SOLV_DEBUG_STATS, "provide space needed: %d + %d\n", off, extra); /* alloc space for all providers + extra */ - whatprovidesdata = sat_calloc(off + extra, sizeof(Id)); + whatprovidesdata = solv_calloc(off + extra, sizeof(Id)); /* now fill data for all provides */ for (i = pool->nsolvables - 1; i > 0; i--) @@ -370,8 +370,8 @@ pool_createwhatprovides(Pool *pool) pool->whatprovidesdataoff = off; pool->whatprovidesdataleft = extra; pool_shrink_whatprovides(pool); - POOL_DEBUG(SAT_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id))); - POOL_DEBUG(SAT_DEBUG_STATS, "createwhatprovides took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "whatprovides memory used: %d K id array, %d K data\n", (pool->ss.nstrings + pool->nrels + WHATPROVIDES_BLOCK) / (int)(1024/sizeof(Id)), (pool->whatprovidesdataoff + pool->whatprovidesdataleft) / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "createwhatprovides took %d ms\n", solv_timems(now)); } /* @@ -382,9 +382,9 @@ pool_createwhatprovides(Pool *pool) void pool_freewhatprovides(Pool *pool) { - pool->whatprovides = sat_free(pool->whatprovides); - pool->whatprovides_rel = sat_free(pool->whatprovides_rel); - pool->whatprovidesdata = sat_free(pool->whatprovidesdata); + pool->whatprovides = solv_free(pool->whatprovides); + pool->whatprovides_rel = solv_free(pool->whatprovides_rel); + pool->whatprovidesdata = solv_free(pool->whatprovidesdata); pool->whatprovidesdataoff = 0; pool->whatprovidesdataleft = 0; } @@ -413,8 +413,8 @@ pool_queuetowhatprovides(Pool *pool, Queue *q) /* extend whatprovidesdata if needed, +1 for ID_NULL-termination */ if (pool->whatprovidesdataleft < count + 1) { - POOL_DEBUG(SAT_DEBUG_STATS, "growing provides hash data...\n"); - pool->whatprovidesdata = sat_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "growing provides hash data...\n"); + pool->whatprovidesdata = solv_realloc(pool->whatprovidesdata, (pool->whatprovidesdataoff + count + 4096) * sizeof(Id)); pool->whatprovidesdataleft = count + 4096; } @@ -685,7 +685,7 @@ pool_addrelproviders(Pool *pool, Id d) { /* simple version comparison relation */ #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name)); + POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: what provides %s?\n", pool_dep2str(pool, name)); #endif pp = pool_whatprovides_ptr(pool, name); while (ISRELDEP(name)) @@ -740,7 +740,7 @@ pool_addrelproviders(Pool *pool, Id d) } /* add providers to whatprovides */ #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d); + POOL_DEBUG(SOLV_DEBUG_STATS, "addrelproviders: adding %d packages to %d\n", plist.count, d); #endif pool->whatprovides_rel[d] = pool_queuetowhatprovides(pool, &plist); queue_free(&plist); @@ -756,7 +756,7 @@ pool_debug(Pool *pool, int type, const char *format, ...) va_list args; char buf[1024]; - if ((type & (SAT_FATAL|SAT_ERROR)) == 0) + if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0) { if ((pool->debugmask & type) == 0) return; @@ -764,7 +764,7 @@ pool_debug(Pool *pool, int type, const char *format, ...) va_start(args, format); if (!pool->debugcallback) { - if ((type & (SAT_FATAL|SAT_ERROR)) == 0 && !(pool->debugmask & SAT_DEBUG_TO_STDERR)) + if ((type & (SOLV_FATAL|SOLV_ERROR)) == 0 && !(pool->debugmask & SOLV_DEBUG_TO_STDERR)) vprintf(format, args); else vfprintf(stderr, format, args); @@ -777,16 +777,16 @@ pool_debug(Pool *pool, int type, const char *format, ...) void pool_setdebuglevel(Pool *pool, int level) { - int mask = SAT_DEBUG_RESULT; + int mask = SOLV_DEBUG_RESULT; if (level > 0) - mask |= SAT_DEBUG_STATS|SAT_DEBUG_ANALYZE|SAT_DEBUG_UNSOLVABLE|SAT_DEBUG_SOLVER|SAT_DEBUG_TRANSACTION; + mask |= SOLV_DEBUG_STATS|SOLV_DEBUG_ANALYZE|SOLV_DEBUG_UNSOLVABLE|SOLV_DEBUG_SOLVER|SOLV_DEBUG_TRANSACTION; if (level > 1) - mask |= SAT_DEBUG_JOB|SAT_DEBUG_SOLUTIONS|SAT_DEBUG_POLICY; + mask |= SOLV_DEBUG_JOB|SOLV_DEBUG_SOLUTIONS|SOLV_DEBUG_POLICY; if (level > 2) - mask |= SAT_DEBUG_PROPAGATE; + mask |= SOLV_DEBUG_PROPAGATE; if (level > 3) - mask |= SAT_DEBUG_RULE_CREATION; - mask |= pool->debugmask & SAT_DEBUG_TO_STDERR; /* keep bit */ + mask |= SOLV_DEBUG_RULE_CREATION; + mask |= pool->debugmask & SOLV_DEBUG_TO_STDERR; /* keep bit */ pool->debugmask = mask; } @@ -878,13 +878,13 @@ pool_addfileprovides_dep(Pool *pool, Id *ida, struct searchfiles *sf, struct sea s = pool_id2str(pool, dep); if (*s != '/') continue; - csf->ids = sat_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); - csf->dirs = sat_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); - csf->names = sat_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); + csf->ids = solv_extend(csf->ids, csf->nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); + csf->dirs = solv_extend(csf->dirs, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); + csf->names = solv_extend(csf->names, csf->nfiles, 1, sizeof(const char *), SEARCHFILES_BLOCK); csf->ids[csf->nfiles] = dep; sr = strrchr(s, '/'); csf->names[csf->nfiles] = strdup(sr + 1); - csf->dirs[csf->nfiles] = sat_malloc(sr - s + 1); + csf->dirs[csf->nfiles] = solv_malloc(sr - s + 1); if (sr != s) strncpy(csf->dirs[csf->nfiles], s, sr - s); csf->dirs[csf->nfiles][sr - s] = 0; @@ -962,7 +962,7 @@ pool_addfileprovides_search(Pool *pool, struct addfileprovides_cbdata *cbd, stru cbd->ids = sf->ids; cbd->dirs = sf->dirs; cbd->names = sf->names; - cbd->dids = sat_realloc2(cbd->dids, sf->nfiles, sizeof(Id)); + cbd->dids = solv_realloc2(cbd->dids, sf->nfiles, sizeof(Id)); map_init(&cbd->providedids, pool->ss.nstrings); repoid = 0; @@ -1077,7 +1077,7 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) int i; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); memset(&sf, 0, sizeof(sf)); map_init(&sf.seen, pool->ss.nstrings + pool->nrels); memset(&isf, 0, sizeof(isf)); @@ -1106,7 +1106,7 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) } map_free(&sf.seen); map_free(&isf.seen); - POOL_DEBUG(SAT_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles); + POOL_DEBUG(SOLV_DEBUG_STATS, "found %d file dependencies, %d installed file dependencies\n", sf.nfiles, isf.nfiles); cbd.dids = 0; if (idp) *idp = 0; @@ -1114,45 +1114,45 @@ pool_addfileprovides_ids(Pool *pool, Repo *installed, Id **idp) { #if 0 for (i = 0; i < sf.nfiles; i++) - POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i])); + POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in filelist\n", pool_id2str(pool, sf.ids[i])); #endif pool_addfileprovides_search(pool, &cbd, &sf, 0); if (idp) { - sf.ids = sat_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); + sf.ids = solv_extend(sf.ids, sf.nfiles, 1, sizeof(Id), SEARCHFILES_BLOCK); sf.ids[sf.nfiles] = 0; *idp = sf.ids; sf.ids = 0; } - sat_free(sf.ids); + solv_free(sf.ids); for (i = 0; i < sf.nfiles; i++) { - sat_free(sf.dirs[i]); - sat_free(sf.names[i]); + solv_free(sf.dirs[i]); + solv_free(sf.names[i]); } - sat_free(sf.dirs); - sat_free(sf.names); + solv_free(sf.dirs); + solv_free(sf.names); } if (isf.nfiles) { #if 0 for (i = 0; i < isf.nfiles; i++) - POOL_DEBUG(SAT_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i])); + POOL_DEBUG(SOLV_DEBUG_STATS, "looking up %s in installed filelist\n", pool_id2str(pool, isf.ids[i])); #endif if (installed) pool_addfileprovides_search(pool, &cbd, &isf, installed); - sat_free(isf.ids); + solv_free(isf.ids); for (i = 0; i < isf.nfiles; i++) { - sat_free(isf.dirs[i]); - sat_free(isf.names[i]); + solv_free(isf.dirs[i]); + solv_free(isf.names[i]); } - sat_free(isf.dirs); - sat_free(isf.names); + solv_free(isf.dirs); + solv_free(isf.names); } - sat_free(cbd.dids); + solv_free(cbd.dids); pool_freewhatprovides(pool); /* as we have added provides */ - POOL_DEBUG(SAT_DEBUG_STATS, "addfileprovides took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "addfileprovides took %d ms\n", solv_timems(now)); } void @@ -1188,7 +1188,7 @@ pool_set_languages(Pool *pool, const char **languages, int nlanguages) { int i; - pool->languagecache = sat_free(pool->languagecache); + pool->languagecache = solv_free(pool->languagecache); pool->languagecacheother = 0; if (pool->nlanguages) { @@ -1199,7 +1199,7 @@ pool_set_languages(Pool *pool, const char **languages, int nlanguages) pool->nlanguages = nlanguages; if (!nlanguages) return; - pool->languages = sat_calloc(nlanguages, sizeof(const char **)); + pool->languages = solv_calloc(nlanguages, sizeof(const char **)); for (i = 0; i < pool->nlanguages; i++) pool->languages[i] = strdup(languages[i]); } @@ -1216,7 +1216,7 @@ pool_id2langid(Pool *pool, Id id, const char *lang, int create) n = pool_id2str(pool, id); l = strlen(n) + strlen(lang) + 2; if (l > sizeof(buf)) - p = sat_malloc(strlen(n) + strlen(lang) + 2); + p = solv_malloc(strlen(n) + strlen(lang) + 2); else p = buf; sprintf(p, "%s:%s", n, lang); @@ -1234,7 +1234,7 @@ pool_alloctmpspace(Pool *pool, int len) return 0; if (len > pool->tmpspace.len[n]) { - pool->tmpspace.buf[n] = sat_realloc(pool->tmpspace.buf[n], len + 32); + pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32); pool->tmpspace.len[n] = len + 32; } pool->tmpspace.n = (n + 1) % POOL_TMPSPACEBUF; @@ -1258,7 +1258,7 @@ pool_alloctmpspace_free(Pool *pool, const char *space, int len) continue; if (len > pool->tmpspace.len[n]) { - pool->tmpspace.buf[n] = sat_realloc(pool->tmpspace.buf[n], len + 32); + pool->tmpspace.buf[n] = solv_realloc(pool->tmpspace.buf[n], len + 32); pool->tmpspace.len[n] = len + 32; } return pool->tmpspace.buf[n]; @@ -1348,7 +1348,7 @@ pool_bin2hex(Pool *pool, const unsigned char *buf, int len) if (!len) return ""; s = pool_alloctmpspace(pool, 2 * len + 1); - sat_bin2hex(buf, len, s); + solv_bin2hex(buf, len, s); return s; } @@ -1388,9 +1388,9 @@ solver_fill_DU_cb(void *cbdata, Solvable *s, Repodata *data, Repokey *key, KeyVa struct mptree *mptree; /* create map from dir to mptree */ - cbd->dirmap = sat_free(cbd->dirmap); + cbd->dirmap = solv_free(cbd->dirmap); cbd->nmap = 0; - dirmap = sat_calloc(data->dirpool.ndirs, sizeof(Id)); + dirmap = solv_calloc(data->dirpool.ndirs, sizeof(Id)); mptree = cbd->mptree; mp = 0; for (dn = 2, dirs = data->dirpool.dirs + dn; dn < data->dirpool.ndirs; dn++) @@ -1487,7 +1487,7 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) cbd.nmap = 0; cbd.olddata = 0; - mptree = sat_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK); + mptree = solv_extend_resize(0, 1, sizeof(struct mptree), MPTREE_BLOCK); /* our root node */ mptree[0].sibling = 0; @@ -1528,7 +1528,7 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) if (!i) { /* create new node */ - mptree = sat_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK); + mptree = solv_extend(mptree, nmptree, 1, sizeof(struct mptree), MPTREE_BLOCK); i = nmptree++; mptree[i].sibling = mptree[pos].child; mptree[i].child = 0; @@ -1600,8 +1600,8 @@ pool_calc_duchanges(Pool *pool, Map *installedmap, DUChanges *mps, int nmps) } if (ignoredu.map) map_free(&ignoredu); - sat_free(cbd.dirmap); - sat_free(mptree); + solv_free(cbd.dirmap); + solv_free(mptree); } int @@ -1707,7 +1707,7 @@ pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pk unsigned char *map; Solvable *s; - map = sat_calloc(pool->nsolvables, 1); + map = solv_calloc(pool->nsolvables, 1); for (p = 1; p < pool->nsolvables; p++) { if (!MAPTST(installedmap, p)) @@ -19,7 +19,7 @@ extern "C" { #include <stdio.h> -#include "satversion.h" +#include "solvversion.h" #include "pooltypes.h" #include "poolid.h" #include "solvable.h" @@ -139,22 +139,22 @@ struct _Pool { # define DISTTYPE_DEB 1 #endif -#define SAT_FATAL (1<<0) -#define SAT_ERROR (1<<1) -#define SAT_WARN (1<<2) -#define SAT_DEBUG_STATS (1<<3) -#define SAT_DEBUG_RULE_CREATION (1<<4) -#define SAT_DEBUG_PROPAGATE (1<<5) -#define SAT_DEBUG_ANALYZE (1<<6) -#define SAT_DEBUG_UNSOLVABLE (1<<7) -#define SAT_DEBUG_SOLUTIONS (1<<8) -#define SAT_DEBUG_POLICY (1<<9) -#define SAT_DEBUG_RESULT (1<<10) -#define SAT_DEBUG_JOB (1<<11) -#define SAT_DEBUG_SOLVER (1<<12) -#define SAT_DEBUG_TRANSACTION (1<<13) - -#define SAT_DEBUG_TO_STDERR (1<<30) +#define SOLV_FATAL (1<<0) +#define SOLV_ERROR (1<<1) +#define SOLV_WARN (1<<2) +#define SOLV_DEBUG_STATS (1<<3) +#define SOLV_DEBUG_RULE_CREATION (1<<4) +#define SOLV_DEBUG_PROPAGATE (1<<5) +#define SOLV_DEBUG_ANALYZE (1<<6) +#define SOLV_DEBUG_UNSOLVABLE (1<<7) +#define SOLV_DEBUG_SOLUTIONS (1<<8) +#define SOLV_DEBUG_POLICY (1<<9) +#define SOLV_DEBUG_RESULT (1<<10) +#define SOLV_DEBUG_JOB (1<<11) +#define SOLV_DEBUG_SOLVER (1<<12) +#define SOLV_DEBUG_TRANSACTION (1<<13) + +#define SOLV_DEBUG_TO_STDERR (1<<30) //----------------------------------------------- diff --git a/src/poolarch.c b/src/poolarch.c index 12fd202..d39cecb 100644 --- a/src/poolarch.c +++ b/src/poolarch.c @@ -90,8 +90,8 @@ pool_setarchpolicy(Pool *pool, const char *arch) Id *id2arch; Id id, lastarch; - pool->id2arch = sat_free(pool->id2arch); - pool->id2color = sat_free(pool->id2color); + pool->id2arch = solv_free(pool->id2arch); + pool->id2color = solv_free(pool->id2color); if (!arch) { pool->lastarch = 0; @@ -103,7 +103,7 @@ pool_setarchpolicy(Pool *pool, const char *arch) id = ARCH_ALL; #endif lastarch = id + 255; - id2arch = sat_calloc(lastarch + 1, sizeof(Id)); + id2arch = solv_calloc(lastarch + 1, sizeof(Id)); id2arch[id] = 1; /* the "noarch" class */ d = 0; @@ -115,7 +115,7 @@ pool_setarchpolicy(Pool *pool, const char *arch) id = pool_strn2id(pool, arch, l, 1); if (id > lastarch) { - id2arch = sat_realloc2(id2arch, (id + 255 + 1), sizeof(Id)); + id2arch = solv_realloc2(id2arch, (id + 255 + 1), sizeof(Id)); memset(id2arch + lastarch + 1, 0, (id + 255 - lastarch) * sizeof(Id)); lastarch = id + 255; } @@ -145,7 +145,7 @@ pool_arch2color_slow(Pool *pool, Id arch) if (arch > pool->lastarch) return ARCHCOLOR_ALL; if (!pool->id2color) - pool->id2color = sat_calloc(pool->lastarch + 1, 1); + pool->id2color = solv_calloc(pool->lastarch + 1, 1); s = pool_id2str(pool, arch); if (arch == ARCH_NOARCH || arch == ARCH_ALL) color = ARCHCOLOR_ALL; diff --git a/src/poolid.c b/src/poolid.c index d5f6bb2..bf8d18b 100644 --- a/src/poolid.c +++ b/src/poolid.c @@ -31,7 +31,7 @@ pool_str2id(Pool *pool, const char *str, int create) if (create && pool->whatprovides && oldnstrings != pool->ss.nstrings && (id & WHATPROVIDES_BLOCK) == 0) { /* grow whatprovides array */ - pool->whatprovides = sat_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); + pool->whatprovides = solv_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); memset(pool->whatprovides + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return id; @@ -45,7 +45,7 @@ pool_strn2id(Pool *pool, const char *str, unsigned int len, int create) if (create && pool->whatprovides && oldnstrings != pool->ss.nstrings && (id & WHATPROVIDES_BLOCK) == 0) { /* grow whatprovides array */ - pool->whatprovides = sat_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); + pool->whatprovides = solv_realloc(pool->whatprovides, (id + (WHATPROVIDES_BLOCK + 1)) * sizeof(Offset)); memset(pool->whatprovides + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return id; @@ -69,9 +69,9 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) /* extend hashtable if needed */ if (pool->nrels * 2 > hashmask) { - sat_free(pool->relhashtbl); + solv_free(pool->relhashtbl); pool->relhashmask = hashmask = mkmask(pool->nrels + REL_BLOCK); - pool->relhashtbl = hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + pool->relhashtbl = hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); // rehash all rels into new hashtable for (i = 1; i < pool->nrels; i++) { @@ -100,7 +100,7 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) id = pool->nrels++; /* extend rel space if needed */ - pool->rels = sat_extend(pool->rels, id, 1, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend(pool->rels, id, 1, sizeof(Reldep), REL_BLOCK); hashtbl[h] = id; ran = pool->rels + id; ran->name = name; @@ -110,7 +110,7 @@ pool_rel2id(Pool *pool, Id name, Id evr, int flags, int create) /* extend whatprovides_rel if needed */ if (pool->whatprovides_rel && (id & WHATPROVIDES_BLOCK) == 0) { - pool->whatprovides_rel = sat_realloc2(pool->whatprovides_rel, id + (WHATPROVIDES_BLOCK + 1), sizeof(Offset)); + pool->whatprovides_rel = solv_realloc2(pool->whatprovides_rel, id + (WHATPROVIDES_BLOCK + 1), sizeof(Offset)); memset(pool->whatprovides_rel + id, 0, (WHATPROVIDES_BLOCK + 1) * sizeof(Offset)); } return MAKERELDEP(id); @@ -275,7 +275,7 @@ pool_shrink_strings(Pool *pool) void pool_shrink_rels(Pool *pool) { - pool->rels = sat_extend_resize(pool->rels, pool->nrels, sizeof(Reldep), REL_BLOCK); + pool->rels = solv_extend_resize(pool->rels, pool->nrels, sizeof(Reldep), REL_BLOCK); } // reset all hash tables @@ -284,7 +284,7 @@ void pool_freeidhashes(Pool *pool) { stringpool_freehash(&pool->ss); - pool->relhashtbl = sat_free(pool->relhashtbl); + pool->relhashtbl = solv_free(pool->relhashtbl); pool->relhashmask = 0; } diff --git a/src/poolvendor.c b/src/poolvendor.c index 04180b9..f621f50 100644 --- a/src/poolvendor.c +++ b/src/poolvendor.c @@ -88,14 +88,14 @@ pool_setvendorclasses(Pool *pool, const char **vendorclasses) if (pool->vendorclasses) { for (v = pool->vendorclasses; v[0] || v[1]; v++) - sat_free((void *)*v); - pool->vendorclasses = sat_free(pool->vendorclasses); + solv_free((void *)*v); + pool->vendorclasses = solv_free(pool->vendorclasses); } if (!vendorclasses || !vendorclasses[0]) return; for (v = vendorclasses; v[0] || v[1]; v++) ; - pool->vendorclasses = sat_calloc(v - vendorclasses + 2, sizeof(const char *)); + pool->vendorclasses = solv_calloc(v - vendorclasses + 2, sizeof(const char *)); for (v = vendorclasses, i = 0; v[0] || v[1]; v++, i++) pool->vendorclasses[i] = *v ? strdup(*v) : 0; pool->vendorclasses[i++] = 0; diff --git a/src/problems.c b/src/problems.c index 14e64b9..1d9689c 100644 --- a/src/problems.c +++ b/src/problems.c @@ -183,13 +183,13 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti Queue disabled; int disabledcnt; - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion start\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "refine_suggestion start\n"); for (i = 0; problem[i]; i++) { if (problem[i] == sug) - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "=> "); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "=> "); solver_printproblem(solv, problem[i]); } } @@ -229,7 +229,7 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti if (!solv->problems.count) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no more problems!\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "no more problems!\n"); break; /* great, no more problems */ } disabledcnt = disabled.count; @@ -261,14 +261,14 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti if (disabled.count == disabledcnt) { /* no solution found, this was an invalid suggestion! */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "no solution found!\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "no solution found!\n"); refined->count = 0; break; } if (!njob && nupdate && nfeature) { /* got only update rules, filter out feature rules */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "throwing away feature rules\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "throwing away feature rules\n"); for (i = j = disabledcnt; i < disabled.count; i++) { v = disabled.elements[i]; @@ -300,9 +300,9 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti /* do not push anything on refine list, as we do not know which solution to choose */ /* thus, the user will get another problem if he selects this solution, where he * can choose the right one */ - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "more than one solution found:\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "more than one solution found:\n"); for (i = disabledcnt; i < disabled.count; i++) solver_printproblem(solv, disabled.elements[i]); } @@ -331,7 +331,7 @@ refine_suggestion(Solver *solv, Id *problem, Id sug, Queue *refined, int essenti /* disable problem rules again */ for (i = 0; problem[i]; i++) solver_disableproblem(solv, problem[i]); - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "refine_suggestion end\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "refine_suggestion end\n"); } @@ -516,7 +516,7 @@ create_solutions(Solver *solv, int probnr, int solidx) int recocount; unsigned int now; - now = sat_timems(0); + now = solv_timems(0); recocount = solv->recommendations.count; solv->recommendations.count = 0; /* so that revert() doesn't mess with it later */ queue_init(&redoq); @@ -542,7 +542,7 @@ create_solutions(Solver *solv, int probnr, int solidx) queue_push(&problem, v); } if (problem.count > 1) - sat_sort(problem.elements, problem.count, sizeof(Id), problems_sortcmp, &solv->job); + solv_sort(problem.elements, problem.count, sizeof(Id), problems_sortcmp, &solv->job); queue_push(&problem, 0); /* mark end for refine_suggestion */ problem.count--; #if 0 @@ -569,14 +569,14 @@ create_solutions(Solver *solv, int probnr, int solidx) if (!essentialok) { /* nothing found, start over */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "nothing found, re-run with essentialok = 1\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "nothing found, re-run with essentialok = 1\n"); essentialok = 1; i = -1; continue; } /* this is bad, we found no solution */ /* for now just offer a rule */ - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "nothing found, already did essentialok, fake it\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "nothing found, already did essentialok, fake it\n"); queue_push(&solv->solutions, 0); for (j = 0; j < problem.count; j++) { @@ -619,7 +619,7 @@ create_solutions(Solver *solv, int probnr, int solidx) /* restore problems */ queue_free(&solv->problems); solv->problems = problems_save; - POOL_DEBUG(SAT_DEBUG_STATS, "create_solutions for problem #%d took %d ms\n", probnr, sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "create_solutions for problem #%d took %d ms\n", probnr, solv_timems(now)); } diff --git a/src/qsort_r.c b/src/qsort_r.c index 7911ec5..c4bc6d2 100644 --- a/src/qsort_r.c +++ b/src/qsort_r.c @@ -96,7 +96,7 @@ med3(char *a, char *b, char *c, cmp_t *cmp, void *thunk) } void -sat_sort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) +solv_sort(void *a, size_t n, size_t es, cmp_t *cmp, void *thunk) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; size_t d, r; @@ -168,7 +168,7 @@ loop: SWAPINIT(a, es); r = min(pd - pc, pn - pd - es); vecswap(pb, pn - r, r); if ((r = pb - pa) > es) - sat_sort(a, r / es, es, cmp, thunk); + solv_sort(a, r / es, es, cmp, thunk); if ((r = pd - pc) > es) { /* Iterate rather than recurse to save stack space */ a = pn - r; diff --git a/src/queue.c b/src/queue.c index d22c382..4fe0799 100644 --- a/src/queue.c +++ b/src/queue.c @@ -35,7 +35,7 @@ queue_init_clone(Queue *t, Queue *s) t->count = t->left = 0; return; } - t->alloc = t->elements = sat_malloc2(s->count + EXTRA_SPACE, sizeof(Id)); + t->alloc = t->elements = solv_malloc2(s->count + EXTRA_SPACE, sizeof(Id)); if (s->count) memcpy(t->alloc, s->elements, s->count * sizeof(Id)); t->count = s->count; @@ -55,7 +55,7 @@ void queue_free(Queue *q) { if (q->alloc) - sat_free(q->alloc); + solv_free(q->alloc); q->alloc = q->elements = 0; q->count = q->left = 0; } @@ -65,7 +65,7 @@ queue_alloc_one(Queue *q) { if (!q->alloc) { - q->alloc = sat_malloc2(q->count + EXTRA_SPACE, sizeof(Id)); + q->alloc = solv_malloc2(q->count + EXTRA_SPACE, sizeof(Id)); if (q->count) memcpy(q->alloc, q->elements, q->count * sizeof(Id)); q->elements = q->alloc; @@ -81,7 +81,7 @@ queue_alloc_one(Queue *q) } else { - q->elements = q->alloc = sat_realloc2(q->alloc, q->count + EXTRA_SPACE, sizeof(Id)); + q->elements = q->alloc = solv_realloc2(q->alloc, q->count + EXTRA_SPACE, sizeof(Id)); q->left = EXTRA_SPACE; } } @@ -165,7 +165,7 @@ queue_insertn(Queue *q, int pos, int n) if (!q->alloc) queue_alloc_one(q); off = q->elements - q->alloc; - q->alloc = sat_realloc2(q->alloc, off + q->count + n + EXTRA_SPACE, sizeof(Id)); + q->alloc = solv_realloc2(q->alloc, off + q->count + n + EXTRA_SPACE, sizeof(Id)); q->elements = q->alloc + off; q->left = n + EXTRA_SPACE; } @@ -41,8 +41,8 @@ repo_create(Pool *pool, const char *name) Repo *repo; pool_freewhatprovides(pool); - repo = (Repo *)sat_calloc(1, sizeof(*repo)); - pool->repos = (Repo **)sat_realloc2(pool->repos, pool->nrepos + 1, sizeof(Repo *)); + repo = (Repo *)solv_calloc(1, sizeof(*repo)); + pool->repos = (Repo **)solv_realloc2(pool->repos, pool->nrepos + 1, sizeof(Repo *)); pool->repos[pool->nrepos++] = repo; repo->repoid = pool->nrepos; repo->name = name ? strdup(name) : 0; @@ -59,11 +59,11 @@ repo_freedata(Repo *repo) int i; for (i = 0; i < repo->nrepodata; i++) repodata_freedata(repo->repodata + i); - sat_free(repo->repodata); - sat_free(repo->idarraydata); - sat_free(repo->rpmdbid); - sat_free((char *)repo->name); - sat_free(repo); + solv_free(repo->repodata); + solv_free(repo->idarraydata); + solv_free(repo->rpmdbid); + solv_free((char *)repo->name); + solv_free(repo); } /* delete all solvables and repodata blocks from this repo */ @@ -92,13 +92,13 @@ repo_empty(Repo *repo, int reuseids) repo->nsolvables = 0; /* free all data belonging to this repo */ - repo->idarraydata = sat_free(repo->idarraydata); + repo->idarraydata = solv_free(repo->idarraydata); repo->idarraysize = 0; repo->lastoff = 0; - repo->rpmdbid = sat_free(repo->rpmdbid); + repo->rpmdbid = solv_free(repo->rpmdbid); for (i = 0; i < repo->nrepodata; i++) repodata_freedata(repo->repodata + i); - sat_free(repo->repodata); + solv_free(repo->repodata); repo->repodata = 0; repo->nrepodata = 0; } @@ -141,7 +141,7 @@ repo_freeallrepos(Pool *pool, int reuseids) pool_freewhatprovides(pool); for (i = 0; i < pool->nrepos; i++) repo_freedata(pool->repos[i]); - pool->repos = sat_free(pool->repos); + pool->repos = solv_free(pool->repos); pool->nrepos = 0; /* the first two solvables don't belong to a repo */ pool_free_solvable_block(pool, 2, pool->nsolvables - 2, reuseids); @@ -220,7 +220,7 @@ void repo_free_solvable_block(Repo *repo, Id start, int count, int reuseids) void * repo_sidedata_create(Repo *repo, size_t size) { - return sat_calloc_block(repo->end - repo->start, size, REPO_SIDEDATA_BLOCK); + return solv_calloc_block(repo->end - repo->start, size, REPO_SIDEDATA_BLOCK); } void * @@ -230,7 +230,7 @@ repo_sidedata_extend(Repo *repo, void *b, size_t size, Id p, int count) if (p < repo->start) { int d = repo->start - p; - b = sat_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); + b = solv_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); memmove((char *)b + d * size, b, n * size); memset(b, 0, d * size); n += d; @@ -238,7 +238,7 @@ repo_sidedata_extend(Repo *repo, void *b, size_t size, Id p, int count) if (p + count > repo->end) { int d = p + count - repo->end; - b = sat_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); + b = solv_extend(b, n, d, size, REPO_SIDEDATA_BLOCK); memset((char *)b + n * size, 0, d * size); } return b; @@ -263,7 +263,7 @@ repo_addid(Repo *repo, Offset olddeps, Id id) if (!idarray) /* alloc idarray if not done yet */ { idarraysize = 1; - idarray = sat_extend_resize(0, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend_resize(0, 1, sizeof(Id), IDARRAY_BLOCK); idarray[0] = 0; repo->lastoff = 0; } @@ -271,7 +271,7 @@ repo_addid(Repo *repo, Offset olddeps, Id id) if (!olddeps) /* no deps yet */ { olddeps = idarraysize; - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); } else if (olddeps == repo->lastoff) /* extend at end */ idarraysize--; @@ -281,14 +281,14 @@ repo_addid(Repo *repo, Offset olddeps, Id id) olddeps = idarraysize; for (; idarray[i]; i++) { - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); idarray[idarraysize++] = idarray[i]; } - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); } idarray[idarraysize++] = id; /* insert Id into array */ - idarray = sat_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); + idarray = solv_extend(idarray, idarraysize, 1, sizeof(Id), IDARRAY_BLOCK); idarray[idarraysize++] = 0; /* ensure NULL termination */ repo->idarraydata = idarray; @@ -400,7 +400,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) if (!repo->idarraysize) /* ensure buffer space */ { repo->idarraysize = 1; - repo->idarraydata = sat_extend_resize(0, 1 + num, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend_resize(0, 1 + num, sizeof(Id), IDARRAY_BLOCK); repo->idarraydata[0] = 0; repo->lastoff = 1; return 1; @@ -420,7 +420,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) ; count = idend - idstart - 1 + num; /* new size */ - repo->idarraydata = sat_extend(repo->idarraydata, repo->idarraysize, count, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend(repo->idarraydata, repo->idarraysize, count, sizeof(Id), IDARRAY_BLOCK); /* move old deps to end */ olddeps = repo->lastoff = repo->idarraysize; memcpy(repo->idarraydata + olddeps, idstart, count - num); @@ -433,7 +433,7 @@ repo_reserve_ids(Repo *repo, Offset olddeps, int num) repo->idarraysize--; /* make room*/ - repo->idarraydata = sat_extend(repo->idarraydata, repo->idarraysize, num, sizeof(Id), IDARRAY_BLOCK); + repo->idarraydata = solv_extend(repo->idarraydata, repo->idarraysize, num, sizeof(Id), IDARRAY_BLOCK); /* appending or new */ repo->lastoff = olddeps ? olddeps : repo->idarraysize; @@ -1093,7 +1093,7 @@ const char * repo_lookup_checksum(Repo *repo, Id entry, Id keyname, Id *typep) { const unsigned char *chk = repo_lookup_bin_checksum(repo, entry, keyname, typep); - return chk ? pool_bin2hex(repo->pool, chk, sat_chksum_len(*typep)) : 0; + return chk ? pool_bin2hex(repo->pool, chk, solv_chksum_len(*typep)) : 0; } int diff --git a/src/repo_solv.c b/src/repo_solv.c index a3ea500..6c21584 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -64,7 +64,7 @@ read_u32(Repodata *data) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -88,7 +88,7 @@ read_u8(Repodata *data) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -113,7 +113,7 @@ read_id(Repodata *data, Id max) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -122,7 +122,7 @@ read_id(Repodata *data, Id max) x = (x << 7) | c; if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "read_id: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "read_id: id too large (%u/%u)\n", x, max); data->error = SOLV_ERROR_ID_RANGE; return 0; } @@ -130,7 +130,7 @@ read_id(Repodata *data, Id max) } x = (x << 7) ^ c ^ 128; } - pool_debug(mypool, SAT_ERROR, "read_id: id too long\n"); + pool_debug(mypool, SOLV_ERROR, "read_id: id too long\n"); data->error = SOLV_ERROR_CORRUPT; return 0; } @@ -149,7 +149,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) c = getc(data->fp); if (c == EOF) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data->error = SOLV_ERROR_EOF; return 0; } @@ -161,7 +161,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) x = (x << 6) | (c & 63); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "read_idarray: id too large (%u/%u)\n", x, max); data->error = SOLV_ERROR_ID_RANGE; return 0; } @@ -169,7 +169,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) x = map[x]; if (store == end) { - pool_debug(mypool, SAT_ERROR, "read_idarray: array overflow\n"); + pool_debug(mypool, SOLV_ERROR, "read_idarray: array overflow\n"); return 0; } *store++ = x; @@ -179,7 +179,7 @@ read_idarray(Repodata *data, Id max, Id *map, Id *store, Id *end) return store; if (store == end) { - pool_debug(mypool, SAT_ERROR, "read_idarray: array overflow\n"); + pool_debug(mypool, SOLV_ERROR, "read_idarray: array overflow\n"); data->error = SOLV_ERROR_OVERFLOW; return 0; } @@ -206,7 +206,7 @@ data_read_id_max(unsigned char *dp, Id *ret, Id *map, int max, int *error) dp = data_read_id(dp, &x); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; x = 0; } @@ -232,7 +232,7 @@ data_read_idarray(unsigned char *dp, Id **storep, Id *map, int max, int *error) x = (x << 6) | (c & 63); if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; break; } @@ -276,7 +276,7 @@ data_read_rel_idarray(unsigned char *dp, Id **storep, Id *map, int max, int *err old = x; if (max && x >= max) { - pool_debug(mypool, SAT_ERROR, "data_read_rel_idarray: id too large (%u/%u)\n", x, max); + pool_debug(mypool, SOLV_ERROR, "data_read_rel_idarray: id too large (%u/%u)\n", x, max); *error = SOLV_ERROR_ID_RANGE; break; } @@ -307,7 +307,7 @@ incore_add_id(Repodata *data, Id x) /* make sure we have at least 5 bytes free */ if (data->incoredatafree < 5) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); data->incoredatafree = INCORE_ADD_CHUNK; } dp = data->incoredata + data->incoredatalen; @@ -333,7 +333,7 @@ incore_add_blob(Repodata *data, unsigned char *buf, int len) { if (data->incoredatafree < len) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK + len); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK + len); data->incoredatafree = INCORE_ADD_CHUNK + len; } memcpy(data->incoredata + data->incoredatalen, buf, len); @@ -354,7 +354,7 @@ incore_map_idarray(Repodata *data, unsigned char *dp, Id *map, Id max) dp = data_read_ideof(dp, &id, &eof); if (max && id >= max) { - pool_debug(mypool, SAT_ERROR, "incore_map_idarray: id too large (%u/%u)\n", id, max); + pool_debug(mypool, SOLV_ERROR, "incore_map_idarray: id too large (%u/%u)\n", id, max); data->error = SOLV_ERROR_ID_RANGE; break; } @@ -374,7 +374,7 @@ incore_add_u32(Repodata *data, unsigned int x) /* make sure we have at least 4 bytes free */ if (data->incoredatafree < 4) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + INCORE_ADD_CHUNK); data->incoredatafree = INCORE_ADD_CHUNK; } dp = data->incoredata + data->incoredatalen; @@ -394,7 +394,7 @@ incore_add_u8(Repodata *data, unsigned int x) /* make sure we have at least 1 byte free */ if (data->incoredatafree < 1) { - data->incoredata = sat_realloc(data->incoredata, data->incoredatalen + 1024); + data->incoredata = solv_realloc(data->incoredata, data->incoredatalen + 1024); data->incoredatafree = 1024; } dp = data->incoredata + data->incoredatalen; @@ -456,7 +456,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) Repodata *parent = 0; Repodata data; - now = sat_timems(0); + now = solv_timems(0); if ((flags & REPO_USE_LOADING) != 0) { @@ -475,7 +475,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (read_u32(&data) != ('S' << 24 | 'O' << 16 | 'L' << 8 | 'V')) { - pool_debug(pool, SAT_ERROR, "not a SOLV file\n"); + pool_debug(pool, SOLV_ERROR, "not a SOLV file\n"); return SOLV_ERROR_NOT_SOLV; } solvversion = read_u32(&data); @@ -484,7 +484,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) case SOLV_VERSION_8: break; default: - pool_debug(pool, SAT_ERROR, "unsupported SOLV version\n"); + pool_debug(pool, SOLV_ERROR, "unsupported SOLV version\n"); return SOLV_ERROR_UNSUPPORTED; } @@ -500,13 +500,13 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (numdir && numdir < 2) { - pool_debug(pool, SAT_ERROR, "bad number of dirs\n"); + pool_debug(pool, SOLV_ERROR, "bad number of dirs\n"); return SOLV_ERROR_CORRUPT; } if (numrel && (flags & REPO_LOCALPOOL) != 0) { - pool_debug(pool, SAT_ERROR, "relations are forbidden in a local pool\n"); + pool_debug(pool, SOLV_ERROR, "relations are forbidden in a local pool\n"); return SOLV_ERROR_CORRUPT; } if (parent && numsolv) @@ -514,13 +514,13 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* make sure that we exactly replace the stub repodata */ if (parent->end - parent->start != numsolv) { - pool_debug(pool, SAT_ERROR, "sub-repository solvable number does not match main repository (%d - %d)\n", parent->end - parent->start, numsolv); + pool_debug(pool, SOLV_ERROR, "sub-repository solvable number does not match main repository (%d - %d)\n", parent->end - parent->start, numsolv); return SOLV_ERROR_CORRUPT; } for (i = 0; i < numsolv; i++) if (pool->solvables[parent->start + i].repo != repo) { - pool_debug(pool, SAT_ERROR, "main repository contains holes\n"); + pool_debug(pool, SOLV_ERROR, "main repository contains holes\n"); return SOLV_ERROR_CORRUPT; } } @@ -545,16 +545,16 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { data.localpool = 1; spool = &data.spool; - spool->stringspace = sat_malloc(7); + spool->stringspace = solv_malloc(7); strcpy(spool->stringspace, "<NULL>"); spool->sstrings = 7; spool->nstrings = 0; } /* alloc string buffer */ - spool->stringspace = sat_realloc(spool->stringspace, spool->sstrings + sizeid + 1); + spool->stringspace = solv_realloc(spool->stringspace, spool->sstrings + sizeid + 1); /* alloc string offsets (Id -> Offset into string space) */ - spool->strings = sat_realloc2(spool->strings, spool->nstrings + numid, sizeof(Offset)); + spool->strings = solv_realloc2(spool->strings, spool->nstrings + numid, sizeof(Offset)); strsp = spool->stringspace; str = spool->strings; /* array of offsets into strsp, indexed by Id */ @@ -571,14 +571,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { if (sizeid && fread(strsp, sizeid, 1, fp) != 1) { - pool_debug(pool, SAT_ERROR, "read error while reading strings\n"); + pool_debug(pool, SOLV_ERROR, "read error while reading strings\n"); return SOLV_ERROR_EOF; } } else { unsigned int pfsize = read_u32(&data); - char *prefix = sat_malloc(pfsize); + char *prefix = solv_malloc(pfsize); char *pp = prefix; char *old_str = 0; char *dest = strsp; @@ -586,8 +586,8 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (pfsize && fread(prefix, pfsize, 1, fp) != 1) { - pool_debug(pool, SAT_ERROR, "read error while reading strings\n"); - sat_free(prefix); + pool_debug(pool, SOLV_ERROR, "read error while reading strings\n"); + solv_free(prefix); return SOLV_ERROR_EOF; } for (i = 1; i < numid; i++) @@ -597,8 +597,8 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) freesp -= same + len; if (freesp < 0) { - pool_debug(pool, SAT_ERROR, "overflow while expanding strings\n"); - sat_free(prefix); + pool_debug(pool, SOLV_ERROR, "overflow while expanding strings\n"); + solv_free(prefix); return SOLV_ERROR_OVERFLOW; } if (same) @@ -608,10 +608,10 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) old_str = dest; dest += same + len; } - sat_free(prefix); + solv_free(prefix); if (freesp != 0) { - pool_debug(pool, SAT_ERROR, "expanding strings size mismatch\n"); + pool_debug(pool, SOLV_ERROR, "expanding strings size mismatch\n"); return SOLV_ERROR_CORRUPT; } } @@ -627,14 +627,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (*sp) { /* we need the '' for directories */ - pool_debug(pool, SAT_ERROR, "store strings don't start with ''\n"); + pool_debug(pool, SOLV_ERROR, "store strings don't start with ''\n"); return SOLV_ERROR_CORRUPT; } for (i = 1; i < spool->nstrings; i++) { if (sp >= strsp + sizeid) { - pool_debug(pool, SAT_ERROR, "not enough strings\n"); + pool_debug(pool, SOLV_ERROR, "not enough strings\n"); return SOLV_ERROR_OVERFLOW; } str[i] = sp - spool->stringspace; @@ -647,7 +647,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* alloc id map for name and rel Ids. this maps ids in the solv files * to the ids in our pool */ - idmap = sat_calloc(numid + numrel, sizeof(Id)); + idmap = solv_calloc(numid + numrel, sizeof(Id)); /* * build hashes for all read strings @@ -657,15 +657,15 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) hashmask = mkmask(spool->nstrings + numid); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "read %d strings\n", numid); - POOL_DEBUG(SAT_DEBUG_STATS, "string hash buckets: %d\n", hashmask + 1); + POOL_DEBUG(SOLV_DEBUG_STATS, "read %d strings\n", numid); + POOL_DEBUG(SOLV_DEBUG_STATS, "string hash buckets: %d\n", hashmask + 1); #endif /* * create hashtable with strings already in pool */ - hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); for (i = 1; i < spool->nstrings; i++) /* leave out our dummy zero id */ { h = strhash(spool->stringspace + spool->strings[i]) & hashmask; @@ -685,9 +685,9 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) { if (sp >= strsp + sizeid) { - sat_free(hashtbl); - sat_free(idmap); - pool_debug(pool, SAT_ERROR, "not enough strings %d %d\n", i, numid); + solv_free(hashtbl); + solv_free(idmap); + pool_debug(pool, SOLV_ERROR, "not enough strings %d %d\n", i, numid); return SOLV_ERROR_OVERFLOW; } if (!*sp) /* empty string */ @@ -724,7 +724,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) idmap[i] = id; /* repo relative -> pool relative */ sp += l; /* next string */ } - sat_free(hashtbl); + solv_free(hashtbl); } pool_shrink_strings(pool); /* vacuum */ @@ -739,19 +739,19 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (numrel) { /* extend rels */ - pool->rels = sat_realloc2(pool->rels, pool->nrels + numrel, sizeof(Reldep)); + pool->rels = solv_realloc2(pool->rels, pool->nrels + numrel, sizeof(Reldep)); ran = pool->rels; hashmask = mkmask(pool->nrels + numrel); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "read %d rels\n", numrel); - POOL_DEBUG(SAT_DEBUG_STATS, "rel hash buckets: %d\n", hashmask + 1); + POOL_DEBUG(SOLV_DEBUG_STATS, "read %d rels\n", numrel); + POOL_DEBUG(SOLV_DEBUG_STATS, "rel hash buckets: %d\n", hashmask + 1); #endif /* * prep hash table with already existing RelDeps */ - hashtbl = sat_calloc(hashmask + 1, sizeof(Id)); + hashtbl = solv_calloc(hashmask + 1, sizeof(Id)); for (i = 1; i < pool->nrels; i++) { h = relhash(ran[i].name, ran[i].evr, ran[i].flags) & hashmask; @@ -793,7 +793,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) } idmap[i + numid] = MAKERELDEP(id); /* fill Id map */ } - sat_free(hashtbl); + solv_free(hashtbl); pool_shrink_rels(pool); /* vacuum */ } @@ -801,7 +801,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 3: Dirs ***********************************************/ if (numdir) { - data.dirpool.dirs = sat_malloc2(numdir, sizeof(Id)); + data.dirpool.dirs = solv_malloc2(numdir, sizeof(Id)); data.dirpool.ndirs = numdir; data.dirpool.dirs[0] = 0; /* dir 0: virtual root */ data.dirpool.dirs[1] = 1; /* dir 1: / */ @@ -819,7 +819,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 4: Keys ***********************************************/ - keys = sat_calloc(numkeys, sizeof(*keys)); + keys = solv_calloc(numkeys, sizeof(*keys)); /* keys start at 1 */ for (i = 1; i < numkeys; i++) { @@ -835,7 +835,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) type = pool_str2id(pool, stringpool_id2str(spool, type), 1); if (type < REPOKEY_TYPE_VOID || type > REPOKEY_TYPE_FLEXARRAY) { - pool_debug(pool, SAT_ERROR, "unsupported data type '%s'\n", pool_id2str(pool, type)); + pool_debug(pool, SOLV_ERROR, "unsupported data type '%s'\n", pool_id2str(pool, type)); data.error = SOLV_ERROR_UNSUPPORTED; type = REPOKEY_TYPE_VOID; } @@ -848,14 +848,14 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) keys[i].storage = KEY_STORAGE_INCORE; if (keys[i].storage != KEY_STORAGE_INCORE && keys[i].storage != KEY_STORAGE_VERTICAL_OFFSET) { - pool_debug(pool, SAT_ERROR, "unsupported storage type %d\n", keys[i].storage); + pool_debug(pool, SOLV_ERROR, "unsupported storage type %d\n", keys[i].storage); data.error = SOLV_ERROR_UNSUPPORTED; } if (id >= SOLVABLE_NAME && id <= RPM_RPMDBID) { if (keys[i].storage != KEY_STORAGE_INCORE) { - pool_debug(pool, SAT_ERROR, "main solvable data must use incore storage%d\n", keys[i].storage); + pool_debug(pool, SOLV_ERROR, "main solvable data must use incore storage%d\n", keys[i].storage); data.error = SOLV_ERROR_UNSUPPORTED; } keys[i].storage = KEY_STORAGE_SOLVABLE; @@ -863,7 +863,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /* cannot handle rel idarrays in incore/vertical */ if (type == REPOKEY_TYPE_REL_IDARRAY && keys[i].storage != KEY_STORAGE_SOLVABLE) { - pool_debug(pool, SAT_ERROR, "type REL_IDARRAY only supported for STORAGE_SOLVABLE\n"); + pool_debug(pool, SOLV_ERROR, "type REL_IDARRAY only supported for STORAGE_SOLVABLE\n"); data.error = SOLV_ERROR_UNSUPPORTED; } if (keys[i].type == REPOKEY_TYPE_CONSTANTID && idmap) @@ -890,10 +890,10 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) /******* Part 5: Schemata ********************************************/ id = read_id(&data, 0); - schemadata = sat_calloc(id + 1, sizeof(Id)); + schemadata = solv_calloc(id + 1, sizeof(Id)); schemadatap = schemadata + 1; schemadataend = schemadatap + id; - schemata = sat_calloc(numschemata, sizeof(Id)); + schemata = solv_calloc(numschemata, sizeof(Id)); for (i = 1; i < numschemata; i++) { schemata[i] = schemadatap - schemadata; @@ -922,7 +922,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) if (maxsize > allsize) maxsize = allsize; - buf = sat_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */ + buf = solv_calloc(maxsize + DATA_READ_CHUNK + 4, 1); /* 4 extra bytes to detect overflows */ bufend = buf; dp = buf; @@ -933,7 +933,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) l = allsize; if (!l || fread(buf, l, 1, data.fp) != 1) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data.error = SOLV_ERROR_EOF; id = 0; } @@ -951,7 +951,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) for (i = 0; keyp[i]; i++) ; if (i) - data.mainschemaoffsets = sat_calloc(i, sizeof(Id)); + data.mainschemaoffsets = solv_calloc(i, sizeof(Id)); nentries = 0; keydepth = 0; @@ -968,7 +968,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) break; if (left < 0) { - pool_debug(mypool, SAT_ERROR, "buffer overrun\n"); + pool_debug(mypool, SOLV_ERROR, "buffer overrun\n"); data.error = SOLV_ERROR_EOF; break; } @@ -983,7 +983,7 @@ repo_add_solv_flags(Repo *repo, FILE *fp, int flags) l = allsize; if (l && fread(buf + left, l, 1, data.fp) != 1) { - pool_debug(mypool, SAT_ERROR, "unexpected EOF\n"); + pool_debug(mypool, SOLV_ERROR, "unexpected EOF\n"); data.error = SOLV_ERROR_EOF; break; } @@ -1066,13 +1066,13 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else if (keys[key].storage == KEY_STORAGE_INCORE) incore_add_id(&data, did); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %s\n", pool_id2str(pool, id), pool_id2str(pool, did)); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s -> %s\n", pool_id2str(pool, id), pool_id2str(pool, did)); #endif break; case REPOKEY_TYPE_U32: dp = data_read_u32(dp, &h); #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s -> %u\n", pool_id2str(pool, id), h); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s -> %u\n", pool_id2str(pool, id), h); #endif if (s && id == RPM_RPMDBID) { @@ -1108,7 +1108,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key dp = data_read_rel_idarray(dp, &idarraydatap, idmap, numid + numrel, &data.error, 0); if (idarraydatap > idarraydataend) { - pool_debug(pool, SAT_ERROR, "idarray overflow\n"); + pool_debug(pool, SOLV_ERROR, "idarray overflow\n"); data.error = SOLV_ERROR_OVERFLOW; break; } @@ -1129,9 +1129,9 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else if (id == SOLVABLE_ENHANCES) s->enhances = ido; #if 0 - POOL_DEBUG(SAT_DEBUG_STATS, "%s ->\n", pool_id2str(pool, id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s ->\n", pool_id2str(pool, id)); for (; repo->idarraydata[ido]; ido++) - POOL_DEBUG(SAT_DEBUG_STATS," %s\n", pool_dep2str(pool, repo->idarraydata[ido])); + POOL_DEBUG(SOLV_DEBUG_STATS," %s\n", pool_dep2str(pool, repo->idarraydata[ido])); #endif break; case REPOKEY_TYPE_FIXARRAY: @@ -1140,7 +1140,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key needchunk = 1; if (keydepth == sizeof(stack)/sizeof(*stack)) { - pool_debug(pool, SAT_ERROR, "array stack overflow\n"); + pool_debug(pool, SOLV_ERROR, "array stack overflow\n"); data.error = SOLV_ERROR_CORRUPT; break; } @@ -1161,13 +1161,13 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* horray! here come the solvables */ if (nentries != numsolv) { - pool_debug(pool, SAT_ERROR, "inconsistent number of solvables: %d %d\n", nentries, numsolv); + pool_debug(pool, SOLV_ERROR, "inconsistent number of solvables: %d %d\n", nentries, numsolv); data.error = SOLV_ERROR_CORRUPT; break; } if (idarraydatap) { - pool_debug(pool, SAT_ERROR, "more than one solvable block\n"); + pool_debug(pool, SOLV_ERROR, "more than one solvable block\n"); data.error = SOLV_ERROR_CORRUPT; break; } @@ -1202,7 +1202,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key { if (!id) { - pool_debug(pool, SAT_ERROR, "illegal fixarray\n"); + pool_debug(pool, SOLV_ERROR, "illegal fixarray\n"); data.error = SOLV_ERROR_CORRUPT; } stack[keydepth - 1] = id; @@ -1221,18 +1221,18 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key if (keydepth) { - pool_debug(pool, SAT_ERROR, "unexpected EOF, depth = %d\n", keydepth); + pool_debug(pool, SOLV_ERROR, "unexpected EOF, depth = %d\n", keydepth); data.error = SOLV_ERROR_CORRUPT; } if (!data.error) { if (dp > bufend) { - pool_debug(mypool, SAT_ERROR, "buffer overrun\n"); + pool_debug(mypool, SOLV_ERROR, "buffer overrun\n"); data.error = SOLV_ERROR_EOF; } } - sat_free(buf); + solv_free(buf); if (data.error) { @@ -1241,14 +1241,14 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* free id array */ repo->idarraysize -= size_idarray; /* free incore data */ - data.incoredata = sat_free(data.incoredata); + data.incoredata = solv_free(data.incoredata); data.incoredatalen = data.incoredatafree = 0; } if (data.incoredatafree) { /* shrink excess size */ - data.incoredata = sat_realloc(data.incoredata, data.incoredatalen); + data.incoredata = solv_realloc(data.incoredata, data.incoredatalen); data.incoredatafree = 0; } @@ -1261,7 +1261,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key unsigned int pagesize; /* we have vertical data, make it available */ - data.verticaloffset = sat_calloc(numkeys, sizeof(Id)); + data.verticaloffset = solv_calloc(numkeys, sizeof(Id)); for (i = 1; i < numkeys; i++) if (keys[i].storage == KEY_STORAGE_VERTICAL_OFFSET) { @@ -1277,7 +1277,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key /* no longer needed */ data.fp = 0; } - sat_free(idmap); + solv_free(idmap); mypool = 0; if (data.error) @@ -1295,7 +1295,7 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key else { /* make it available as new repodata */ - repo->repodata = sat_realloc2(repo->repodata, repo->nrepodata + 1, sizeof(data)); + repo->repodata = solv_realloc2(repo->repodata, repo->nrepodata + 1, sizeof(data)); repo->repodata[repo->nrepodata++] = data; } @@ -1309,9 +1309,9 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key repodata_create_stubs(repo->repodata + (repo->nrepodata - 1)); } - POOL_DEBUG(SAT_DEBUG_STATS, "repo_add_solv took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); - POOL_DEBUG(SAT_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data.incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo_add_solv took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo size: %d solvables\n", repo->nsolvables); + POOL_DEBUG(SOLV_DEBUG_STATS, "repo memory used: %d K incore, %d K idarray\n", data.incoredatalen/1024, repo->idarraysize / (int)(1024/sizeof(Id))); return 0; } diff --git a/src/repodata.c b/src/repodata.c index 55517c5..d3b00f6 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -47,10 +47,10 @@ repodata_initdata(Repodata *data, Repo *repo, int localpool) if (localpool) stringpool_init_empty(&data->spool); /* dirpool_init(&data->dirpool); just zeros out again */ - data->keys = sat_calloc(1, sizeof(Repokey)); + data->keys = solv_calloc(1, sizeof(Repokey)); data->nkeys = 1; - data->schemata = sat_calloc(1, sizeof(Id)); - data->schemadata = sat_calloc(1, sizeof(Id)); + data->schemata = solv_calloc(1, sizeof(Id)); + data->schemadata = solv_calloc(1, sizeof(Id)); data->nschemata = 1; data->schemadatalen = 1; repopagestore_init(&data->store); @@ -61,35 +61,35 @@ repodata_freedata(Repodata *data) { int i; - sat_free(data->keys); + solv_free(data->keys); - sat_free(data->schemata); - sat_free(data->schemadata); - sat_free(data->schematahash); + solv_free(data->schemata); + solv_free(data->schemadata); + solv_free(data->schematahash); stringpool_free(&data->spool); dirpool_free(&data->dirpool); - sat_free(data->mainschemaoffsets); - sat_free(data->incoredata); - sat_free(data->incoreoffset); - sat_free(data->verticaloffset); + solv_free(data->mainschemaoffsets); + solv_free(data->incoredata); + solv_free(data->incoreoffset); + solv_free(data->verticaloffset); repopagestore_free(&data->store); - sat_free(data->vincore); + solv_free(data->vincore); if (data->attrs) for (i = 0; i < data->end - data->start; i++) - sat_free(data->attrs[i]); - sat_free(data->attrs); + solv_free(data->attrs[i]); + solv_free(data->attrs); if (data->xattrs) for (i = 0; i < data->nxattrs; i++) - sat_free(data->xattrs[i]); - sat_free(data->xattrs); + solv_free(data->xattrs[i]); + solv_free(data->xattrs); - sat_free(data->attrdata); - sat_free(data->attriddata); + solv_free(data->attrdata); + solv_free(data->attriddata); } Repodata * @@ -98,7 +98,7 @@ repodata_create(Repo *repo, int localpool) Repodata *data; repo->nrepodata++; - repo->repodata = sat_realloc2(repo->repodata, repo->nrepodata, sizeof(*data)); + repo->repodata = solv_realloc2(repo->repodata, repo->nrepodata, sizeof(*data)); data = repo->repodata + repo->nrepodata - 1; repodata_initdata(data, repo, localpool); return data; @@ -150,11 +150,11 @@ repodata_key2id(Repodata *data, Repokey *key, int create) if (!create) return 0; /* allocate new key */ - data->keys = sat_realloc2(data->keys, data->nkeys + 1, sizeof(Repokey)); + data->keys = solv_realloc2(data->keys, data->nkeys + 1, sizeof(Repokey)); data->keys[data->nkeys++] = *key; if (data->verticaloffset) { - data->verticaloffset = sat_realloc2(data->verticaloffset, data->nkeys, sizeof(Id)); + data->verticaloffset = solv_realloc2(data->verticaloffset, data->nkeys, sizeof(Id)); data->verticaloffset[data->nkeys - 1] = 0; } data->keybits[(key->name >> 3) & (sizeof(data->keybits) - 1)] |= 1 << (key->name & 7); @@ -181,7 +181,7 @@ repodata_schema2id(Repodata *data, Id *schema, int create) return 0; /* XXX: allow empty schema? */ if ((schematahash = data->schematahash) == 0) { - data->schematahash = schematahash = sat_calloc(256, sizeof(Id)); + data->schematahash = schematahash = solv_calloc(256, sizeof(Id)); for (i = 1; i < data->nschemata; i++) { for (sp = data->schemadata + data->schemata[i], h = 0; *sp; len++) @@ -189,8 +189,8 @@ repodata_schema2id(Repodata *data, Id *schema, int create) h &= 255; schematahash[h] = i; } - data->schemadata = sat_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK); - data->schemata = sat_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK); + data->schemadata = solv_extend_resize(data->schemadata, data->schemadatalen, sizeof(Id), SCHEMATADATA_BLOCK); + data->schemata = solv_extend_resize(data->schemata, data->nschemata, sizeof(Id), SCHEMATA_BLOCK); } for (sp = schema, len = 0, h = 0; *sp; len++) @@ -211,8 +211,8 @@ repodata_schema2id(Repodata *data, Id *schema, int create) /* a new one */ if (!create) return 0; - data->schemadata = sat_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK); - data->schemata = sat_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK); + data->schemadata = solv_extend(data->schemadata, data->schemadatalen, len, sizeof(Id), SCHEMATADATA_BLOCK); + data->schemata = solv_extend(data->schemata, data->nschemata, 1, sizeof(Id), SCHEMATA_BLOCK); /* add schema */ memcpy(data->schemadata + data->schemadatalen, schema, len * sizeof(Id)); data->schemata[data->nschemata] = data->schemadatalen; @@ -227,10 +227,10 @@ fprintf(stderr, "schema2id: new schema\n"); void repodata_free_schemahash(Repodata *data) { - data->schematahash = sat_free(data->schematahash); + data->schematahash = solv_free(data->schematahash); /* shrink arrays */ - data->schemata = sat_realloc2(data->schemata, data->nschemata, sizeof(Id)); - data->schemadata = sat_realloc2(data->schemadata, data->schemadatalen, sizeof(Id)); + data->schemata = solv_realloc2(data->schemata, data->nschemata, sizeof(Id)); + data->schemadata = solv_realloc2(data->schemadata, data->schemadatalen, sizeof(Id)); } @@ -977,11 +977,11 @@ datamatcher_init(Datamatcher *ma, const char *match, int flags) ma->matchdata = 0; if ((flags & SEARCH_STRINGMASK) == SEARCH_REGEX) { - ma->matchdata = sat_calloc(1, sizeof(regex_t)); + ma->matchdata = solv_calloc(1, sizeof(regex_t)); ma->error = regcomp((regex_t *)ma->matchdata, match, REG_EXTENDED | REG_NOSUB | REG_NEWLINE | ((flags & SEARCH_NOCASE) ? REG_ICASE : 0)); if (ma->error) { - sat_free(ma->matchdata); + solv_free(ma->matchdata); ma->flags = (flags & ~SEARCH_STRINGMASK) | SEARCH_ERROR; } } @@ -994,7 +994,7 @@ datamatcher_free(Datamatcher *ma) if ((ma->flags & SEARCH_STRINGMASK) == SEARCH_REGEX && ma->matchdata) { regfree(ma->matchdata); - ma->matchdata = sat_free(ma->matchdata); + ma->matchdata = solv_free(ma->matchdata); } } @@ -1746,10 +1746,10 @@ repodata_extend(Repodata *data, Id p) int new = p - data->end + 1; if (data->attrs) { - data->attrs = sat_extend(data->attrs, old, new, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_extend(data->attrs, old, new, sizeof(Id *), REPODATA_BLOCK); memset(data->attrs + old, 0, new * sizeof(Id *)); } - data->incoreoffset = sat_extend(data->incoreoffset, old, new, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend(data->incoreoffset, old, new, sizeof(Id), REPODATA_BLOCK); memset(data->incoreoffset + old, 0, new * sizeof(Id)); data->end = p + 1; } @@ -1759,11 +1759,11 @@ repodata_extend(Repodata *data, Id p) int new = data->start - p; if (data->attrs) { - data->attrs = sat_extend_resize(data->attrs, old + new, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_extend_resize(data->attrs, old + new, sizeof(Id *), REPODATA_BLOCK); memmove(data->attrs + new, data->attrs, old * sizeof(Id *)); memset(data->attrs, 0, new * sizeof(Id *)); } - data->incoreoffset = sat_extend_resize(data->incoreoffset, old + new, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend_resize(data->incoreoffset, old + new, sizeof(Id), REPODATA_BLOCK); memmove(data->incoreoffset + new, data->incoreoffset, old * sizeof(Id)); memset(data->incoreoffset, 0, new * sizeof(Id)); data->start = p; @@ -1783,21 +1783,21 @@ repodata_shrink(Repodata *data, int end) if (data->attrs) { for (i = 0; i < data->end - data->start; i++) - sat_free(data->attrs[i]); - data->attrs = sat_free(data->attrs); + solv_free(data->attrs[i]); + data->attrs = solv_free(data->attrs); } - data->incoreoffset = sat_free(data->incoreoffset); + data->incoreoffset = solv_free(data->incoreoffset); data->start = data->end = 0; return; } if (data->attrs) { for (i = end; i < data->end; i++) - sat_free(data->attrs[i - data->start]); - data->attrs = sat_extend_resize(data->attrs, end - data->start, sizeof(Id *), REPODATA_BLOCK); + solv_free(data->attrs[i - data->start]); + data->attrs = solv_extend_resize(data->attrs, end - data->start, sizeof(Id *), REPODATA_BLOCK); } if (data->incoreoffset) - data->incoreoffset = sat_extend_resize(data->incoreoffset, end - data->start, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_extend_resize(data->incoreoffset, end - data->start, sizeof(Id), REPODATA_BLOCK); data->end = end; } @@ -1809,7 +1809,7 @@ repodata_extend_block(Repodata *data, Id start, Id num) return; if (!data->incoreoffset) { - data->incoreoffset = sat_calloc_block(num, sizeof(Id), REPODATA_BLOCK); + data->incoreoffset = solv_calloc_block(num, sizeof(Id), REPODATA_BLOCK); data->start = start; data->end = start + num; return; @@ -1832,10 +1832,10 @@ repodata_new_handle(Repodata *data) { if (!data->nxattrs) { - data->xattrs = sat_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); data->nxattrs = 2; /* -1: SOLVID_META */ } - data->xattrs = sat_extend(data->xattrs, data->nxattrs, 1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_extend(data->xattrs, data->nxattrs, 1, sizeof(Id *), REPODATA_BLOCK); data->xattrs[data->nxattrs] = 0; return -(data->nxattrs++); } @@ -1847,7 +1847,7 @@ repodata_get_attrp(Repodata *data, Id handle) { if (handle == SOLVID_META && !data->xattrs) { - data->xattrs = sat_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); + data->xattrs = solv_calloc_block(1, sizeof(Id *), REPODATA_BLOCK); data->nxattrs = 2; } return data->xattrs - handle; @@ -1855,7 +1855,7 @@ repodata_get_attrp(Repodata *data, Id handle) if (handle < data->start || handle >= data->end) repodata_extend(data, handle); if (!data->attrs) - data->attrs = sat_calloc_block(data->end - data->start, sizeof(Id *), REPODATA_BLOCK); + data->attrs = solv_calloc_block(data->end - data->start, sizeof(Id *), REPODATA_BLOCK); return data->attrs + (handle - data->start); } @@ -1887,7 +1887,7 @@ repodata_insert_keyid(Repodata *data, Id handle, Id keyid, Id val, int overwrite } i = pp - ap; } - ap = sat_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK); + ap = solv_extend(ap, i, 3, sizeof(Id), REPODATA_ATTRS_BLOCK); *app = ap; pp = ap + i; *pp++ = keyid; @@ -1987,7 +1987,7 @@ repodata_set_str(Repodata *data, Id solvid, Id keyname, const char *str) key.type = REPOKEY_TYPE_STR; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); repodata_set(data, solvid, &key, data->attrdatalen); data->attrdatalen += l; @@ -2003,7 +2003,7 @@ repodata_set_binary(Repodata *data, Id solvid, Id keyname, void *buf, int len) key.type = REPOKEY_TYPE_BINARY; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, len + 5, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, len + 5, 1, REPODATA_ATTRDATA_BLOCK); dp = data->attrdata + data->attrdatalen; if (len >= (1 << 14)) { @@ -2034,7 +2034,7 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys if (handle == data->lasthandle && data->keys[data->lastkey].name == keyname && data->keys[data->lastkey].type == keytype && data->attriddatalen == data->lastdatalen) { /* great! just append the new data */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); data->attriddatalen--; /* overwrite terminating 0 */ data->lastdatalen += entrysize; return; @@ -2057,7 +2057,7 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys key.type = keytype; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); keyid = repodata_key2id(data, &key, 1); repodata_insert_keyid(data, handle, keyid, data->attriddatalen, 1); data->lasthandle = handle; @@ -2071,13 +2071,13 @@ repodata_add_array(Repodata *data, Id handle, Id keyname, Id keytype, int entrys if (ida + 1 == data->attriddata + data->attriddatalen) { /* this was the last entry, just append it */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, entrysize, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); data->attriddatalen--; /* overwrite terminating 0 */ } else { /* too bad. move to back. */ - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, oldsize + entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, oldsize + entrysize + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); memcpy(data->attriddata + data->attriddatalen, data->attriddata + pp[1], oldsize * sizeof(Id)); pp[1] = data->attriddatalen; data->attriddatalen += oldsize; @@ -2094,13 +2094,13 @@ repodata_set_bin_checksum(Repodata *data, Id solvid, Id keyname, Id type, Repokey key; int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return; key.name = keyname; key.type = type; key.size = 0; key.storage = KEY_STORAGE_INCORE; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); repodata_set(data, solvid, &key, data->attrdatalen); data->attrdatalen += l; @@ -2113,9 +2113,9 @@ repodata_set_checksum(Repodata *data, Id solvid, Id keyname, Id type, unsigned char buf[64]; int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return; - if (l > sizeof(buf) || sat_hex2bin(&str, buf, l) != l) + if (l > sizeof(buf) || solv_hex2bin(&str, buf, l) != l) return; repodata_set_bin_checksum(data, solvid, keyname, type, buf); } @@ -2125,7 +2125,7 @@ repodata_chk2str(Repodata *data, Id type, const unsigned char *buf) { int l; - if (!(l = sat_chksum_len(type))) + if (!(l = solv_chksum_len(type))) return ""; return pool_bin2hex(data->repo->pool, buf, l); } @@ -2222,7 +2222,7 @@ repodata_set_idarray(Repodata *data, Id solvid, Id keyname, Queue *q) key.size = 0; key.storage = KEY_STORAGE_INCORE; repodata_set(data, solvid, &key, data->attriddatalen); - data->attriddata = sat_extend(data->attriddata, data->attriddatalen, q->count + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); + data->attriddata = solv_extend(data->attriddata, data->attriddatalen, q->count + 1, sizeof(Id), REPODATA_ATTRIDDATA_BLOCK); for (i = 0; i < q->count; i++) data->attriddata[data->attriddatalen++] = q->elements[i]; data->attriddata[data->attriddatalen++] = 0; @@ -2250,7 +2250,7 @@ repodata_add_dirstr(Repodata *data, Id solvid, Id keyname, Id dir, const char *s assert(dir); l = strlen(str) + 1; - data->attrdata = sat_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); + data->attrdata = solv_extend(data->attrdata, data->attrdatalen, l, 1, REPODATA_ATTRDATA_BLOCK); memcpy(data->attrdata + data->attrdatalen, str, l); stroff = data->attrdatalen; data->attrdatalen += l; @@ -2381,7 +2381,7 @@ data_addid(struct extdata *xd, Id x) { unsigned char *dp; - xd->buf = sat_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, 5, 1, EXTDATA_BLOCK); dp = xd->buf + xd->len; if (x >= (1 << 14)) @@ -2409,7 +2409,7 @@ data_addideof(struct extdata *xd, Id x, int eof) static void data_addblob(struct extdata *xd, unsigned char *blob, int len) { - xd->buf = sat_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); + xd->buf = solv_extend(xd->buf, xd->len, len, 1, EXTDATA_BLOCK); memcpy(xd->buf + xd->len, blob, len); xd->len += len; } @@ -2503,7 +2503,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, schemaid = repodata_schema2id(data, schema, 1); else if (schemaid != repodata_schema2id(data, schema, 0)) { - pool_debug(data->repo->pool, SAT_FATAL, "fixarray substructs with different schemas\n"); + pool_debug(data->repo->pool, SOLV_FATAL, "fixarray substructs with different schemas\n"); exit(1); } } @@ -2548,7 +2548,7 @@ repodata_serialize_key(Repodata *data, struct extdata *newincore, break; } default: - pool_debug(data->repo->pool, SAT_FATAL, "don't know how to handle type %d\n", key->type); + pool_debug(data->repo->pool, SOLV_FATAL, "don't know how to handle type %d\n", key->type); exit(1); } if (key->storage == KEY_STORAGE_VERTICAL_OFFSET) @@ -2586,8 +2586,8 @@ repodata_internalize(Repodata *data) solvkey.storage = KEY_STORAGE_INCORE; solvkeyid = repodata_key2id(data, &solvkey, data->end != data->start ? 1 : 0); - schema = sat_malloc2(data->nkeys, sizeof(Id)); - seen = sat_malloc2(data->nkeys, sizeof(Id)); + schema = solv_malloc2(data->nkeys, sizeof(Id)); + seen = solv_malloc2(data->nkeys, sizeof(Id)); /* Merge the data already existing (in data->schemata, ->incoredata and friends) with the new attributes in data->attrs[]. */ @@ -2596,7 +2596,7 @@ repodata_internalize(Repodata *data) data_addid(&newincore, 0); /* start data at offset 1 */ data->mainschema = 0; - data->mainschemaoffsets = sat_free(data->mainschemaoffsets); + data->mainschemaoffsets = solv_free(data->mainschemaoffsets); /* join entry data */ /* we start with the meta data, entry -1 */ @@ -2623,7 +2623,7 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); { if (seen[*keyp]) { - pool_debug(data->repo->pool, SAT_FATAL, "Inconsistent old data (key occured twice).\n"); + pool_debug(data->repo->pool, SOLV_FATAL, "Inconsistent old data (key occured twice).\n"); exit(1); } seen[*keyp] = -1; @@ -2685,7 +2685,7 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); if (entry == -1) { data->mainschema = schemaid; - data->mainschemaoffsets = sat_calloc(sp - schema, sizeof(Id)); + data->mainschemaoffsets = solv_calloc(sp - schema, sizeof(Id)); } keypstart = data->schemadata + data->schemata[schemaid]; for (keyp = keypstart; *keyp; keyp++) @@ -2734,34 +2734,34 @@ fprintf(stderr, "schemadata %p\n", data->schemadata); dp = ndp; } if (entry >= 0 && data->attrs && data->attrs[entry]) - data->attrs[entry] = sat_free(data->attrs[entry]); + data->attrs[entry] = solv_free(data->attrs[entry]); } /* free all xattrs */ for (entry = 0; entry < data->nxattrs; entry++) if (data->xattrs[entry]) - sat_free(data->xattrs[entry]); - data->xattrs = sat_free(data->xattrs); + solv_free(data->xattrs[entry]); + data->xattrs = solv_free(data->xattrs); data->nxattrs = 0; data->lasthandle = 0; data->lastkey = 0; data->lastdatalen = 0; - sat_free(schema); - sat_free(seen); + solv_free(schema); + solv_free(seen); repodata_free_schemahash(data); - sat_free(data->incoredata); + solv_free(data->incoredata); data->incoredata = newincore.buf; data->incoredatalen = newincore.len; data->incoredatafree = 0; - sat_free(data->vincore); + solv_free(data->vincore); data->vincore = newvincore.buf; data->vincorelen = newvincore.len; - data->attrs = sat_free(data->attrs); - data->attrdata = sat_free(data->attrdata); - data->attriddata = sat_free(data->attriddata); + data->attrs = solv_free(data->attrs); + data->attrdata = solv_free(data->attrdata); + data->attriddata = solv_free(data->attriddata); data->attrdatalen = 0; data->attriddatalen = 0; } @@ -2796,7 +2796,7 @@ repodata_load_stub(Repodata *data) /* restore tmp space */ for (i = 0; i < POOL_TMPSPACEBUF; i++) - sat_free(pool->tmpspace.buf[i]); + solv_free(pool->tmpspace.buf[i]); pool->tmpspace = oldtmpspace; data->state = r ? REPODATA_AVAILABLE : REPODATA_ERROR; @@ -2828,7 +2828,7 @@ repodata_create_stubs(Repodata *data) dataiterator_free(&di); if (!cnt) return; - stubdataids = sat_calloc(cnt, sizeof(*stubdataids)); + stubdataids = solv_calloc(cnt, sizeof(*stubdataids)); for (i = 0; i < cnt; i++) { sdata = repo_add_repodata(repo, 0); @@ -2900,7 +2900,7 @@ repodata_create_stubs(Repodata *data) dataiterator_free(&di); for (i = 0; i < cnt; i++) repodata_internalize(repo->repodata + stubdataids[i]); - sat_free(stubdataids); + solv_free(stubdataids); } /* diff --git a/src/repopage.c b/src/repopage.c index 0dbdfdb..ad633a3 100644 --- a/src/repopage.c +++ b/src/repopage.c @@ -559,9 +559,9 @@ void repopagestore_init(Repopagestore *store) void repopagestore_free(Repopagestore *store) { - sat_free(store->blob_store); - sat_free(store->pages); - sat_free(store->mapped); + solv_free(store->blob_store); + solv_free(store->pages); + solv_free(store->mapped); if (store->pagefd != -1) close(store->pagefd); } @@ -597,9 +597,9 @@ repopagestore_load_page_range(Repopagestore *store, unsigned int pstart, unsigne store->ncanmap = pend - pstart + 1; if (store->ncanmap < 4) store->ncanmap = 4; - store->mapped = sat_realloc2(store->mapped, store->ncanmap, sizeof(store->mapped[0])); + store->mapped = solv_realloc2(store->mapped, store->ncanmap, sizeof(store->mapped[0])); memset(store->mapped + oldcan, 0, (store->ncanmap - oldcan) * sizeof (store->mapped[0])); - store->blob_store = sat_realloc2(store->blob_store, store->ncanmap, REPOPAGE_BLOBSIZE); + store->blob_store = solv_realloc2(store->blob_store, store->ncanmap, REPOPAGE_BLOBSIZE); #ifdef DEBUG_PAGING fprintf(stderr, "PAGE: can map %d pages\n", store->ncanmap); #endif @@ -789,11 +789,11 @@ repopagestore_read_or_setup_pages(Repopagestore *store, FILE *fp, unsigned int p npages = (blobsz + REPOPAGE_BLOBSIZE - 1) / REPOPAGE_BLOBSIZE; store->num_pages = npages; - store->pages = sat_malloc2(npages, sizeof(store->pages[0])); + store->pages = solv_malloc2(npages, sizeof(store->pages[0])); /* If we can't seek on our input we have to slurp in everything. */ if (!can_seek) - store->blob_store = sat_malloc2(npages, REPOPAGE_BLOBSIZE); + store->blob_store = solv_malloc2(npages, REPOPAGE_BLOBSIZE); for (i = 0; i < npages; i++) { unsigned int in_len = read_u32(fp); diff --git a/src/rules.c b/src/rules.c index cb75b70..a423600 100644 --- a/src/rules.c +++ b/src/rules.c @@ -145,7 +145,7 @@ solver_unifyrules(Solver *solv) return; /* sort rules first */ - sat_sort(solv->rules + 1, solv->nrules - 1, sizeof(Rule), unifyrules_sortcmp, solv->pool); + solv_sort(solv->rules + 1, solv->nrules - 1, sizeof(Rule), unifyrules_sortcmp, solv->pool); /* prune rules * i = unpruned @@ -162,16 +162,16 @@ solver_unifyrules(Solver *solv) } /* reduced count from nrules to j rules */ - POOL_DEBUG(SAT_DEBUG_STATS, "pruned rules from %d to %d\n", solv->nrules, j); + POOL_DEBUG(SOLV_DEBUG_STATS, "pruned rules from %d to %d\n", solv->nrules, j); /* adapt rule buffer */ solv->nrules = j; - solv->rules = sat_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); /* * debug: log rule statistics */ - IF_POOLDEBUG (SAT_DEBUG_STATS) + IF_POOLDEBUG (SOLV_DEBUG_STATS) { int binr = 0; int lits = 0; @@ -190,8 +190,8 @@ solver_unifyrules(Solver *solv) lits++; } } - POOL_DEBUG(SAT_DEBUG_STATS, " binary: %d\n", binr); - POOL_DEBUG(SAT_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits); + POOL_DEBUG(SOLV_DEBUG_STATS, " binary: %d\n", binr); + POOL_DEBUG(SOLV_DEBUG_STATS, " normal: %d, %d literals\n", solv->nrules - 1 - binr, lits); } } @@ -337,7 +337,7 @@ solver_addrule(Solver *solv, Id p, Id d) */ /* extend rule buffer */ - solv->rules = sat_extend(solv->rules, solv->nrules, 1, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend(solv->rules, solv->nrules, 1, sizeof(Rule), RULES_BLOCK); r = solv->rules + solv->nrules++; /* point to rule space */ /* @@ -368,10 +368,10 @@ solver_addrule(Solver *solv, Id p, Id d) r->n1 = 0; r->n2 = 0; - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " Add rule: "); - solver_printrule(solv, SAT_DEBUG_RULE_CREATION, r); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, " Add rule: "); + solver_printrule(solv, SOLV_DEBUG_RULE_CREATION, r); } return r; @@ -512,7 +512,7 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) && s->arch != ARCH_NOSRC && !pool_installable(pool, s)) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables)); addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOT_INSTALLABLE, 0); } @@ -563,7 +563,7 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) /* didn't find an installed provider: previously broken dependency */ if (!p) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "ignoring broken requires %s of installed package %s\n", pool_dep2str(pool, req), pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "ignoring broken requires %s of installed package %s\n", pool_dep2str(pool, req), pool_solvable2str(pool, s)); continue; } } @@ -571,16 +571,16 @@ solver_addrpmrulesforsolvable(Solver *solv, Solvable *s, Map *m) if (!*dp) { /* nothing provides req! */ - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, "package %s [%d] is not installable (%s)\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables), pool_dep2str(pool, req)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s [%d] is not installable (%s)\n", pool_solvable2str(pool, s), (Id)(s - pool->solvables), pool_dep2str(pool, req)); addrpmrule(solv, -n, 0, SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP, req); continue; } - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG(SAT_DEBUG_RULE_CREATION," %s requires %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION," %s requires %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); for (i = 0; dp[i]; i++) - POOL_DEBUG(SAT_DEBUG_RULE_CREATION, " provided by %s\n", pool_solvid2str(pool, dp[i])); + POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, " provided by %s\n", pool_solvid2str(pool, dp[i])); } /* add 'requires' dependency */ @@ -948,7 +948,7 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all) (solv->updatemap_all || (solv->updatemap.size && MAPTST(&solv->updatemap, s - pool->solvables - solv->installed->start)))) { if (!solv->multiversionupdaters) - solv->multiversionupdaters = sat_calloc(solv->installed->end - solv->installed->start, sizeof(Id)); + solv->multiversionupdaters = solv_calloc(solv->installed->end - solv->installed->start, sizeof(Id)); solv->multiversionupdaters[s - pool->solvables - solv->installed->start] = d; } if (j == 0 && p == -SYSTEMSOLVABLE && solv->dupmap_all) @@ -993,10 +993,10 @@ reenableupdaterule(Solver *solv, Id p) if (r->d >= 0) return; solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } return; } @@ -1004,10 +1004,10 @@ reenableupdaterule(Solver *solv, Id p) if (r->p && r->d < 0) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1134,10 +1134,10 @@ reenableinfarchrule(Solver *solv, Id name) if (r->p < 0 && r->d < 0 && pool->solvables[-r->p].name == name) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1300,10 +1300,10 @@ reenableduprule(Solver *solv, Id name) if (r->p < 0 && r->d < 0 && pool->solvables[-r->p].name == name) { solver_enablerule(solv, r); - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "@@@ re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } } } @@ -1796,7 +1796,7 @@ solver_allruleinfos(Solver *solv, Id rid, Queue *rq) /* now sort & unify em */ if (!rq->count) return 0; - sat_sort(rq->elements, rq->count / 4, 4 * sizeof(Id), solver_allruleinfos_cmp, 0); + solv_sort(rq->elements, rq->count / 4, 4 * sizeof(Id), solver_allruleinfos_cmp, 0); /* throw out identical entries */ for (i = j = 0; i < rq->count; i += 4) { @@ -1979,7 +1979,7 @@ solver_addchoicerules(Solver *solv) solv->choicerules_end = solv->nrules; return; } - solv->choicerules_ref = sat_calloc(solv->rpmrules_end, sizeof(Id)); + solv->choicerules_ref = solv_calloc(solv->rpmrules_end, sizeof(Id)); queue_init(&q); queue_init(&qi); map_init(&m, pool->nsolvables); @@ -1996,7 +1996,7 @@ solver_addchoicerules(Solver *solv) r = solv->rules + rid; if (r->p >= 0 || ((r->d == 0 || r->d == -1) && r->w2 < 0)) continue; /* only look at requires rules */ - // solver_printrule(solv, SAT_DEBUG_RESULT, r); + // solver_printrule(solv, SOLV_DEBUG_RESULT, r); queue_empty(&q); queue_empty(&qi); havechoice = 0; @@ -2103,7 +2103,7 @@ solver_addchoicerules(Solver *solv) { #if 0 printf("skipping choice "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + rid); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid); #endif continue; } @@ -2113,9 +2113,9 @@ solver_addchoicerules(Solver *solv) solv->choicerules_ref[solv->nrules - 1 - solv->choicerules] = rid; #if 0 printf("OLD "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + rid); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + rid); printf("WEAK CHOICE "); - solver_printrule(solv, SAT_DEBUG_RESULT, solv->rules + solv->nrules - 1); + solver_printrule(solv, SOLV_DEBUG_RESULT, solv->rules + solv->nrules - 1); #endif } queue_free(&q); diff --git a/src/satversion.c b/src/satversion.c deleted file mode 100644 index 4d28125..0000000 --- a/src/satversion.c +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2009, Novell Inc. - * - * This program is licensed under the BSD license, read LICENSE.BSD - * for further information - */ - -#include "satversion.h" - -const char sat_version[] = LIBSOLV_VERSION_STRING; -int sat_version_major = LIBSOLV_VERSION_MAJOR; -int sat_version_minor = LIBSOLV_VERSION_MINOR; -int sat_version_patch = LIBSOLV_VERSION_PATCH; @@ -159,7 +159,7 @@ static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]) /* SHA1Init - Initialize new context */ -void sat_SHA1_Init(SHA1_CTX* context) +void solv_SHA1_Init(SHA1_CTX* context) { /* SHA1 initialization constants */ context->state[0] = 0x67452301; @@ -172,7 +172,7 @@ void sat_SHA1_Init(SHA1_CTX* context) /* Run your data through this. */ -void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) +void solv_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) { size_t i, j; @@ -201,7 +201,7 @@ void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) /* Add padding and return the message digest. */ -void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) +void solv_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) { uint32_t i; uint8_t finalcount[8]; @@ -210,11 +210,11 @@ void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]) finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)] >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ } - sat_SHA1_Update(context, (uint8_t *)"\200", 1); + solv_SHA1_Update(context, (uint8_t *)"\200", 1); while ((context->count[0] & 504) != 448) { - sat_SHA1_Update(context, (uint8_t *)"\0", 1); + solv_SHA1_Update(context, (uint8_t *)"\0", 1); } - sat_SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */ + solv_SHA1_Update(context, finalcount, 8); /* Should cause a SHA1_Transform() */ for (i = 0; i < SHA1_DIGEST_SIZE; i++) { digest[i] = (uint8_t) ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); @@ -11,6 +11,6 @@ typedef struct { #define SHA1_DIGEST_SIZE 20 -void sat_SHA1_Init(SHA1_CTX* context); -void sat_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); -void sat_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); +void solv_SHA1_Init(SHA1_CTX* context); +void solv_SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); +void solv_SHA1_Final(SHA1_CTX* context, uint8_t digest[SHA1_DIGEST_SIZE]); @@ -330,7 +330,7 @@ static const char *sha2_hex_digits = "0123456789abcdef"; /*** SHA-256: *********************************************************/ -void sat_SHA256_Init(SHA256_CTX* context) { +void solv_SHA256_Init(SHA256_CTX* context) { if (context == (SHA256_CTX*)0) { return; } @@ -514,7 +514,7 @@ static void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void sat_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { +void solv_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -562,7 +562,7 @@ void sat_SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { usedspace = freespace = 0; } -void sat_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { +void solv_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; unsigned int usedspace; @@ -625,7 +625,7 @@ void sat_SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { usedspace = 0; } -char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { +char *solv_SHA256_End(SHA256_CTX* context, char buffer[]) { sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest; int i; @@ -633,7 +633,7 @@ char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { /* assert(context != (SHA256_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA256_Final(digest, context); + solv_SHA256_Final(digest, context); for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -648,17 +648,17 @@ char *sat_SHA256_End(SHA256_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { +char* solv_SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { SHA256_CTX context; - sat_SHA256_Init(&context); - sat_SHA256_Update(&context, data, len); - return sat_SHA256_End(&context, digest); + solv_SHA256_Init(&context); + solv_SHA256_Update(&context, data, len); + return solv_SHA256_End(&context, digest); } /*** SHA-512: *********************************************************/ -void sat_SHA512_Init(SHA512_CTX* context) { +void solv_SHA512_Init(SHA512_CTX* context) { if (context == (SHA512_CTX*)0) { return; } @@ -836,7 +836,7 @@ static void SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void sat_SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { +void solv_SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -925,7 +925,7 @@ static void SHA512_Last(SHA512_CTX* context) { SHA512_Transform(context, (sha2_word64*)context->buffer); } -void sat_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { +void solv_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -954,7 +954,7 @@ void sat_SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { MEMSET_BZERO(context, sizeof(context)); } -char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { +char *solv_SHA512_End(SHA512_CTX* context, char buffer[]) { sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; int i; @@ -962,7 +962,7 @@ char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { /* assert(context != (SHA512_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA512_Final(digest, context); + solv_SHA512_Final(digest, context); for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -977,17 +977,17 @@ char *sat_SHA512_End(SHA512_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { +char* solv_SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { SHA512_CTX context; - sat_SHA512_Init(&context); - sat_SHA512_Update(&context, data, len); - return sat_SHA512_End(&context, digest); + solv_SHA512_Init(&context); + solv_SHA512_Update(&context, data, len); + return solv_SHA512_End(&context, digest); } /*** SHA-384: *********************************************************/ -void sat_SHA384_Init(SHA384_CTX* context) { +void solv_SHA384_Init(SHA384_CTX* context) { if (context == (SHA384_CTX*)0) { return; } @@ -996,11 +996,11 @@ void sat_SHA384_Init(SHA384_CTX* context) { context->bitcount[0] = context->bitcount[1] = 0; } -void sat_SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - sat_SHA512_Update((SHA512_CTX*)context, data, len); +void solv_SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { + solv_SHA512_Update((SHA512_CTX*)context, data, len); } -void sat_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { +void solv_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -1029,7 +1029,7 @@ void sat_SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { MEMSET_BZERO(context, sizeof(context)); } -char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { +char *solv_SHA384_End(SHA384_CTX* context, char buffer[]) { sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; int i; @@ -1037,7 +1037,7 @@ char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { /* assert(context != (SHA384_CTX*)0); */ if (buffer != (char*)0) { - sat_SHA384_Final(digest, context); + solv_SHA384_Final(digest, context); for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -1052,10 +1052,10 @@ char *sat_SHA384_End(SHA384_CTX* context, char buffer[]) { return buffer; } -char* sat_SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { +char* solv_SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { SHA384_CTX context; - sat_SHA384_Init(&context); - sat_SHA384_Update(&context, data, len); - return sat_SHA384_End(&context, digest); + solv_SHA384_Init(&context); + solv_SHA384_Update(&context, data, len); + return solv_SHA384_End(&context, digest); } @@ -67,20 +67,20 @@ typedef SHA512_CTX SHA384_CTX; /*** SHA-256/384/512 Function Prototypes ******************************/ -void sat_SHA256_Init(SHA256_CTX *); -void sat_SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); -void sat_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); -char* sat_SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); -char* sat_SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); +void solv_SHA256_Init(SHA256_CTX *); +void solv_SHA256_Update(SHA256_CTX*, const uint8_t*, size_t); +void solv_SHA256_Final(uint8_t[SHA256_DIGEST_LENGTH], SHA256_CTX*); +char* solv_SHA256_End(SHA256_CTX*, char[SHA256_DIGEST_STRING_LENGTH]); +char* solv_SHA256_Data(const uint8_t*, size_t, char[SHA256_DIGEST_STRING_LENGTH]); -void sat_SHA384_Init(SHA384_CTX*); -void sat_SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); -void sat_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); -char* sat_SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); -char* sat_SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); +void solv_SHA384_Init(SHA384_CTX*); +void solv_SHA384_Update(SHA384_CTX*, const uint8_t*, size_t); +void solv_SHA384_Final(uint8_t[SHA384_DIGEST_LENGTH], SHA384_CTX*); +char* solv_SHA384_End(SHA384_CTX*, char[SHA384_DIGEST_STRING_LENGTH]); +char* solv_SHA384_Data(const uint8_t*, size_t, char[SHA384_DIGEST_STRING_LENGTH]); -void sat_SHA512_Init(SHA512_CTX*); -void sat_SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); -void sat_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); -char* sat_SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); -char* sat_SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); +void solv_SHA512_Init(SHA512_CTX*); +void solv_SHA512_Update(SHA512_CTX*, const uint8_t*, size_t); +void solv_SHA512_Final(uint8_t[SHA512_DIGEST_LENGTH], SHA512_CTX*); +char* solv_SHA512_End(SHA512_CTX*, char[SHA512_DIGEST_STRING_LENGTH]); +char* solv_SHA512_Data(const uint8_t*, size_t, char[SHA512_DIGEST_STRING_LENGTH]); diff --git a/src/solvable.c b/src/solvable.c index ef9bd4c..2747acc 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -121,7 +121,7 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) cols = pool->nlanguages + 1; if (!pool->languagecache) { - pool->languagecache = sat_calloc(cols * ID_NUM_INTERNAL, sizeof(Id)); + pool->languagecache = solv_calloc(cols * ID_NUM_INTERNAL, sizeof(Id)); pool->languagecacheother = 0; } if (keyname >= ID_NUM_INTERNAL) @@ -132,7 +132,7 @@ solvable_lookup_str_poollang(Solvable *s, Id keyname) break; if (i >= pool->languagecacheother) { - pool->languagecache = sat_realloc2(pool->languagecache, pool->languagecacheother + 1, cols * sizeof(Id)); + pool->languagecache = solv_realloc2(pool->languagecache, pool->languagecacheother + 1, cols * sizeof(Id)); row = pool->languagecache + cols * (ID_NUM_INTERNAL + pool->languagecacheother++); *row = keyname; } @@ -209,7 +209,7 @@ const char * solvable_lookup_checksum(Solvable *s, Id keyname, Id *typep) { const unsigned char *chk = solvable_lookup_bin_checksum(s, keyname, typep); - return chk ? pool_bin2hex(s->repo->pool, chk, sat_chksum_len(*typep)) : 0; + return chk ? pool_bin2hex(s->repo->pool, chk, solv_chksum_len(*typep)) : 0; } static inline const char * diff --git a/src/solver.c b/src/solver.c index eb55f4a..704b380 100644 --- a/src/solver.c +++ b/src/solver.c @@ -144,13 +144,13 @@ makeruledecisions(Solver *solv) queue_push(&solv->decisionq, v); queue_push(&solv->decisionq_why, r - solv->rules); solv->decisionmap[vv] = v > 0 ? 1 : -1; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { Solvable *s = solv->pool->solvables + vv; if (v < 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "conflicting %s (assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "conflicting %s (assertion)\n", pool_solvable2str(solv->pool, s)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "installing %s (assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "installing %s (assertion)\n", pool_solvable2str(solv->pool, s)); } continue; } @@ -205,7 +205,7 @@ makeruledecisions(Solver *solv) } else queue_push(&solv->problems, 0); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflict with system solvable, disabling rule #%d\n", ri); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflict with system solvable, disabling rule #%d\n", ri); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); else @@ -235,7 +235,7 @@ makeruledecisions(Solver *solv) else queue_push(&solv->problems, 0); assert(v > 0 || v == -SYSTEMSOLVABLE); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflict with rpm rule, disabling rule #%d\n", ri); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflict with rpm rule, disabling rule #%d\n", ri); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); else @@ -261,7 +261,7 @@ makeruledecisions(Solver *solv) else queue_push(&solv->problems, 0); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "conflicting update/job assertions over literal %d\n", vv); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "conflicting update/job assertions over literal %d\n", vv); /* * push all of our rules (can only be feature or job rules) @@ -279,9 +279,9 @@ makeruledecisions(Solver *solv) if (MAPTST(&solv->weakrulemap, i)) /* weak: silently ignore */ continue; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, " - disabling rule #%d\n", i); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, " - disabling rule #%d\n", i); - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, solv->rules + i); + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, solv->rules + i); v = i; /* is is a job rule ? */ @@ -329,13 +329,13 @@ makeruledecisions(Solver *solv) queue_push(&solv->decisionq, v); queue_push(&solv->decisionq_why, r - solv->rules); solv->decisionmap[vv] = v > 0 ? 1 : -1; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { Solvable *s = solv->pool->solvables + vv; if (v < 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "conflicting %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "conflicting %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "installing %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "installing %s (weak assertion)\n", pool_solvable2str(solv->pool, s)); } continue; } @@ -347,8 +347,8 @@ makeruledecisions(Solver *solv) if (v < 0 && solv->decisionmap[vv] < 0) continue; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "assertion conflict, but I am weak, disabling "); - solver_printrule(solv, SAT_DEBUG_UNSOLVABLE, r); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "assertion conflict, but I am weak, disabling "); + solver_printrule(solv, SOLV_DEBUG_UNSOLVABLE, r); if (ri >= solv->jobrules && ri < solv->jobrules_end) v = -(solv->ruletojob.elements[ri - solv->jobrules] + 1); @@ -376,7 +376,7 @@ enabledisablelearntrules(Solver *solv) Id why, *whyp; int i; - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "enabledisablelearntrules called\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "enabledisablelearntrules called\n"); for (i = solv->learntrules, r = solv->rules + i; i < solv->nrules; i++, r++) { whyp = solv->learnt_pool.elements + solv->learnt_why.elements[i - solv->learntrules]; @@ -389,19 +389,19 @@ enabledisablelearntrules(Solver *solv) /* why != 0: we found a disabled rule, disable the learnt rule */ if (why && r->d >= 0) { - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "disabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "disabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } solver_disablerule(solv, r); } else if (!why && r->d < 0) { - IF_POOLDEBUG (SAT_DEBUG_SOLUTIONS) + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "re-enabling "); - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); } solver_enablerule(solv, r); } @@ -426,9 +426,9 @@ makewatches(Solver *solv) int i; int nsolvables = solv->pool->nsolvables; - sat_free(solv->watches); + solv_free(solv->watches); /* lower half for removals, upper half for installs */ - solv->watches = sat_calloc(2 * nsolvables, sizeof(Id)); + solv->watches = solv_calloc(2 * nsolvables, sizeof(Id)); #if 1 /* do it reverse so rpm rules get triggered first (XXX: obsolete?) */ for (i = 1, r = solv->rules + solv->nrules - 1; i < solv->nrules; i++, r--) @@ -511,7 +511,7 @@ propagate(Solver *solv, int level) Id *watches = solv->watches + pool->nsolvables; /* place ptr in middle */ - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate -----\n"); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "----- propagate -----\n"); /* foreach non-propagated decision */ while (solv->propagate_index < solv->decisionq.count) @@ -522,10 +522,10 @@ propagate(Solver *solv, int level) */ pkg = -solv->decisionq.elements[solv->propagate_index++]; - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagate for decision %d level %d\n", -pkg, level); - solver_printruleelement(solv, SAT_DEBUG_PROPAGATE, 0, -pkg); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "propagate for decision %d level %d\n", -pkg, level); + solver_printruleelement(solv, SOLV_DEBUG_PROPAGATE, 0, -pkg); } /* foreach rule where 'pkg' is now FALSE */ @@ -542,10 +542,10 @@ propagate(Solver *solv, int level) continue; } - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE," watch triggered "); - solver_printrule(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE," watch triggered "); + solver_printrule(solv, SOLV_DEBUG_PROPAGATE, r); } /* 'pkg' was just decided (was set to FALSE) @@ -611,12 +611,12 @@ propagate(Solver *solv, int level) * if we found some p that is UNDEF or TRUE, move * watch to it */ - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { if (p > 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> move w%d to %s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, p)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE," -> move w%d to !%s\n", (pkg == r->w1 ? 1 : 2), pool_solvid2str(pool, -p)); } *rp = *next_rp; @@ -646,10 +646,10 @@ propagate(Solver *solv, int level) if (DECISIONMAP_FALSE(other_watch)) /* check if literal is FALSE */ return r; /* eek, a conflict! */ - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " unit "); - solver_printrule(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " unit "); + solver_printrule(solv, SOLV_DEBUG_PROPAGATE, r); } if (other_watch > 0) @@ -660,19 +660,19 @@ propagate(Solver *solv, int level) queue_push(&solv->decisionq, other_watch); queue_push(&solv->decisionq_why, r - solv->rules); - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { if (other_watch > 0) - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to install %s\n", pool_solvid2str(pool, other_watch)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> decided to install %s\n", pool_solvid2str(pool, other_watch)); else - POOL_DEBUG(SAT_DEBUG_PROPAGATE, " -> decided to conflict %s\n", pool_solvid2str(pool, -other_watch)); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, " -> decided to conflict %s\n", pool_solvid2str(pool, -other_watch)); } } /* foreach rule involving 'pkg' */ } /* while we have non-decided decisions */ - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "----- propagate end-----\n"); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "----- propagate end-----\n"); return 0; /* all is well */ } @@ -703,13 +703,13 @@ analyze(Solver *solv, int level, Rule *c, int *pr, int *dr, int *whyp) queue_init_buffer(&r, r_buf, sizeof(r_buf)/sizeof(*r_buf)); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "ANALYZE at %d ----------------------\n", level); map_init(&seen, pool->nsolvables); idx = solv->decisionq.count; for (;;) { - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) - solver_printruleclass(solv, SAT_DEBUG_ANALYZE, c); + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) + solver_printruleclass(solv, SOLV_DEBUG_ANALYZE, c); queue_push(&solv->learnt_pool, c - solv->rules); d = c->d < 0 ? -c->d - 1 : c->d; dp = d ? pool->whatprovidesdata + d : 0; @@ -766,7 +766,7 @@ l1retry: *pr = -v; /* so that v doesn't get lost */ if (!l1num) break; - POOL_DEBUG(SAT_DEBUG_ANALYZE, "got %d involved level 1 decisions\n", l1num); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "got %d involved level 1 decisions\n", l1num); /* clear non-l1 bits from seen map */ for (i = 0; i < r.count; i++) { @@ -791,12 +791,12 @@ l1retry: *dr = r.elements[0]; else *dr = pool_queuetowhatprovides(pool, &r); - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) { - POOL_DEBUG(SAT_DEBUG_ANALYZE, "learned rule for level %d (am %d)\n", rlevel, level); - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, *pr); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "learned rule for level %d (am %d)\n", rlevel, level); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, *pr); for (i = 0; i < r.count; i++) - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, r.elements[i]); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, r.elements[i]); } /* push end marker on learnt reasons stack */ queue_push(&solv->learnt_pool, 0); @@ -841,7 +841,7 @@ solver_reset(Solver *solv) /* redo all assertion rule decisions */ makeruledecisions(solv); - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "decisions so far: %d\n", solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "decisions so far: %d\n", solv->decisionq.count); } @@ -857,8 +857,8 @@ analyze_unsolvable_rule(Solver *solv, Rule *r, Id *lastweakp, Map *rseen) int i; Id why = r - solv->rules; - IF_POOLDEBUG (SAT_DEBUG_UNSOLVABLE) - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, r); + IF_POOLDEBUG (SOLV_DEBUG_UNSOLVABLE) + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, r); if (solv->learntrules && why >= solv->learntrules) { if (MAPTST(rseen, why - solv->learntrules)) @@ -928,7 +928,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) Id lastweak; int record_proof = 1; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n"); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "ANALYZE UNSOLVABLE ----------------------\n"); solv->stats_unsolvable++; oldproblemcount = solv->problems.count; oldlearntpoolcount = solv->learnt_pool.count; @@ -1013,8 +1013,8 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) v = -(solv->ruletojob.elements[lastweak - solv->jobrules] + 1); else v = lastweak; - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "disabling "); - solver_printruleclass(solv, SAT_DEBUG_UNSOLVABLE, solv->rules + lastweak); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "disabling "); + solver_printruleclass(solv, SOLV_DEBUG_UNSOLVABLE, solv->rules + lastweak); if (lastweak >= solv->choicerules && lastweak < solv->choicerules_end) solver_disablechoicerules(solv, solv->rules + lastweak); solver_disableproblem(solv, v); @@ -1039,7 +1039,7 @@ analyze_unsolvable(Solver *solv, Rule *cr, int disablerules) solver_reset(solv); return 1; } - POOL_DEBUG(SAT_DEBUG_UNSOLVABLE, "UNSOLVABLE\n"); + POOL_DEBUG(SOLV_DEBUG_UNSOLVABLE, "UNSOLVABLE\n"); return 0; } @@ -1064,7 +1064,7 @@ revert(Solver *solv, int level) vv = v > 0 ? v : -v; if (solv->decisionmap[vv] <= level && solv->decisionmap[vv] >= -level) break; - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "reverting decision %d at %d\n", v, solv->decisionmap[vv]); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "reverting decision %d at %d\n", v, solv->decisionmap[vv]); if (v > 0 && solv->recommendations.count && v == solv->recommendations.elements[solv->recommendations.count - 1]) solv->recommendations.count--; solv->decisionmap[vv] = 0; @@ -1153,10 +1153,10 @@ setpropagatelearn(Solver *solv, int level, Id decision, int disablerules, Id rul break; if (level == 1) return analyze_unsolvable(solv, r, disablerules); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "conflict with rule #%d\n", (int)(r - solv->rules)); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "conflict with rule #%d\n", (int)(r - solv->rules)); l = analyze(solv, level, r, &p, &d, &why); /* learnt rule in p and d */ assert(l > 0 && l < level); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "reverting decisions (level %d -> %d)\n", level, l); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "reverting decisions (level %d -> %d)\n", level, l); level = l; revert(solv, level); r = solver_addrule(solv, p, d); @@ -1178,12 +1178,12 @@ setpropagatelearn(Solver *solv, int level, Id decision, int disablerules, Id rul solv->decisionmap[p > 0 ? p : -p] = p > 0 ? level : -level; queue_push(&solv->decisionq, p); queue_push(&solv->decisionq_why, r - solv->rules); - IF_POOLDEBUG (SAT_DEBUG_ANALYZE) + IF_POOLDEBUG (SOLV_DEBUG_ANALYZE) { - POOL_DEBUG(SAT_DEBUG_ANALYZE, "decision: "); - solver_printruleelement(solv, SAT_DEBUG_ANALYZE, 0, p); - POOL_DEBUG(SAT_DEBUG_ANALYZE, "new rule: "); - solver_printrule(solv, SAT_DEBUG_ANALYZE, r); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "decision: "); + solver_printruleelement(solv, SOLV_DEBUG_ANALYZE, 0, p); + POOL_DEBUG(SOLV_DEBUG_ANALYZE, "new rule: "); + solver_printrule(solv, SOLV_DEBUG_ANALYZE, r); } } return level; @@ -1233,7 +1233,7 @@ selectandinstall(Solver *solv, int level, Queue *dq, int disablerules, Id ruleid } p = dq->elements[0]; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing %s\n", pool_solvid2str(pool, p)); return setpropagatelearn(solv, level, p, disablerules, ruleid); } @@ -1260,7 +1260,7 @@ Solver * solver_create(Pool *pool) { Solver *solv; - solv = (Solver *)sat_calloc(1, sizeof(Solver)); + solv = (Solver *)solv_calloc(1, sizeof(Solver)); solv->pool = pool; solv->installed = pool->installed; @@ -1284,9 +1284,9 @@ solver_create(Pool *pool) map_init(&solv->noupdate, solv->installed ? solv->installed->end - solv->installed->start : 0); solv->recommends_index = 0; - solv->decisionmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); + solv->decisionmap = (Id *)solv_calloc(pool->nsolvables, sizeof(Id)); solv->nrules = 1; - solv->rules = sat_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); + solv->rules = solv_extend_resize(solv->rules, solv->nrules, sizeof(Rule), RULES_BLOCK); memset(solv->rules, 0, sizeof(Rule)); return solv; @@ -1329,14 +1329,14 @@ solver_free(Solver *solv) map_free(&solv->droporphanedmap); map_free(&solv->cleandepsmap); - sat_free(solv->decisionmap); - sat_free(solv->rules); - sat_free(solv->watches); - sat_free(solv->obsoletes); - sat_free(solv->obsoletes_data); - sat_free(solv->multiversionupdaters); - sat_free(solv->choicerules_ref); - sat_free(solv); + solv_free(solv->decisionmap); + solv_free(solv->rules); + solv_free(solv->watches); + solv_free(solv->obsoletes); + solv_free(solv->obsoletes_data); + solv_free(solv->multiversionupdaters); + solv_free(solv->choicerules_ref); + solv_free(solv); } int @@ -1431,19 +1431,19 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) int minimizationsteps; int installedpos = solv->installed ? solv->installed->start : 0; - IF_POOLDEBUG (SAT_DEBUG_RULE_CREATION) + IF_POOLDEBUG (SOLV_DEBUG_RULE_CREATION) { - POOL_DEBUG (SAT_DEBUG_RULE_CREATION, "number of rules: %d\n", solv->nrules); + POOL_DEBUG (SOLV_DEBUG_RULE_CREATION, "number of rules: %d\n", solv->nrules); for (i = 1; i < solv->nrules; i++) - solver_printruleclass(solv, SAT_DEBUG_RULE_CREATION, solv->rules + i); + solver_printruleclass(solv, SOLV_DEBUG_RULE_CREATION, solv->rules + i); } - POOL_DEBUG(SAT_DEBUG_SOLVER, "initial decisions: %d\n", solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "initial decisions: %d\n", solv->decisionq.count); /* start SAT algorithm */ level = 1; systemlevel = level + 1; - POOL_DEBUG(SAT_DEBUG_SOLVER, "solving...\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "solving...\n"); queue_init(&dq); queue_init(&dqs); @@ -1468,7 +1468,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) */ if (level == 1) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "propagating (propagate_index: %d; size decisionq: %d)...\n", solv->propagate_index, solv->decisionq.count); if ((r = propagate(solv, level)) != 0) { if (analyze_unsolvable(solv, r, disablerules)) @@ -1483,7 +1483,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) */ if (level < systemlevel) { - POOL_DEBUG(SAT_DEBUG_SOLVER, "resolving job rules\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "resolving job rules\n"); for (i = solv->jobrules, r = solv->rules + i; i < solv->jobrules_end; i++, r++) { Id l; @@ -1551,7 +1551,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) Repo *installed = solv->installed; int pass; - POOL_DEBUG(SAT_DEBUG_SOLVER, "resolving installed packages\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "resolving installed packages\n"); /* we use two passes if we need to update packages * to create a better user experience */ for (pass = solv->updatemap.size ? 0 : 1; pass < 2; pass++) @@ -1654,12 +1654,12 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) olevel = level; if (solv->cleandepsmap.size && MAPTST(&solv->cleandepsmap, i - installed->start)) { - POOL_DEBUG(SAT_DEBUG_POLICY, "cleandeps erasing %s\n", pool_solvid2str(pool, i)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "cleandeps erasing %s\n", pool_solvid2str(pool, i)); level = setpropagatelearn(solv, level, -i, disablerules, 0); } else { - POOL_DEBUG(SAT_DEBUG_POLICY, "keeping %s\n", pool_solvid2str(pool, i)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "keeping %s\n", pool_solvid2str(pool, i)); level = setpropagatelearn(solv, level, i, disablerules, r - solv->rules); } if (level == 0) @@ -1697,7 +1697,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) * decide */ solv->decisioncnt_resolve = solv->decisionq.count; - POOL_DEBUG(SAT_DEBUG_POLICY, "deciding unresolved rules\n"); + POOL_DEBUG(SOLV_DEBUG_POLICY, "deciding unresolved rules\n"); for (i = 1, n = 1; n < solv->nrules; i++, n++) { if (i == solv->nrules) @@ -1756,10 +1756,10 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) if (p) continue; } - IF_POOLDEBUG (SAT_DEBUG_PROPAGATE) + IF_POOLDEBUG (SOLV_DEBUG_PROPAGATE) { - POOL_DEBUG(SAT_DEBUG_PROPAGATE, "unfulfilled "); - solver_printruleclass(solv, SAT_DEBUG_PROPAGATE, r); + POOL_DEBUG(SOLV_DEBUG_PROPAGATE, "unfulfilled "); + solver_printruleclass(solv, SOLV_DEBUG_PROPAGATE, r); } /* dq.count < 2 cannot happen as this means that * the rule is unit */ @@ -1789,7 +1789,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) { int qcount; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended packages\n"); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended packages\n"); queue_empty(&dq); /* recommended packages */ queue_empty(&dqs); /* supplemented packages */ for (i = 1; i < pool->nsolvables; i++) @@ -1952,9 +1952,9 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) /* simple case, just one package. no need to choose */ p = dq.elements[0]; if (dqs.count) - POOL_DEBUG(SAT_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); else - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); level = setpropagatelearn(solv, level, p, 0, 0); if (level == 0) @@ -1976,7 +1976,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) p = dqs.elements[i]; if (solv->decisionmap[p] || !MAPTST(&dqmap, p)) continue; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing supplemented %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); olevel = level; level = setpropagatelearn(solv, level, p, 0, 0); @@ -2029,7 +2029,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) queue_push(&solv->branches, -level); } p = dq.elements[0]; - POOL_DEBUG(SAT_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_POLICY, "installing recommended %s\n", pool_solvid2str(pool, p)); queue_push(&solv->recommendations, p); olevel = level; level = setpropagatelearn(solv, level, p, 0, 0); @@ -2052,7 +2052,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) int installedone = 0; /* let's see if we can install some unsupported package */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "deciding orphaned packages\n"); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "deciding orphaned packages\n"); for (i = 0; i < solv->orphaned.count; i++) { p = solv->orphaned.elements[i]; @@ -2063,7 +2063,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) continue; if (solv->droporphanedmap.size && MAPTST(&solv->droporphanedmap, p - solv->installed->start)) continue; - POOL_DEBUG(SAT_DEBUG_SOLVER, "keeping orphaned %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "keeping orphaned %s\n", pool_solvid2str(pool, p)); level = setpropagatelearn(solv, level, p, 0, 0); installedone = 1; if (level < olevel) @@ -2082,7 +2082,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) p = solv->orphaned.elements[i]; if (solv->decisionmap[p]) continue; /* already decided */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "removing orphaned %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "removing orphaned %s\n", pool_solvid2str(pool, p)); olevel = level; level = setpropagatelearn(solv, level, -p, 0, 0); if (level < olevel) @@ -2109,7 +2109,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) if (solv->branches.elements[i - 1] < 0) break; p = solv->branches.elements[i]; - POOL_DEBUG(SAT_DEBUG_SOLVER, "branching with %s\n", pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "branching with %s\n", pool_solvid2str(pool, p)); queue_empty(&dq); for (j = i + 1; j < solv->branches.count; j++) queue_push(&dq, solv->branches.elements[j]); @@ -2154,7 +2154,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) /* kill old solvable so that we do not loop */ p = solv->branches.elements[lasti]; solv->branches.elements[lasti] = 0; - POOL_DEBUG(SAT_DEBUG_SOLVER, "minimizing %d -> %d with %s\n", solv->decisionmap[p], lastl, pool_solvid2str(pool, p)); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "minimizing %d -> %d with %s\n", solv->decisionmap[p], lastl, pool_solvid2str(pool, p)); minimizationsteps++; level = lastl; @@ -2172,9 +2172,9 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) break; } - POOL_DEBUG(SAT_DEBUG_STATS, "solver statistics: %d learned rules, %d unsolvable, %d minimization steps\n", solv->stats_learned, solv->stats_unsolvable, minimizationsteps); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver statistics: %d learned rules, %d unsolvable, %d minimization steps\n", solv->stats_learned, solv->stats_unsolvable, minimizationsteps); - POOL_DEBUG(SAT_DEBUG_STATS, "done solving.\n\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "done solving.\n\n"); queue_free(&dq); queue_free(&dqs); if (level == 0) @@ -2187,7 +2187,7 @@ solver_run_sat(Solver *solv, int disablerules, int doweak) solv->decisioncnt_orphan = solv->decisionq.count; } #if 0 - solver_printdecisionq(solv, SAT_DEBUG_RESULT); + solver_printdecisionq(solv, SOLV_DEBUG_RESULT); #endif } @@ -2230,7 +2230,7 @@ removedisabledconflicts(Solver *solv, Queue *removed) if (r->d < 0 && decisionmap[-p]) { /* rule is now disabled, remove from decisionmap */ - POOL_DEBUG(SAT_DEBUG_SOLVER, "removing conflict for package %s[%d]\n", pool_solvid2str(pool, -p), -p); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "removing conflict for package %s[%d]\n", pool_solvid2str(pool, -p), -p); queue_push(removed, -p); queue_push(removed, decisionmap[-p]); decisionmap[-p] = 0; @@ -2293,7 +2293,7 @@ removedisabledconflicts(Solver *solv, Queue *removed) } if (new) { - POOL_DEBUG(SAT_DEBUG_SOLVER, "re-conflicting package %s[%d]\n", pool_solvid2str(pool, -new), -new); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "re-conflicting package %s[%d]\n", pool_solvid2str(pool, -new), -new); decisionmap[-new] = -1; new = 0; n = 0; /* redo all rules */ @@ -2586,16 +2586,16 @@ solver_solve(Solver *solv, Queue *job) int now, solve_start; int hasdupjob = 0; - solve_start = sat_timems(0); + solve_start = solv_timems(0); /* log solver options */ - POOL_DEBUG(SAT_DEBUG_STATS, "solver started\n"); - POOL_DEBUG(SAT_DEBUG_STATS, "fixsystem=%d updatesystem=%d dosplitprovides=%d, noupdateprovide=%d noinfarchcheck=%d\n", solv->fixsystem, solv->updatesystem, solv->dosplitprovides, solv->noupdateprovide, solv->noinfarchcheck); - POOL_DEBUG(SAT_DEBUG_STATS, "distupgrade=%d distupgrade_removeunsupported=%d\n", solv->distupgrade, solv->distupgrade_removeunsupported); - POOL_DEBUG(SAT_DEBUG_STATS, "allowuninstall=%d, allowdowngrade=%d, allowarchchange=%d, allowvendorchange=%d\n", solv->allowuninstall, solv->allowdowngrade, solv->allowarchchange, solv->allowvendorchange); - POOL_DEBUG(SAT_DEBUG_STATS, "promoteepoch=%d, allowselfconflicts=%d\n", pool->promoteepoch, pool->allowselfconflicts); - POOL_DEBUG(SAT_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d, obsoleteusescolors=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides, pool->obsoleteusescolors); - POOL_DEBUG(SAT_DEBUG_STATS, "dontinstallrecommended=%d, ignorealreadyrecommended=%d, dontshowinstalledrecommended=%d\n", solv->dontinstallrecommended, solv->ignorealreadyrecommended, solv->dontshowinstalledrecommended); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver started\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "fixsystem=%d updatesystem=%d dosplitprovides=%d, noupdateprovide=%d noinfarchcheck=%d\n", solv->fixsystem, solv->updatesystem, solv->dosplitprovides, solv->noupdateprovide, solv->noinfarchcheck); + POOL_DEBUG(SOLV_DEBUG_STATS, "distupgrade=%d distupgrade_removeunsupported=%d\n", solv->distupgrade, solv->distupgrade_removeunsupported); + POOL_DEBUG(SOLV_DEBUG_STATS, "allowuninstall=%d, allowdowngrade=%d, allowarchchange=%d, allowvendorchange=%d\n", solv->allowuninstall, solv->allowdowngrade, solv->allowarchchange, solv->allowvendorchange); + POOL_DEBUG(SOLV_DEBUG_STATS, "promoteepoch=%d, allowselfconflicts=%d\n", pool->promoteepoch, pool->allowselfconflicts); + POOL_DEBUG(SOLV_DEBUG_STATS, "obsoleteusesprovides=%d, implicitobsoleteusesprovides=%d, obsoleteusescolors=%d\n", pool->obsoleteusesprovides, pool->implicitobsoleteusesprovides, pool->obsoleteusescolors); + POOL_DEBUG(SOLV_DEBUG_STATS, "dontinstallrecommended=%d, ignorealreadyrecommended=%d, dontshowinstalledrecommended=%d\n", solv->dontinstallrecommended, solv->ignorealreadyrecommended, solv->dontshowinstalledrecommended); /* create whatprovides if not already there */ if (!pool->whatprovides) @@ -2628,7 +2628,7 @@ solver_solve(Solver *solv, Queue *job) map_init(&installcandidatemap, pool->nsolvables); queue_init(&q); - now = sat_timems(0); + now = solv_timems(0); /* * create rules for all package that could be involved with the solving * so called: rpm rules @@ -2678,11 +2678,11 @@ solver_solve(Solver *solv, Queue *job) oldnrules = solv->nrules; FOR_REPO_SOLVABLES(installed, p, s) solver_addrpmrulesforsolvable(solv, s, &addedmap); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for installed solvables\n", solv->nrules - oldnrules); oldnrules = solv->nrules; FOR_REPO_SOLVABLES(installed, p, s) solver_addrpmrulesforupdaters(solv, s, &addedmap, 1); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for updaters of installed solvables\n", solv->nrules - oldnrules); } /* @@ -2719,7 +2719,7 @@ solver_solve(Solver *solv, Queue *job) break; } } - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules for packages involved in a job\n", solv->nrules - oldnrules); /* @@ -2727,7 +2727,7 @@ solver_solve(Solver *solv, Queue *job) */ oldnrules = solv->nrules; solver_addrpmrulesforweak(solv, &addedmap); - POOL_DEBUG(SAT_DEBUG_STATS, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules); + POOL_DEBUG(SOLV_DEBUG_STATS, "added %d rpm rules because of weak dependencies\n", solv->nrules - oldnrules); /* * first pass done, we now have all the rpm rules we need. @@ -2737,7 +2737,7 @@ solver_solve(Solver *solv, Queue *job) * as an empty system (remove all packages) is a valid solution */ - IF_POOLDEBUG (SAT_DEBUG_STATS) + IF_POOLDEBUG (SOLV_DEBUG_STATS) { int possible = 0, installable = 0; for (i = 1; i < pool->nsolvables; i++) @@ -2747,14 +2747,14 @@ solver_solve(Solver *solv, Queue *job) if (MAPTST(&addedmap, i)) possible++; } - POOL_DEBUG(SAT_DEBUG_STATS, "%d of %d installable solvables considered for solving\n", possible, installable); + POOL_DEBUG(SOLV_DEBUG_STATS, "%d of %d installable solvables considered for solving\n", possible, installable); } solver_unifyrules(solv); /* remove duplicate rpm rules */ solv->rpmrules_end = solv->nrules; /* mark end of rpm rules */ - POOL_DEBUG(SAT_DEBUG_STATS, "rpm rule memory usage: %d K\n", solv->nrules * (int)sizeof(Rule) / 1024); - POOL_DEBUG(SAT_DEBUG_STATS, "rpm rule creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "rpm rule memory usage: %d K\n", solv->nrules * (int)sizeof(Rule) / 1024); + POOL_DEBUG(SOLV_DEBUG_STATS, "rpm rule creation took %d ms\n", solv_timems(now)); /* create dup maps if needed. We need the maps early to create our * update rules */ @@ -2873,7 +2873,7 @@ solver_solve(Solver *solv, Queue *job) switch (how & SOLVER_JOBMASK) { case SOLVER_INSTALL: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sinstall %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sinstall %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); if (select == SOLVER_SOLVABLE) { p = what; @@ -2895,7 +2895,7 @@ solver_solve(Solver *solv, Queue *job) solver_addjobrule(solv, p, d, i, weak); break; case SOLVER_ERASE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %s%serase %s\n", weak ? "weak " : "", how & SOLVER_CLEANDEPS ? "clean deps " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %s%serase %s\n", weak ? "weak " : "", how & SOLVER_CLEANDEPS ? "clean deps " : "", solver_select2str(pool, select, what)); if ((how & SOLVER_CLEANDEPS) != 0 && !solv->cleandepsmap.size && solv->installed) map_grow(&solv->cleandepsmap, solv->installed->end - solv->installed->start); if (select == SOLVER_SOLVABLE && solv->installed && pool->solvables[what].repo == solv->installed) @@ -2926,23 +2926,23 @@ solver_solve(Solver *solv, Queue *job) break; case SOLVER_UPDATE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %supdate %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %supdate %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_VERIFY: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sverify %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sverify %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_WEAKENDEPS: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sweaken deps %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sweaken deps %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); if (select != SOLVER_SOLVABLE) break; s = pool->solvables + what; weaken_solvable_deps(solv, what); break; case SOLVER_NOOBSOLETES: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %sno obsolete %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %sno obsolete %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); break; case SOLVER_LOCK: - POOL_DEBUG(SAT_DEBUG_JOB, "job: %slock %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: %slock %s\n", weak ? "weak " : "", solver_select2str(pool, select, what)); FOR_JOB_SELECT(p, pp, select, what) { s = pool->solvables + p; @@ -2950,10 +2950,10 @@ solver_solve(Solver *solv, Queue *job) } break; case SOLVER_DISTUPGRADE: - POOL_DEBUG(SAT_DEBUG_JOB, "job: distupgrade %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: distupgrade %s\n", solver_select2str(pool, select, what)); break; case SOLVER_DROP_ORPHANED: - POOL_DEBUG(SAT_DEBUG_JOB, "job: drop orphaned %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: drop orphaned %s\n", solver_select2str(pool, select, what)); if (select == SOLVER_SOLVABLE_ALL) solv->droporphanedmap_all = 1; FOR_JOB_SELECT(p, pp, select, what) @@ -2967,10 +2967,10 @@ solver_solve(Solver *solv, Queue *job) } break; case SOLVER_USERINSTALLED: - POOL_DEBUG(SAT_DEBUG_JOB, "job: user installed %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: user installed %s\n", solver_select2str(pool, select, what)); break; default: - POOL_DEBUG(SAT_DEBUG_JOB, "job: unknown job\n"); + POOL_DEBUG(SOLV_DEBUG_JOB, "job: unknown job\n"); break; } @@ -2978,15 +2978,15 @@ solver_solve(Solver *solv, Queue *job) * debug */ - IF_POOLDEBUG (SAT_DEBUG_JOB) + IF_POOLDEBUG (SOLV_DEBUG_JOB) { int j; if (solv->nrules == oldnrules) - POOL_DEBUG(SAT_DEBUG_JOB, " - no rule created\n"); + POOL_DEBUG(SOLV_DEBUG_JOB, " - no rule created\n"); for (j = oldnrules; j < solv->nrules; j++) { - POOL_DEBUG(SAT_DEBUG_JOB, " - job "); - solver_printrule(solv, SAT_DEBUG_JOB, solv->rules + j); + POOL_DEBUG(SOLV_DEBUG_JOB, " - job "); + solver_printrule(solv, SOLV_DEBUG_JOB, solv->rules + j); } } } @@ -3031,7 +3031,7 @@ solver_solve(Solver *solv, Queue *job) map_free(&installcandidatemap); queue_free(&q); - POOL_DEBUG(SAT_DEBUG_STATS, "%d rpm rules, %d job rules, %d infarch rules, %d dup rules, %d choice rules\n", solv->rpmrules_end - 1, solv->jobrules_end - solv->jobrules, solv->infarchrules_end - solv->infarchrules, solv->duprules_end - solv->duprules, solv->choicerules_end - solv->choicerules); + POOL_DEBUG(SOLV_DEBUG_STATS, "%d rpm rules, %d job rules, %d infarch rules, %d dup rules, %d choice rules\n", solv->rpmrules_end - 1, solv->jobrules_end - solv->jobrules, solv->infarchrules_end - solv->infarchrules, solv->duprules_end - solv->duprules, solv->choicerules_end - solv->choicerules); /* create weak map */ map_init(&solv->weakrulemap, solv->nrules); @@ -3058,7 +3058,7 @@ solver_solve(Solver *solv, Queue *job) /* make initial decisions based on assertion rules */ makeruledecisions(solv); - POOL_DEBUG(SAT_DEBUG_SOLVER, "problems so far: %d\n", solv->problems.count); + POOL_DEBUG(SOLV_DEBUG_SOLVER, "problems so far: %d\n", solv->problems.count); /* * ******************************************** @@ -3066,9 +3066,9 @@ solver_solve(Solver *solv, Queue *job) * ******************************************** */ - now = sat_timems(0); + now = solv_timems(0); solver_run_sat(solv, 1, solv->dontinstallrecommended ? 0 : 1); - POOL_DEBUG(SAT_DEBUG_STATS, "solver took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver took %d ms\n", solv_timems(now)); /* * calculate recommended/suggested packages @@ -3080,8 +3080,8 @@ solver_solve(Solver *solv, Queue *job) */ solver_prepare_solutions(solv); - POOL_DEBUG(SAT_DEBUG_STATS, "final solver statistics: %d problems, %d learned rules, %d unsolvable\n", solv->problems.count / 2, solv->stats_learned, solv->stats_unsolvable); - POOL_DEBUG(SAT_DEBUG_STATS, "solver_solve took %d ms\n", sat_timems(solve_start)); + POOL_DEBUG(SOLV_DEBUG_STATS, "final solver statistics: %d problems, %d learned rules, %d unsolvable\n", solv->problems.count / 2, solv->stats_learned, solv->stats_unsolvable); + POOL_DEBUG(SOLV_DEBUG_STATS, "solver_solve took %d ms\n", solv_timems(solve_start)); /* return number of problems */ return solv->problems.count ? solv->problems.count / 2 : 0; diff --git a/src/solverdebug.c b/src/solverdebug.c index cd7183b..099b39e 100644 --- a/src/solverdebug.c +++ b/src/solverdebug.c @@ -50,7 +50,7 @@ solver_create_decisions_obsoletesmap(Solver *solv) int i; Solvable *s; - obsoletesmap = (Id *)sat_calloc(pool->nsolvables, sizeof(Id)); + obsoletesmap = (Id *)solv_calloc(pool->nsolvables, sizeof(Id)); if (installed) { for (i = 0; i < solv->decisionq.count; i++) @@ -230,19 +230,19 @@ solver_printproblem(Solver *solv, Id v) Id *jp; if (v > 0) - solver_printruleclass(solv, SAT_DEBUG_SOLUTIONS, solv->rules + v); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, solv->rules + v); else { v = -(v + 1); - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "JOB %d\n", v); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "JOB %d\n", v); jp = solv->ruletojob.elements; for (i = solv->jobrules, r = solv->rules + i; i < solv->jobrules_end; i++, r++, jp++) if (*jp == v) { - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "- "); - solver_printrule(solv, SAT_DEBUG_SOLUTIONS, r); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "- "); + solver_printrule(solv, SOLV_DEBUG_SOLUTIONS, r); } - POOL_DEBUG(SAT_DEBUG_SOLUTIONS, "ENDJOB\n"); + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "ENDJOB\n"); } } @@ -303,8 +303,8 @@ solver_printdecisions(Solver *solv) Solvable *s; Queue iq; - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); - POOL_DEBUG(SAT_DEBUG_RESULT, "transaction:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "transaction:\n"); queue_init(&iq); for (i = 0; i < trans->steps.count; i++) @@ -315,29 +315,29 @@ solver_printdecisions(Solver *solv) switch(type) { case SOLVER_TRANSACTION_MULTIINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " multi install %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi install %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_MULTIREINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " multi reinstall %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " multi reinstall %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_INSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " install %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " install %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_REINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, " reinstall %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " reinstall %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_DOWNGRADE: - POOL_DEBUG(SAT_DEBUG_RESULT, " downgrade %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " downgrade %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_CHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, " change %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " change %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_UPGRADE: case SOLVER_TRANSACTION_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, " upgrade %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " upgrade %s", pool_solvable2str(pool, s)); break; case SOLVER_TRANSACTION_ERASE: - POOL_DEBUG(SAT_DEBUG_RESULT, " erase %s", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " erase %s", pool_solvable2str(pool, s)); break; default: break; @@ -348,7 +348,7 @@ solver_printdecisions(Solver *solv) case SOLVER_TRANSACTION_ERASE: case SOLVER_TRANSACTION_MULTIINSTALL: case SOLVER_TRANSACTION_MULTIREINSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); break; case SOLVER_TRANSACTION_REINSTALL: case SOLVER_TRANSACTION_DOWNGRADE: @@ -358,12 +358,12 @@ solver_printdecisions(Solver *solv) transaction_all_obs_pkgs(trans, p, &iq); if (iq.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, " (obsoletes"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " (obsoletes"); for (j = 0; j < iq.count; j++) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s", pool_solvid2str(pool, iq.elements[j])); - POOL_DEBUG(SAT_DEBUG_RESULT, ")"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s", pool_solvid2str(pool, iq.elements[j])); + POOL_DEBUG(SOLV_DEBUG_RESULT, ")"); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); break; default: break; @@ -371,57 +371,57 @@ solver_printdecisions(Solver *solv) } queue_free(&iq); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); if (solv->recommendations.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "recommended packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "recommended packages:\n"); for (i = 0; i < solv->recommendations.count; i++) { s = pool->solvables + solv->recommendations.elements[i]; if (solv->decisionmap[solv->recommendations.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } if (solv->suggestions.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "suggested packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "suggested packages:\n"); for (i = 0; i < solv->suggestions.count; i++) { s = pool->solvables + solv->suggestions.elements[i]; if (solv->decisionmap[solv->suggestions.elements[i]] > 0) { if (installed && s->repo == installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (installed)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (selected)\n", pool_solvable2str(pool, s)); } else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } if (solv->orphaned.count) { - POOL_DEBUG(SAT_DEBUG_RESULT, "orphaned packages:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "orphaned packages:\n"); for (i = 0; i < solv->orphaned.count; i++) { s = pool->solvables + solv->orphaned.elements[i]; if (solv->decisionmap[solv->orphaned.elements[i]] > 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (kept)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (kept)\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " %s (erased)\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s (erased)\n", pool_solvable2str(pool, s)); } - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } transaction_free(trans); } @@ -452,28 +452,28 @@ transaction_print(Transaction *trans) switch(class) { case SOLVER_TRANSACTION_ERASE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d erased packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d erased packages:\n", cnt); break; case SOLVER_TRANSACTION_INSTALL: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d installed packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d installed packages:\n", cnt); break; case SOLVER_TRANSACTION_REINSTALLED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d reinstalled packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d reinstalled packages:\n", cnt); break; case SOLVER_TRANSACTION_DOWNGRADED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d downgraded packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d downgraded packages:\n", cnt); break; case SOLVER_TRANSACTION_CHANGED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d changed packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d changed packages:\n", cnt); break; case SOLVER_TRANSACTION_UPGRADED: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d upgraded packages:\n", cnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d upgraded packages:\n", cnt); break; case SOLVER_TRANSACTION_VENDORCHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d vendor changes from '%s' to '%s':\n", cnt, id2strnone(pool, classes.elements[i + 2]), id2strnone(pool, classes.elements[i + 3])); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d vendor changes from '%s' to '%s':\n", cnt, id2strnone(pool, classes.elements[i + 2]), id2strnone(pool, classes.elements[i + 3])); break; case SOLVER_TRANSACTION_ARCHCHANGE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%d arch changes from %s to %s:\n", cnt, pool_id2str(pool, classes.elements[i + 2]), pool_id2str(pool, classes.elements[i + 3])); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%d arch changes from %s to %s:\n", cnt, pool_id2str(pool, classes.elements[i + 2]), pool_id2str(pool, classes.elements[i + 3])); break; default: class = SOLVER_TRANSACTION_IGNORE; @@ -495,7 +495,7 @@ transaction_print(Transaction *trans) case SOLVER_TRANSACTION_DOWNGRADED: case SOLVER_TRANSACTION_UPGRADED: s2 = pool->solvables + transaction_obs_pkg(trans, p); - POOL_DEBUG(SAT_DEBUG_RESULT, " - %s -> %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s -> %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, s2)); break; case SOLVER_TRANSACTION_VENDORCHANGE: case SOLVER_TRANSACTION_ARCHCHANGE: @@ -504,12 +504,12 @@ transaction_print(Transaction *trans) if (l + linel > sizeof(line) - 3) { if (*line) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", line); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); *line = 0; linel = 0; } if (l + linel > sizeof(line) - 3) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", n); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", n); else { if (*line) @@ -522,13 +522,13 @@ transaction_print(Transaction *trans) } break; default: - POOL_DEBUG(SAT_DEBUG_RESULT, " - %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - %s\n", pool_solvable2str(pool, s)); break; } } if (*line) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s\n", line); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s\n", line); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } queue_free(&classes); queue_free(&pkgs); @@ -543,55 +543,55 @@ solver_printproblemruleinfo(Solver *solv, Id probr) switch (solver_ruleinfo(solv, probr, &source, &target, &dep)) { case SOLVER_RULE_DISTUPGRADE: - POOL_DEBUG(SAT_DEBUG_RESULT, "%s does not belong to a distupgrade repository\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%s does not belong to a distupgrade repository\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_INFARCH: - POOL_DEBUG(SAT_DEBUG_RESULT, "%s has inferior architecture\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "%s has inferior architecture\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_UPDATE: - POOL_DEBUG(SAT_DEBUG_RESULT, "problem with installed package %s\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "problem with installed package %s\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_JOB: - POOL_DEBUG(SAT_DEBUG_RESULT, "conflicting requests\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "conflicting requests\n"); return; case SOLVER_RULE_JOB_NOTHING_PROVIDES_DEP: - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides requested %s\n", pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "nothing provides requested %s\n", pool_dep2str(pool, dep)); return; case SOLVER_RULE_RPM: - POOL_DEBUG(SAT_DEBUG_RESULT, "some dependency problem\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "some dependency problem\n"); return; case SOLVER_RULE_RPM_NOT_INSTALLABLE: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s is not installable\n", pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s is not installable\n", pool_solvid2str(pool, source)); return; case SOLVER_RULE_RPM_NOTHING_PROVIDES_DEP: - POOL_DEBUG(SAT_DEBUG_RESULT, "nothing provides %s needed by %s\n", pool_dep2str(pool, dep), pool_solvid2str(pool, source)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "nothing provides %s needed by %s\n", pool_dep2str(pool, dep), pool_solvid2str(pool, source)); return; case SOLVER_RULE_RPM_SAME_NAME: - POOL_DEBUG(SAT_DEBUG_RESULT, "cannot install both %s and %s\n", pool_solvid2str(pool, source), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "cannot install both %s and %s\n", pool_solvid2str(pool, source), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_CONFLICT: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s conflicts with %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_INSTALLEDPKG_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "installed package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "installed package %s obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_IMPLICIT_OBSOLETES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s implicitely obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s implicitely obsoletes %s provided by %s\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep), pool_solvid2str(pool, target)); return; case SOLVER_RULE_RPM_PACKAGE_REQUIRES: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s requires %s, but none of the providers can be installed\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); return; case SOLVER_RULE_RPM_SELF_CONFLICT: - POOL_DEBUG(SAT_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "package %s conflicts with %s provided by itself\n", pool_solvid2str(pool, source), pool_dep2str(pool, dep)); return; case SOLVER_RULE_UNKNOWN: case SOLVER_RULE_FEATURE: case SOLVER_RULE_LEARNT: case SOLVER_RULE_CHOICE: - POOL_DEBUG(SAT_DEBUG_RESULT, "bad rule type\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "bad rule type\n"); return; } } @@ -650,28 +650,28 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { case SOLVER_INSTALL: if (select == SOLVER_SOLVABLE && solv->installed && pool->solvables[what].repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not keep %s installed\n", pool_solvid2str(pool, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not keep %s installed\n", pool_solvid2str(pool, what)); else if (select == SOLVER_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install a solvable %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install a solvable %s\n", solver_select2str(pool, select, what)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install %s\n", solver_select2str(pool, select, what)); break; case SOLVER_ERASE: if (select == SOLVER_SOLVABLE && !(solv->installed && pool->solvables[what].repo == solv->installed)) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not forbid installation of %s\n", pool_solvid2str(pool, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not forbid installation of %s\n", pool_solvid2str(pool, what)); else if (select == SOLVER_SOLVABLE_PROVIDES) - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not deinstall all solvables %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not deinstall all solvables %s\n", solver_select2str(pool, select, what)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not deinstall %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not deinstall %s\n", solver_select2str(pool, select, what)); break; case SOLVER_UPDATE: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not install most recent version of %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not install most recent version of %s\n", solver_select2str(pool, select, what)); break; case SOLVER_LOCK: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do not lock %s\n", solver_select2str(pool, select, what)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do not lock %s\n", solver_select2str(pool, select, what)); break; default: - POOL_DEBUG(SAT_DEBUG_RESULT, " - do something different\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - do something different\n"); break; } } @@ -679,17 +679,17 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { s = pool->solvables + rp; if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - keep %s despite the inferior architecture\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - keep %s despite the inferior architecture\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - install %s despite the inferior architecture\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - install %s despite the inferior architecture\n", pool_solvable2str(pool, s)); } else if (p == SOLVER_SOLUTION_DISTUPGRADE) { s = pool->solvables + rp; if (solv->installed && s->repo == solv->installed) - POOL_DEBUG(SAT_DEBUG_RESULT, " - keep obsolete %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - keep obsolete %s\n", pool_solvable2str(pool, s)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - install %s from excluded repository\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - install %s from excluded repository\n", pool_solvable2str(pool, s)); } else { @@ -700,22 +700,22 @@ solver_printsolution(Solver *solv, Id problem, Id solution) { int illegal = policy_is_illegal(solv, s, sd, 0); if ((illegal & POLICY_ILLEGAL_DOWNGRADE) != 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow downgrade of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow downgrade of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); if ((illegal & POLICY_ILLEGAL_ARCHCHANGE) != 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow architecture change of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow architecture change of %s to %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); if ((illegal & POLICY_ILLEGAL_VENDORCHANGE) != 0) { if (sd->vendor) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to '%s' (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_id2str(pool, sd->vendor), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to '%s' (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_id2str(pool, sd->vendor), pool_solvable2str(pool, sd)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to no vendor (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow vendor change from '%s' (%s) to no vendor (%s)\n", pool_id2str(pool, s->vendor), pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); } if (!illegal) - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow replacement of %s with %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow replacement of %s with %s\n", pool_solvable2str(pool, s), pool_solvable2str(pool, sd)); } else { - POOL_DEBUG(SAT_DEBUG_RESULT, " - allow deinstallation of %s\n", pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " - allow deinstallation of %s\n", pool_solvable2str(pool, s)); } } } @@ -728,25 +728,25 @@ solver_printallsolutions(Solver *solv) int pcnt; Id problem, solution; - POOL_DEBUG(SAT_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "Encountered problems! Here are the solutions:\n\n"); pcnt = 0; problem = 0; while ((problem = solver_next_problem(solv, problem)) != 0) { pcnt++; - POOL_DEBUG(SAT_DEBUG_RESULT, "Problem %d:\n", pcnt); - POOL_DEBUG(SAT_DEBUG_RESULT, "====================================\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "Problem %d:\n", pcnt); + POOL_DEBUG(SOLV_DEBUG_RESULT, "====================================\n"); #if 1 solver_printprobleminfo(solv, problem); #else solver_printcompleteprobleminfo(solv, problem); #endif - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); solution = 0; while ((solution = solver_next_solution(solv, problem, solution)) != 0) { solver_printsolution(solv, problem, solution); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); } } } @@ -776,10 +776,10 @@ solver_printtrivial(Solver *solv) } queue_init(&out); solver_trivial_installable(solv, &in, &out); - POOL_DEBUG(SAT_DEBUG_RESULT, "trivial installable status:\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, "trivial installable status:\n"); for (i = 0; i < in.count; i++) - POOL_DEBUG(SAT_DEBUG_RESULT, " %s: %d\n", pool_solvid2str(pool, in.elements[i]), out.elements[i]); - POOL_DEBUG(SAT_DEBUG_RESULT, "\n"); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %s: %d\n", pool_solvid2str(pool, in.elements[i]), out.elements[i]); + POOL_DEBUG(SOLV_DEBUG_RESULT, "\n"); queue_free(&in); queue_free(&out); } diff --git a/src/solvversion.c b/src/solvversion.c new file mode 100644 index 0000000..d66e195 --- /dev/null +++ b/src/solvversion.c @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2009, Novell Inc. + * + * This program is licensed under the BSD license, read LICENSE.BSD + * for further information + */ + +#include "solvversion.h" + +const char solv_version[] = LIBSOLV_VERSION_STRING; +int solv_version_major = LIBSOLV_VERSION_MAJOR; +int solv_version_minor = LIBSOLV_VERSION_MINOR; +int solv_version_patch = LIBSOLV_VERSION_PATCH; diff --git a/src/satversion.h.in b/src/solvversion.h.in index 1154741..268219c 100644 --- a/src/satversion.h.in +++ b/src/solvversion.h.in @@ -6,12 +6,12 @@ */ /* - * satversion.h + * solvversion.h * */ -#ifndef LIBSOLV_SATVERSION_H -#define LIBSOLV_SATVERSION_H +#ifndef LIBSOLV_SOLVVERSION_H +#define LIBSOLV_SOLVVERSION_H #define LIBSOLV_VERSION_STRING "@VERSION@" #define LIBSOLV_VERSION_MAJOR @LIBSOLV_MAJOR@ @@ -19,9 +19,9 @@ #define LIBSOLV_VERSION_PATCH @LIBSOLV_PATCH@ #define LIBSOLV_VERSION (LIBSOLV_VERSION_MAJOR * 10000 + LIBSOLV_VERSION_MINOR * 100 + LIBSOLV_VERSION_PATCH) -extern const char sat_version[]; -extern int sat_version_major; -extern int sat_version_minor; -extern int sat_version_patch; +extern const char solv_version[]; +extern int solv_version_major; +extern int solv_version_minor; +extern int solv_version_patch; #endif diff --git a/src/strpool.c b/src/strpool.c index d2c7a8a..0b47367 100644 --- a/src/strpool.c +++ b/src/strpool.c @@ -24,8 +24,8 @@ stringpool_init(Stringpool *ss, const char *strs[]) totalsize += strlen(strs[count]) + 1; // alloc appropriate space - ss->stringspace = sat_extend_resize(0, totalsize, 1, STRINGSPACE_BLOCK); - ss->strings = sat_extend_resize(0, count, sizeof(Offset), STRING_BLOCK); + ss->stringspace = solv_extend_resize(0, totalsize, 1, STRINGSPACE_BLOCK); + ss->strings = solv_extend_resize(0, count, sizeof(Offset), STRING_BLOCK); // now copy predefined strings into allocated space ss->sstrings = 0; @@ -41,15 +41,15 @@ stringpool_init(Stringpool *ss, const char *strs[]) void stringpool_free(Stringpool *ss) { - sat_free(ss->strings); - sat_free(ss->stringspace); - sat_free(ss->stringhashtbl); + solv_free(ss->strings); + solv_free(ss->stringspace); + solv_free(ss->stringhashtbl); } void stringpool_freehash(Stringpool *ss) { - ss->stringhashtbl = sat_free(ss->stringhashtbl); + ss->stringhashtbl = solv_free(ss->stringhashtbl); ss->stringhashmask = 0; } @@ -68,9 +68,9 @@ void stringpool_clone(Stringpool *ss, Stringpool *from) { memset(ss, 0, sizeof(*ss)); - ss->strings = sat_extend_resize(0, from->nstrings, sizeof(Offset), STRING_BLOCK); + ss->strings = solv_extend_resize(0, from->nstrings, sizeof(Offset), STRING_BLOCK); memcpy(ss->strings, from->strings, from->nstrings * sizeof(Offset)); - ss->stringspace = sat_extend_resize(0, from->sstrings, 1, STRINGSPACE_BLOCK); + ss->stringspace = solv_extend_resize(0, from->sstrings, 1, STRINGSPACE_BLOCK); memcpy(ss->stringspace, from->stringspace, from->sstrings); ss->nstrings = from->nstrings; ss->sstrings = from->sstrings; @@ -98,11 +98,11 @@ stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create // expand hashtable if needed if (ss->nstrings * 2 > hashmask) { - sat_free(hashtbl); + solv_free(hashtbl); // realloc hash table ss->stringhashmask = hashmask = mkmask(ss->nstrings + STRING_BLOCK); - ss->stringhashtbl = hashtbl = (Hashtable)sat_calloc(hashmask + 1, sizeof(Id)); + ss->stringhashtbl = hashtbl = (Hashtable)solv_calloc(hashmask + 1, sizeof(Id)); // rehash all strings into new hashtable for (i = 1; i < ss->nstrings; i++) @@ -133,11 +133,11 @@ stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create id = ss->nstrings++; hashtbl[h] = id; - ss->strings = sat_extend(ss->strings, id, 1, sizeof(Offset), STRING_BLOCK); + ss->strings = solv_extend(ss->strings, id, 1, sizeof(Offset), STRING_BLOCK); ss->strings[id] = ss->sstrings; /* we will append to the end */ // append string to stringspace - ss->stringspace = sat_extend(ss->stringspace, ss->sstrings, len + 1, 1, STRINGSPACE_BLOCK); + ss->stringspace = solv_extend(ss->stringspace, ss->sstrings, len + 1, 1, STRINGSPACE_BLOCK); memcpy(ss->stringspace + ss->sstrings, str, len); ss->stringspace[ss->sstrings + len] = 0; ss->sstrings += len + 1; @@ -157,6 +157,6 @@ stringpool_str2id(Stringpool *ss, const char *str, int create) void stringpool_shrink(Stringpool *ss) { - ss->stringspace = sat_extend_resize(ss->stringspace, ss->sstrings, 1, STRINGSPACE_BLOCK); - ss->strings = sat_extend_resize(ss->strings, ss->nstrings, sizeof(Offset), STRING_BLOCK); + ss->stringspace = solv_extend_resize(ss->stringspace, ss->sstrings, 1, STRINGSPACE_BLOCK); + ss->strings = solv_extend_resize(ss->strings, ss->nstrings, sizeof(Offset), STRING_BLOCK); } diff --git a/src/transaction.c b/src/transaction.c index 4ef7cd0..f098749 100644 --- a/src/transaction.c +++ b/src/transaction.c @@ -89,7 +89,7 @@ transaction_all_obs_pkgs(Transaction *trans, Id p, Queue *pkgs) } /* sort obsoleters */ if (pkgs->count > 2) - sat_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); + solv_sort(pkgs->elements, pkgs->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); for (i = 0; i < pkgs->count; i += 2) pkgs->elements[i / 2] = pkgs->elements[i + 1]; pkgs->count /= 2; @@ -466,7 +466,7 @@ transaction_classify(Transaction *trans, int mode, Queue *classes) } /* now sort all vendor/arch changes */ if (classes->count > 4) - sat_sort(classes->elements, classes->count / 4, 4 * sizeof(Id), classify_cmp, trans); + solv_sort(classes->elements, classes->count / 4, 4 * sizeof(Id), classify_cmp, trans); /* finally add all classes. put erases last */ i = SOLVER_TRANSACTION_ERASE; if (ntypes[i]) @@ -531,7 +531,7 @@ transaction_classify_pkgs(Transaction *trans, int mode, Id class, Id from, Id to } } if (pkgs->count > 1) - sat_sort(pkgs->elements, pkgs->count, sizeof(Id), classify_cmp_pkgs, trans); + solv_sort(pkgs->elements, pkgs->count, sizeof(Id), classify_cmp_pkgs, trans); } static void @@ -545,7 +545,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) Solvable *s, *s2; queue_empty(ti); - trans->transaction_installed = sat_free(trans->transaction_installed); + trans->transaction_installed = solv_free(trans->transaction_installed); if (!installed) return; /* no info needed */ for (i = 0; i < decisionq->count; i++) @@ -593,7 +593,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) } } } - sat_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); + solv_sort(ti->elements, ti->count / 2, 2 * sizeof(Id), obsq_sortcmp, pool); /* now unify */ for (i = j = 0; i < ti->count; i += 2) { @@ -605,7 +605,7 @@ create_transaction_info(Transaction *trans, Queue *decisionq) ti->count = j; /* create transaction_installed helper */ - trans->transaction_installed = sat_calloc(installed->end - installed->start, sizeof(Id)); + trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); for (i = 0; i < ti->count; i += 2) { j = ti->elements[i + 1] - installed->start; @@ -793,7 +793,7 @@ struct _TransactionOrderdata { Transaction * transaction_create(Pool *pool) { - Transaction *trans = sat_calloc(1, sizeof(*trans)); + Transaction *trans = solv_calloc(1, sizeof(*trans)); trans->pool = pool; return trans; } @@ -807,7 +807,7 @@ transaction_create_clone(Transaction *srctrans) if (srctrans->transaction_installed) { Repo *installed = srctrans->pool->installed; - trans->transaction_installed = sat_calloc(installed->end - installed->start, sizeof(Id)); + trans->transaction_installed = solv_calloc(installed->end - installed->start, sizeof(Id)); memcpy(trans->transaction_installed, srctrans->transaction_installed, (installed->end - installed->start) * sizeof(Id)); } map_init_clone(&trans->transactsmap, &srctrans->transactsmap); @@ -815,11 +815,11 @@ transaction_create_clone(Transaction *srctrans) if (srctrans->orderdata) { struct _TransactionOrderdata *od = srctrans->orderdata; - trans->orderdata = sat_calloc(1, sizeof(*trans->orderdata)); - trans->orderdata->tes = sat_malloc2(od->ntes, sizeof(*od->tes)); + trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata)); + trans->orderdata->tes = solv_malloc2(od->ntes, sizeof(*od->tes)); memcpy(trans->orderdata->tes, od->tes, od->ntes * sizeof(*od->tes)); trans->orderdata->ntes = od->ntes; - trans->orderdata->invedgedata = sat_malloc2(od->ninvedgedata, sizeof(Id)); + trans->orderdata->invedgedata = solv_malloc2(od->ninvedgedata, sizeof(Id)); memcpy(trans->orderdata->invedgedata, od->invedgedata, od->ninvedgedata * sizeof(Id)); trans->orderdata->ninvedgedata = od->ninvedgedata; } @@ -831,7 +831,7 @@ transaction_free(Transaction *trans) { queue_free(&trans->steps); queue_free(&trans->transaction_info); - trans->transaction_installed = sat_free(trans->transaction_installed); + trans->transaction_installed = solv_free(trans->transaction_installed); map_free(&trans->transactsmap); map_free(&trans->noobsmap); transaction_free_orderdata(trans); @@ -844,9 +844,9 @@ transaction_free_orderdata(Transaction *trans) if (trans->orderdata) { struct _TransactionOrderdata *od = trans->orderdata; - od->tes = sat_free(od->tes); - od->invedgedata = sat_free(od->invedgedata); - trans->orderdata = sat_free(trans->orderdata); + od->tes = solv_free(od->tes); + od->invedgedata = solv_free(od->invedgedata); + trans->orderdata = solv_free(trans->orderdata); } } @@ -891,12 +891,12 @@ addteedge(struct orderdata *od, int from, int to, int type) /* printf("tail add %d\n", i - te->edges); */ if (!i) te->edges = ++i; - od->edgedata = sat_extend(od->edgedata, od->nedgedata, 3, sizeof(Id), EDGEDATA_BLOCK); + od->edgedata = solv_extend(od->edgedata, od->nedgedata, 3, sizeof(Id), EDGEDATA_BLOCK); } else { /* printf("extend %d\n", i - te->edges); */ - od->edgedata = sat_extend(od->edgedata, od->nedgedata, 3 + (i - te->edges), sizeof(Id), EDGEDATA_BLOCK); + od->edgedata = solv_extend(od->edgedata, od->nedgedata, 3 + (i - te->edges), sizeof(Id), EDGEDATA_BLOCK); if (i > te->edges) memcpy(od->edgedata + od->nedgedata, od->edgedata + te->edges, sizeof(Id) * (i - te->edges)); i = od->nedgedata + (i - te->edges); @@ -1345,17 +1345,17 @@ breakcycle(struct orderdata *od, Id *cycle) /* cycle recorded, print it */ if (ddegmin >= TYPE_REQ && (ddegmax & TYPE_PREREQ) != 0) - POOL_DEBUG(SAT_DEBUG_STATS, "CRITICAL "); - POOL_DEBUG(SAT_DEBUG_STATS, "cycle: --> "); + POOL_DEBUG(SOLV_DEBUG_STATS, "CRITICAL "); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle: --> "); for (k = 0; cycle[k + 1]; k += 2) { te = od->tes + cycle[k]; if ((od->edgedata[cycle[k + 1] + 1] & TYPE_BROKEN) != 0) - POOL_DEBUG(SAT_DEBUG_STATS, "%s ##%x##> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s ##%x##> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); else - POOL_DEBUG(SAT_DEBUG_STATS, "%s --%x--> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); + POOL_DEBUG(SOLV_DEBUG_STATS, "%s --%x--> ", pool_solvid2str(pool, te->p), od->edgedata[cycle[k + 1] + 1]); } - POOL_DEBUG(SAT_DEBUG_STATS, "\n"); + POOL_DEBUG(SOLV_DEBUG_STATS, "\n"); } static inline void @@ -1370,21 +1370,21 @@ dump_tes(struct orderdata *od) for (i = 1, te = od->tes + i; i < od->ntes; i++, te++) { Solvable *s = pool->solvables + te->p; - POOL_DEBUG(SAT_DEBUG_RESULT, "TE %4d: %c%s\n", i, s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, "TE %4d: %c%s\n", i, s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); if (s->repo != pool->installed) { queue_empty(&obsq); transaction_all_obs_pkgs(od->trans, te->p, &obsq); for (j = 0; j < obsq.count; j++) - POOL_DEBUG(SAT_DEBUG_RESULT, " -%s\n", pool_solvid2str(pool, obsq.elements[j])); + POOL_DEBUG(SOLV_DEBUG_RESULT, " -%s\n", pool_solvid2str(pool, obsq.elements[j])); } for (j = te->edges; od->edgedata[j]; j += 2) { te2 = od->tes + od->edgedata[j]; if ((od->edgedata[j + 1] & TYPE_BROKEN) == 0) - POOL_DEBUG(SAT_DEBUG_RESULT, " --%x--> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " --%x--> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); else - POOL_DEBUG(SAT_DEBUG_RESULT, " ##%x##> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " ##%x##> TE %4d: %s\n", od->edgedata[j + 1], od->edgedata[j], pool_solvid2str(pool, te2->p)); } } } @@ -1556,15 +1556,15 @@ transaction_order(Transaction *trans, int flags) int lastmedia; Id *temedianr; - start = now = sat_timems(0); - POOL_DEBUG(SAT_DEBUG_STATS, "ordering transaction\n"); + start = now = solv_timems(0); + POOL_DEBUG(SOLV_DEBUG_STATS, "ordering transaction\n"); /* free old data if present */ if (trans->orderdata) { struct _TransactionOrderdata *od = trans->orderdata; - od->tes = sat_free(od->tes); - od->invedgedata = sat_free(od->invedgedata); - trans->orderdata = sat_free(trans->orderdata); + od->tes = solv_free(od->tes); + od->invedgedata = solv_free(od->invedgedata); + trans->orderdata = solv_free(trans->orderdata); } /* create a transaction element for every active component */ @@ -1577,7 +1577,7 @@ transaction_order(Transaction *trans, int flags) continue; numte++; } - POOL_DEBUG(SAT_DEBUG_STATS, "transaction elements: %d\n", numte); + POOL_DEBUG(SOLV_DEBUG_STATS, "transaction elements: %d\n", numte); if (!numte) return; /* nothing to do... */ @@ -1585,8 +1585,8 @@ transaction_order(Transaction *trans, int flags) memset(&od, 0, sizeof(od)); od.trans = trans; od.ntes = numte; - od.tes = sat_calloc(numte, sizeof(*od.tes)); - od.edgedata = sat_extend(0, 0, 1, sizeof(Id), EDGEDATA_BLOCK); + od.tes = solv_calloc(numte, sizeof(*od.tes)); + od.edgedata = solv_extend(0, 0, 1, sizeof(Id), EDGEDATA_BLOCK); od.edgedata[0] = 0; od.nedgedata = 1; queue_init(&od.cycles); @@ -1611,14 +1611,14 @@ transaction_order(Transaction *trans, int flags) for (i = 1, te = od.tes + i; i < numte; i++, te++) for (j = te->edges; od.edgedata[j]; j += 2) numedge++; - POOL_DEBUG(SAT_DEBUG_STATS, "edges: %d, edge space: %d\n", numedge, od.nedgedata / 2); - POOL_DEBUG(SAT_DEBUG_STATS, "edge creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "edges: %d, edge space: %d\n", numedge, od.nedgedata / 2); + POOL_DEBUG(SOLV_DEBUG_STATS, "edge creation took %d ms\n", solv_timems(now)); #if 0 dump_tes(&od); #endif - now = sat_timems(0); + now = solv_timems(0); /* kill all cycles */ queue_init(&todo); for (i = numte - 1; i > 0; i--) @@ -1696,10 +1696,10 @@ transaction_order(Transaction *trans, int flags) /* restart with start of cycle */ todo.count = cycstart + 1; } - POOL_DEBUG(SAT_DEBUG_STATS, "cycles broken: %d\n", od.ncycles); - POOL_DEBUG(SAT_DEBUG_STATS, "cycle breaking took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycles broken: %d\n", od.ncycles); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle breaking took %d ms\n", solv_timems(now)); - now = sat_timems(0); + now = solv_timems(0); /* now go through all broken cycles and create cycle edges to help the ordering */ for (i = od.cycles.count - 3; i >= 0; i -= 3) @@ -1712,14 +1712,14 @@ transaction_order(Transaction *trans, int flags) if (od.cycles.elements[i + 2] < TYPE_REQ) addcycleedges(&od, od.cyclesdata.elements + od.cycles.elements[i], &todo); } - POOL_DEBUG(SAT_DEBUG_STATS, "cycle edge creation took %d ms\n", sat_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "cycle edge creation took %d ms\n", solv_timems(now)); #if 0 dump_tes(&od); #endif /* all edges are finally set up and there are no cycles, now the easy part. * Create an ordered transaction */ - now = sat_timems(0); + now = solv_timems(0); /* first invert all edges */ for (i = 1, te = od.tes + i; i < numte; i++, te++) te->mark = 1; /* term 0 */ @@ -1738,8 +1738,8 @@ transaction_order(Transaction *trans, int flags) te->mark += j; j = te->mark; } - POOL_DEBUG(SAT_DEBUG_STATS, "invedge space: %d\n", j + 1); - od.invedgedata = sat_calloc(j + 1, sizeof(Id)); + POOL_DEBUG(SOLV_DEBUG_STATS, "invedge space: %d\n", j + 1); + od.invedgedata = solv_calloc(j + 1, sizeof(Id)); for (i = 1, te = od.tes + i; i < numte; i++, te++) { for (j = te->edges; od.edgedata[j]; j += 2) @@ -1751,7 +1751,7 @@ transaction_order(Transaction *trans, int flags) } for (i = 1, te = od.tes + i; i < numte; i++, te++) te->edges = te->mark; /* edges now points into invedgedata */ - od.edgedata = sat_free(od.edgedata); + od.edgedata = solv_free(od.edgedata); od.nedgedata = j + 1; /* now the final ordering */ @@ -1780,7 +1780,7 @@ transaction_order(Transaction *trans, int flags) lastrepo = 0; lastmedia = 0; - temedianr = sat_calloc(numte, sizeof(Id)); + temedianr = solv_calloc(numte, sizeof(Id)); for (i = 1; i < numte; i++) { Solvable *s = pool->solvables + od.tes[i].p; @@ -1852,7 +1852,7 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata } } } - sat_free(temedianr); + solv_free(temedianr); queue_free(&todo); queue_free(&samerepoq); queue_free(&uninstq); @@ -1864,12 +1864,12 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata transaction_add_obsoleted(trans); assert(tr->count == oldcount); - POOL_DEBUG(SAT_DEBUG_STATS, "creating new transaction took %d ms\n", sat_timems(now)); - POOL_DEBUG(SAT_DEBUG_STATS, "transaction ordering took %d ms\n", sat_timems(start)); + POOL_DEBUG(SOLV_DEBUG_STATS, "creating new transaction took %d ms\n", solv_timems(now)); + POOL_DEBUG(SOLV_DEBUG_STATS, "transaction ordering took %d ms\n", solv_timems(start)); if ((flags & SOLVER_TRANSACTION_KEEP_ORDERDATA) != 0) { - trans->orderdata = sat_calloc(1, sizeof(*trans->orderdata)); + trans->orderdata = solv_calloc(1, sizeof(*trans->orderdata)); trans->orderdata->tes = od.tes; trans->orderdata->ntes = numte; trans->orderdata->invedgedata = od.invedgedata; @@ -1877,8 +1877,8 @@ printf("free %s [%d]\n", pool_solvid2str(pool, te2->p), temedianr[od.invedgedata } else { - sat_free(od.tes); - sat_free(od.invedgedata); + solv_free(od.tes); + solv_free(od.invedgedata); } } @@ -2049,7 +2049,7 @@ transaction_check_pkg(Transaction *trans, Id tepkg, Id pkg, Map *ins, Map *seen, } if (!good) { - POOL_DEBUG(SAT_DEBUG_RESULT, " %c%s: nothing provides %s needed by %c%s\n", pool->solvables[tepkg].repo == pool->installed ? '-' : '+', pool_solvid2str(pool, tepkg), pool_dep2str(pool, req), s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); + POOL_DEBUG(SOLV_DEBUG_RESULT, " %c%s: nothing provides %s needed by %c%s\n", pool->solvables[tepkg].repo == pool->installed ? '-' : '+', pool_solvid2str(pool, tepkg), pool_dep2str(pool, req), s->repo == pool->installed ? '-' : '+', pool_solvable2str(pool, s)); } } } @@ -2064,7 +2064,7 @@ transaction_check_order(Transaction *trans) Map ins, seen; int i; - POOL_DEBUG(SAT_WARN, "\nchecking transaction order...\n"); + POOL_DEBUG(SOLV_WARN, "\nchecking transaction order...\n"); map_init(&ins, pool->nsolvables); map_init(&seen, pool->nsolvables); if (pool->installed) @@ -2089,5 +2089,5 @@ transaction_check_order(Transaction *trans) } map_free(&seen); map_free(&ins); - POOL_DEBUG(SAT_WARN, "transaction order check done.\n"); + POOL_DEBUG(SOLV_WARN, "transaction order check done.\n"); } @@ -16,7 +16,7 @@ #include "util.h" void -sat_oom(size_t num, size_t len) +solv_oom(size_t num, size_t len) { if (num) fprintf(stderr, "Out of memory allocating %zu*%zu bytes!\n", num, len); @@ -27,44 +27,44 @@ sat_oom(size_t num, size_t len) } void * -sat_malloc(size_t len) +solv_malloc(size_t len) { void *r = malloc(len ? len : 1); if (!r) - sat_oom(0, len); + solv_oom(0, len); return r; } void * -sat_malloc2(size_t num, size_t len) +solv_malloc2(size_t num, size_t len) { if (len && (num * len) / len != num) - sat_oom(num, len); - return sat_malloc(num * len); + solv_oom(num, len); + return solv_malloc(num * len); } void * -sat_realloc(void *old, size_t len) +solv_realloc(void *old, size_t len) { if (old == 0) old = malloc(len ? len : 1); else old = realloc(old, len ? len : 1); if (!old) - sat_oom(0, len); + solv_oom(0, len); return old; } void * -sat_realloc2(void *old, size_t num, size_t len) +solv_realloc2(void *old, size_t num, size_t len) { if (len && (num * len) / len != num) - sat_oom(num, len); - return sat_realloc(old, num * len); + solv_oom(num, len); + return solv_realloc(old, num * len); } void * -sat_calloc(size_t num, size_t len) +solv_calloc(size_t num, size_t len) { void *r; if (num == 0 || len == 0) @@ -72,12 +72,12 @@ sat_calloc(size_t num, size_t len) else r = calloc(num, len); if (!r) - sat_oom(num, len); + solv_oom(num, len); return r; } void * -sat_free(void *mem) +solv_free(void *mem) { if (mem) free(mem); @@ -85,7 +85,7 @@ sat_free(void *mem) } unsigned int -sat_timems(unsigned int subtract) +solv_timems(unsigned int subtract) { struct timeval tv; unsigned int r; @@ -107,7 +107,7 @@ sat_timems(unsigned int subtract) # if HAVE_QSORT_R || HAVE___QSORT_R void -sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) +solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) { # if HAVE_QSORT_R qsort_r(base, nmemb, size, compar, compard); @@ -124,38 +124,38 @@ sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, cons #else /* not glibc */ -struct sat_sort_data { +struct solv_sort_data { int (*compar)(const void *, const void *, void *); void *compard; }; static int -sat_sort_helper(void *compard, const void *a, const void *b) +solv_sort_helper(void *compard, const void *a, const void *b) { - struct sat_sort_data *d = compard; + struct solv_sort_data *d = compard; return (*d->compar)(a, b, d->compard); } void -sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) +solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard) { - struct sat_sort_data d; + struct solv_sort_data d; d.compar = compar; d.compard = compard; - qsort_r(base, nmemb, size, &d, sat_sort_helper); + qsort_r(base, nmemb, size, &d, solv_sort_helper); } #endif char * -sat_dupjoin(const char *str1, const char *str2, const char *str3) +solv_dupjoin(const char *str1, const char *str2, const char *str3) { int l1, l2, l3; char *s, *str; l1 = str1 ? strlen(str1) : 0; l2 = str2 ? strlen(str2) : 0; l3 = str3 ? strlen(str3) : 0; - s = str = sat_malloc(l1 + l2 + l3 + 1); + s = str = solv_malloc(l1 + l2 + l3 + 1); if (l1) { strcpy(s, str1); @@ -176,15 +176,15 @@ sat_dupjoin(const char *str1, const char *str2, const char *str3) } char * -sat_dupappend(const char *str1, const char *str2, const char *str3) +solv_dupappend(const char *str1, const char *str2, const char *str3) { - char *str = sat_dupjoin(str1, str2, str3); - sat_free((void *)str1); + char *str = solv_dupjoin(str1, str2, str3); + solv_free((void *)str1); return str; } int -sat_hex2bin(const char **strp, unsigned char *buf, int bufl) +solv_hex2bin(const char **strp, unsigned char *buf, int bufl) { const char *str = *strp; int i; @@ -219,7 +219,7 @@ sat_hex2bin(const char **strp, unsigned char *buf, int bufl) } char * -sat_bin2hex(const unsigned char *buf, int l, char *str) +solv_bin2hex(const unsigned char *buf, int l, char *str) { int i; for (i = 0; i < l; i++, buf++) @@ -20,32 +20,32 @@ * malloc * exits with error message on error */ -extern void *sat_malloc(size_t); -extern void *sat_malloc2(size_t, size_t); -extern void *sat_calloc(size_t, size_t); -extern void *sat_realloc(void *, size_t); -extern void *sat_realloc2(void *, size_t, size_t); -extern void *sat_free(void *); -extern void sat_oom(size_t, size_t); -extern unsigned int sat_timems(unsigned int subtract); -extern void sat_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard); -extern char *sat_dupjoin(const char *str1, const char *str2, const char *str3); -extern char *sat_dupappend(const char *str1, const char *str2, const char *str3); -extern int sat_hex2bin(const char **strp, unsigned char *buf, int bufl); -extern char *sat_bin2hex(const unsigned char *buf, int l, char *str); +extern void *solv_malloc(size_t); +extern void *solv_malloc2(size_t, size_t); +extern void *solv_calloc(size_t, size_t); +extern void *solv_realloc(void *, size_t); +extern void *solv_realloc2(void *, size_t, size_t); +extern void *solv_free(void *); +extern void solv_oom(size_t, size_t); +extern unsigned int solv_timems(unsigned int subtract); +extern void solv_sort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *, void *), void *compard); +extern char *solv_dupjoin(const char *str1, const char *str2, const char *str3); +extern char *solv_dupappend(const char *str1, const char *str2, const char *str3); +extern int solv_hex2bin(const char **strp, unsigned char *buf, int bufl); +extern char *solv_bin2hex(const unsigned char *buf, int l, char *str); -static inline void *sat_extend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) +static inline void *solv_extend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) { if (nmemb == 1) { if ((len & block) == 0) - buf = sat_realloc2(buf, len + (1 + block), size); + buf = solv_realloc2(buf, len + (1 + block), size); } else { if (((len - 1) | block) != ((len + nmemb - 1) | block)) - buf = sat_realloc2(buf, (len + (nmemb + block)) & ~block, size); + buf = solv_realloc2(buf, (len + (nmemb + block)) & ~block, size); } return buf; } @@ -58,26 +58,26 @@ static inline void *sat_extend(void *buf, size_t len, size_t nmemb, size_t size, * size size of each element * block block size used to allocate the elements */ -static inline void *sat_zextend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) +static inline void *solv_zextend(void *buf, size_t len, size_t nmemb, size_t size, size_t block) { - buf = sat_extend(buf, len, nmemb, size, block); + buf = solv_extend(buf, len, nmemb, size, block); memset((char *)buf + len * size, 0, nmemb * size); return buf; } -static inline void *sat_extend_resize(void *buf, size_t len, size_t size, size_t block) +static inline void *solv_extend_resize(void *buf, size_t len, size_t size, size_t block) { if (len) - buf = sat_realloc2(buf, (len + block) & ~block, size); + buf = solv_realloc2(buf, (len + block) & ~block, size); return buf; } -static inline void *sat_calloc_block(size_t len, size_t size, size_t block) +static inline void *solv_calloc_block(size_t len, size_t size, size_t block) { void *buf; if (!len) return 0; - buf = sat_malloc2((len + block) & ~block, size); + buf = solv_malloc2((len + block) & ~block, size); memset(buf, 0, ((len + block) & ~block) * size); return buf; } |