solv->allowarchchange = 1;
solv->allowvendorchange = 1;
}
+ if (mainmode == MODE_ERASE)
+ solv->allowuninstall = 1; /* don't nag */
+
// queue_push2(&job, SOLVER_DISTUPGRADE, 3);
solver_solve(solv, &job);
if (!solv->problems.count)
printf("Transaction summary:\n\n");
solver_printtransaction(solv);
-#if 1
+#ifndef FEDORA
if (1)
{
DUChanges duc[4];
duc[3].path = "/etc";
transaction_calc_duchanges(trans, duc, 4);
for (i = 0; i < 4; i++)
- printf("duchanges %s: %d K %d\n", duc[i].path, duc[i].kbytes, duc[i].files);
- printf("install size change: %d K\n", transaction_calc_installsizechange(trans));
+ printf("duchanges %s: %d K %d inodes\n", duc[i].path, duc[i].kbytes, duc[i].files);
}
#endif
+ printf("install size change: %d K\n", transaction_calc_installsizechange(trans));
+ printf("\n");
if (!yesno("OK to continue (y/n)? "))
{
if (newpkgs)
{
- printf("Downloading %d packages\n", newpkgs);
+ int downloadsize = 0;
+ for (i = 0; i < newpkgs; i++)
+ {
+ Solvable *s;
+
+ p = checkq.elements[i];
+ s = pool_id2solvable(pool, p);
+ downloadsize += solvable_lookup_num(s, SOLVABLE_DOWNLOADSIZE, 0);
+ }
+ printf("Downloading %d packages, %d K\n", newpkgs, downloadsize);
newpkgsfps = sat_calloc(newpkgs, sizeof(*newpkgsfps));
for (i = 0; i < newpkgs; i++)
{
void
pool_freeidhashes(Pool *pool)
{
- pool->ss.stringhashtbl = sat_free(pool->ss.stringhashtbl);
- pool->ss.stringhashmask = 0;
+ stringpool_freehash(&pool->ss);
pool->relhashtbl = sat_free(pool->relhashtbl);
pool->relhashmask = 0;
}
}
void
+stringpool_freehash(Stringpool *ss)
+{
+ ss->stringhashtbl = sat_free(ss->stringhashtbl);
+ ss->stringhashmask = 0;
+}
+
+void
stringpool_init_empty(Stringpool *ss)
{
const char *emptystrs[] = {
}
Id
-stringpool_strn2id(Stringpool *ss, const char *str, unsigned len, int create)
+stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create)
{
Hashval h;
unsigned int hh;
Hashmask hashmask;
- int i, space_needed;
+ int i;
Id id;
Hashtable hashtbl;
// check string
if (!str)
return STRID_NULL;
- if (!*str)
+ if (!len)
return STRID_EMPTY;
hashmask = ss->stringhashmask;
hashtbl = ss->stringhashtbl;
// expand hashtable if needed
- //
- //
if (ss->nstrings * 2 > hashmask)
{
sat_free(hashtbl);
}
// compute hash and check for match
-
h = strnhash(str, len) & hashmask;
hh = HASHCHAIN_START;
while ((id = hashtbl[h]) != 0) // follow hash overflow chain
hashtbl[h] = id;
ss->strings = sat_extend(ss->strings, id, 1, sizeof(Offset), STRING_BLOCK);
- // 'pointer' into stringspace is Offset of next free pos: sstrings
- ss->strings[id] = ss->sstrings;
-
- space_needed = len + 1;
- // make room in string buffer
- ss->stringspace = sat_extend(ss->stringspace, ss->sstrings, space_needed, 1, STRINGSPACE_BLOCK);
- // copy new string into buffer
- memcpy(ss->stringspace + ss->sstrings, str, space_needed - 1);
- // add the sentinel, we can't rely on it being in the source string (in
- // case the LEN is not really strlen(str))
- ss->stringspace[ss->sstrings + space_needed - 1] = 0;
- // next free pos is behind new string
- ss->sstrings += space_needed;
+ 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);
+ memcpy(ss->stringspace + ss->sstrings, str, len);
+ ss->stringspace[ss->sstrings + len] = 0;
+ ss->sstrings += len + 1;
return id;
}
return STRID_NULL;
if (!*str)
return STRID_EMPTY;
- unsigned len = strlen(str);
- return stringpool_strn2id(ss, str, len, create);
+ return stringpool_strn2id(ss, str, (unsigned int)strlen(str), create);
}
void
void stringpool_init_empty(Stringpool *ss);
void stringpool_clone(Stringpool *ss, Stringpool *from);
void stringpool_free(Stringpool *ss);
+void stringpool_freehash(Stringpool *ss);
-Id stringpool_str2id (Stringpool *ss, const char *str, int create);
-Id stringpool_strn2id (Stringpool *ss, const char *str, unsigned int len, int create);
-void stringpool_shrink (Stringpool *ss);
+Id stringpool_str2id(Stringpool *ss, const char *str, int create);
+Id stringpool_strn2id(Stringpool *ss, const char *str, unsigned int len, int create);
+
+void stringpool_shrink(Stringpool *ss);
static inline const char *
-stringpool_id2str (Stringpool *ss, Id id)
+stringpool_id2str(Stringpool *ss, Id id)
{
return ss->stringspace + ss->strings[id];
}