diff options
-rw-r--r-- | bindings/solv.i | 4 | ||||
-rw-r--r-- | examples/solv.c | 2 | ||||
-rw-r--r-- | ext/repo_deb.c | 4 | ||||
-rw-r--r-- | ext/repo_deltainfoxml.c | 8 | ||||
-rw-r--r-- | ext/repo_mdk.c | 9 | ||||
-rw-r--r-- | ext/repo_rpmdb.c | 6 | ||||
-rw-r--r-- | ext/repo_rpmmd.c | 10 | ||||
-rw-r--r-- | ext/repo_susetags.c | 6 | ||||
-rw-r--r-- | src/libsolv.ver | 1 | ||||
-rw-r--r-- | src/pool.c | 10 | ||||
-rw-r--r-- | src/pool.h | 2 | ||||
-rw-r--r-- | src/pooltypes.h | 13 | ||||
-rw-r--r-- | src/repo.c | 8 | ||||
-rw-r--r-- | src/repo.h | 4 | ||||
-rw-r--r-- | src/repo_solv.c | 27 | ||||
-rw-r--r-- | src/repo_write.c | 1 | ||||
-rw-r--r-- | src/repodata.c | 8 | ||||
-rw-r--r-- | src/repodata.h | 4 | ||||
-rw-r--r-- | src/solvable.c | 18 | ||||
-rw-r--r-- | src/solvable.h | 5 |
20 files changed, 87 insertions, 63 deletions
diff --git a/bindings/solv.i b/bindings/solv.i index abb28a7..43da77f 100644 --- a/bindings/solv.i +++ b/bindings/solv.i @@ -1165,7 +1165,7 @@ typedef struct { Id lookup_id(Id entry, Id keyname) { return repo_lookup_id($self, entry, keyname); } - unsigned int lookup_num(Id entry, Id keyname, unsigned int notfound = 0) { + unsigned long long lookup_num(Id entry, Id keyname, unsigned long long notfound = 0) { return repo_lookup_num($self, entry, keyname, notfound); } void write(FILE *fp) { @@ -1661,7 +1661,7 @@ typedef struct { Id lookup_id(Id keyname) { return pool_lookup_id($self->pool, $self->id, keyname); } - unsigned int lookup_num(Id keyname, unsigned int notfound = 0) { + unsigned long long lookup_num(Id keyname, unsigned long long notfound = 0) { return pool_lookup_num($self->pool, $self->id, keyname, notfound); } bool lookup_void(Id keyname) { diff --git a/examples/solv.c b/examples/solv.c index 4baa6cf..d9e33d8 100644 --- a/examples/solv.c +++ b/examples/solv.c @@ -3167,7 +3167,7 @@ rerunsolver: p = checkq.elements[i]; s = pool_id2solvable(pool, p); - downloadsize += solvable_lookup_num(s, SOLVABLE_DOWNLOADSIZE, 0); + downloadsize += solvable_lookup_sizek(s, SOLVABLE_DOWNLOADSIZE, 0); } printf("Downloading %d packages, %d K\n", newpkgs, downloadsize); newpkgsfps = solv_calloc(newpkgs, sizeof(*newpkgsfps)); diff --git a/ext/repo_deb.c b/ext/repo_deb.c index fcd4ebb..4f86390 100644 --- a/ext/repo_deb.c +++ b/ext/repo_deb.c @@ -252,7 +252,7 @@ control2solvable(Solvable *s, Repodata *data, char *control) break; case 'I' << 8 | 'N': if (!strcasecmp(tag, "installed-size")) - repodata_set_num(data, s - pool->solvables, SOLVABLE_INSTALLSIZE, atoi(q)); + repodata_set_num(data, s - pool->solvables, SOLVABLE_INSTALLSIZE, strtoull(q, 0, 10) << 10); break; case 'M' << 8 | 'D': if (!strcasecmp(tag, "md5sum") && !checksumtype && strlen(q) == 16 * 2) @@ -592,7 +592,7 @@ repo_add_debs(Repo *repo, const char **debs, int ndebs, int flags) control2solvable(s, data, (char *)ctar); repodata_set_location(data, s - pool->solvables, 0, 0, debs[i]); if (S_ISREG(stb.st_mode)) - repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024)); + repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size); if (gotpkgid) repodata_set_bin_checksum(data, s - pool->solvables, SOLVABLE_PKGID, REPOKEY_TYPE_MD5, pkgid); solv_free(ctar); diff --git a/ext/repo_deltainfoxml.c b/ext/repo_deltainfoxml.c index d5ec023..5e6e86e 100644 --- a/ext/repo_deltainfoxml.c +++ b/ext/repo_deltainfoxml.c @@ -81,8 +81,8 @@ struct deltarpm { Id locname; Id locevr; Id locsuffix; - unsigned buildtime; - unsigned downloadsize, archivesize; + unsigned int buildtime; + unsigned long long downloadsize; char *filechecksum; int filechecksumtype; /* Baseversion. deltarpm only has one. */ @@ -394,7 +394,7 @@ endElement(void *userData, const char *name) repodata_set_id(pd->data, handle, DELTA_LOCATION_EVR, d->locevr); repodata_set_id(pd->data, handle, DELTA_LOCATION_SUFFIX, d->locsuffix); if (d->downloadsize) - repodata_set_num(pd->data, handle, DELTA_DOWNLOADSIZE, (d->downloadsize + 1023) / 1024); + repodata_set_num(pd->data, handle, DELTA_DOWNLOADSIZE, d->downloadsize); if (d->filechecksum) repodata_set_checksum(pd->data, handle, DELTA_CHECKSUM, d->filechecksumtype, d->filechecksum); if (d->seqnum) @@ -418,7 +418,7 @@ endElement(void *userData, const char *name) pd->delta.filechecksum = solv_strdup(pd->content); break; case STATE_SIZE: - pd->delta.downloadsize = atoi(pd->content); + pd->delta.downloadsize = strtoull(pd->content, 0, 10); break; case STATE_SEQUENCE: if ((str = pd->content)) diff --git a/ext/repo_mdk.c b/ext/repo_mdk.c index c393b50..43b6f2e 100644 --- a/ext/repo_mdk.c +++ b/ext/repo_mdk.c @@ -114,10 +114,7 @@ repo_add_mdk(Repo *repo, FILE *fp, int flags) if (!s) s = pool_id2solvable(pool, repo_add_solvable(repo)); if (!strncmp(buf + 1, "filesize@", 9)) - { - unsigned long filesize = strtoul(buf + 10, 0, 10); - repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, (unsigned int)((filesize + 1023) / 1024)); - } + repodata_set_num(data, s - pool->solvables, SOLVABLE_DOWNLOADSIZE, strtoull(buf + 10, 0, 10)); else if (!strncmp(buf + 1, "summary@", 8)) repodata_set_str(data, s - pool->solvables, SOLVABLE_SUMMARY, buf + 9); else if (!strncmp(buf + 1, "provides@", 9)) @@ -144,7 +141,6 @@ repo_add_mdk(Repo *repo, FILE *fp, int flags) if ((sizestr = strchr(epochstr, '@')) != 0) { char *groupstr; - unsigned long size; *sizestr++ = 0; if ((groupstr = strchr(sizestr, '@')) != 0) { @@ -155,8 +151,7 @@ repo_add_mdk(Repo *repo, FILE *fp, int flags) if (*groupstr) repodata_set_poolstr(data, s - pool->solvables, SOLVABLE_GROUP, groupstr); } - size = strtoul(sizestr, 0, 10); - repodata_set_num(data, s - pool->solvables, SOLVABLE_INSTALLSIZE, (unsigned int)((size + 1023) / 1024)); + repodata_set_num(data, s - pool->solvables, SOLVABLE_INSTALLSIZE, strtoull(sizestr, 0, 10)); } } filename = pool_tmpjoin(pool, nvra, ".rpm", 0); diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index 58786ee..39cedd7 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -969,7 +969,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead, repodata_set_num(data, handle, SOLVABLE_INSTALLTIME, u32); u32 = headint32(rpmhead, TAG_SIZE); if (u32) - repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, (u32 + 1023) / 1024); + repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, u32); if (sourcerpm) addsourcerpm(pool, data, handle, sourcerpm, name, evr); if ((flags & RPM_ADD_TRIGGERS) != 0) @@ -1127,7 +1127,7 @@ solvable_copy_cb(void *vcbdata, Solvable *r, Repodata *fromdata, Repokey *key, K repodata_set_void(data, handle, keyname); break; case REPOKEY_TYPE_NUM: - repodata_set_num(data, handle, keyname, kv->num); + repodata_set_num(data, handle, keyname, SOLV_KV_NUM64(kv)); break; case REPOKEY_TYPE_CONSTANT: repodata_set_constant(data, handle, keyname, kv->num); @@ -1935,7 +1935,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms, int flags) Id handle = s - pool->solvables; repodata_set_location(data, handle, 0, 0, rpms[i]); if (S_ISREG(stb.st_mode)) - repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024)); + repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (unsigned long long)stb.st_size); repodata_set_num(data, handle, SOLVABLE_HEADEREND, headerend); if (gotpkgid) repodata_set_bin_checksum(data, handle, SOLVABLE_PKGID, REPOKEY_TYPE_MD5, pkgid); diff --git a/ext/repo_rpmmd.c b/ext/repo_rpmmd.c index efb134c..efde4fd 100644 --- a/ext/repo_rpmmd.c +++ b/ext/repo_rpmmd.c @@ -834,17 +834,17 @@ startElement(void *userData, const char *name, const char **atts) } case STATE_SIZE: { - unsigned int k; + unsigned long long k; str = find_attr("installed", atts); - if (str && (k = atoi(str)) != 0) - repodata_set_num(pd->data, handle, SOLVABLE_INSTALLSIZE, (k + 1023) / 1024); + if (str && (k = strtoull(str, 0, 10)) != 0) + repodata_set_num(pd->data, handle, SOLVABLE_INSTALLSIZE, k); /* XXX the "package" attribute gives the size of the rpm file, i.e. the download size. Except on packman, there it seems to be something else entirely, it has a value near to the other two values, as if the rpm is uncompressed. */ str = find_attr("package", atts); - if (str && (k = atoi(str)) != 0) - repodata_set_num(pd->data, handle, SOLVABLE_DOWNLOADSIZE, (k + 1023) / 1024); + if (str && (k = strtoull(str, 0, 10)) != 0) + repodata_set_num(pd->data, handle, SOLVABLE_DOWNLOADSIZE, k); break; } case STATE_HEADERRANGE: diff --git a/ext/repo_susetags.c b/ext/repo_susetags.c index 4a42a0a..501916e 100644 --- a/ext/repo_susetags.c +++ b/ext/repo_susetags.c @@ -747,7 +747,7 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int } case CTAG('=', 'S', 'i', 'z'): if (split(line + 6, sp, 3) == 2) - repodata_set_num(data, handle, DELTA_DOWNLOADSIZE, (unsigned int)(atoi(sp[0]) + 1023) / 1024); + repodata_set_num(data, handle, DELTA_DOWNLOADSIZE, strtoull(sp[0], 0, 10)); continue; case CTAG('=', 'P', 'k', 'g'): case CTAG('=', 'P', 'a', 't'): @@ -990,8 +990,8 @@ repo_add_susetags(Repo *repo, FILE *fp, Id defvendor, const char *language, int case CTAG('=', 'S', 'i', 'z'): if (split(line + 6, sp, 3) == 2) { - repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, (unsigned int)(atoi(sp[0]) + 1023) / 1024); - repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, (unsigned int)(atoi(sp[1]) + 1023) / 1024); + repodata_set_num(data, handle, SOLVABLE_DOWNLOADSIZE, strtoull(sp[0], 0, 10)); + repodata_set_num(data, handle, SOLVABLE_INSTALLSIZE, strtoull(sp[1], 0, 10)); } continue; case CTAG('=', 'T', 'i', 'm'): diff --git a/src/libsolv.ver b/src/libsolv.ver index 9c77fc4..78f6d35 100644 --- a/src/libsolv.ver +++ b/src/libsolv.ver @@ -252,6 +252,7 @@ SOLV_1.0 { solvable_lookup_id; solvable_lookup_idarray; solvable_lookup_num; + solvable_lookup_sizek; solvable_lookup_str; solvable_lookup_str_lang; solvable_lookup_str_poollang; @@ -1709,7 +1709,7 @@ pool_calc_installsizechange(Pool *pool, Map *installedmap) continue; if (!MAPTST(installedmap, sp)) continue; - change += solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0); + change += solvable_lookup_sizek(s, SOLVABLE_INSTALLSIZE, 0); } if (oldinstalled) { @@ -1717,7 +1717,7 @@ pool_calc_installsizechange(Pool *pool, Map *installedmap) { if (MAPTST(installedmap, sp)) continue; - change -= solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0); + change -= solvable_lookup_sizek(s, SOLVABLE_INSTALLSIZE, 0); } } return change; @@ -1961,12 +1961,12 @@ pool_lookup_id(Pool *pool, Id entry, Id keyname) return solvable_lookup_id(pool->solvables + entry, keyname); } -unsigned int -pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned int notfound) +unsigned long long +pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned long long notfound) { if (entry == SOLVID_POS && pool->pos.repo) { - unsigned int value; + unsigned long long value; if (repodata_lookup_num(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, &value)) return value; return notfound; @@ -312,7 +312,7 @@ void pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queu const char *pool_lookup_str(Pool *pool, Id entry, Id keyname); Id pool_lookup_id(Pool *pool, Id entry, Id keyname); -unsigned int pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned int notfound); +unsigned long long pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned long long notfound); int pool_lookup_void(Pool *pool, Id entry, Id keyname); const unsigned char *pool_lookup_bin_checksum(Pool *pool, Id entry, Id keyname, Id *typep); const char *pool_lookup_checksum(Pool *pool, Id entry, Id keyname, Id *typep); diff --git a/src/pooltypes.h b/src/pooltypes.h index 51f6521..9dce9b7 100644 --- a/src/pooltypes.h +++ b/src/pooltypes.h @@ -24,19 +24,8 @@ #define SOLV_VERSION_7 7 #define SOLV_VERSION_8 8 -/* The format of .solv files might change incompatibly, and that is described - by the above version number. But sometimes we also extend the emitted - attributes (e.g. by adding a new one for solvables, for instance patch - category). Consumers need to know if the .solv file they have needs to - be regenerated by newer converters or not (or better, if regenerating them - would give a different .solv file). We use this serial number for that. - We increase it every time we add or remove attributes (or change the - interpretation of them). Tools installed by the user will have their - version compiled in, so they can detect mismatches between .solv files - they see and themself. */ -#define SOLV_CONTENT_VERSION 1 - #define SOLV_FLAG_PREFIX_POOL 4 +#define SOLV_FLAG_SIZE_BYTES 8 struct _Stringpool; typedef struct _Stringpool Stringpool; @@ -1089,12 +1089,12 @@ repo_lookup_str(Repo *repo, Id entry, Id keyname) } -unsigned int -repo_lookup_num(Repo *repo, Id entry, Id keyname, unsigned int notfound) +unsigned long long +repo_lookup_num(Repo *repo, Id entry, Id keyname, unsigned long long notfound) { Repodata *data; int i; - unsigned int value; + unsigned long long value; if (entry >= 0) { @@ -1403,7 +1403,7 @@ repo_set_id(Repo *repo, Id p, Id keyname, Id id) } void -repo_set_num(Repo *repo, Id p, Id keyname, unsigned int num) +repo_set_num(Repo *repo, Id p, Id keyname, unsigned long long num) { Repodata *data; if (p >= 0) @@ -124,7 +124,7 @@ void repo_search(Repo *repo, Id p, Id key, const char *match, int flags, int (*c Id repo_lookup_type(Repo *repo, Id entry, Id keyname); const char *repo_lookup_str(Repo *repo, Id entry, Id keyname); /* returns the integer value of the attribute, or notfound if not found */ -unsigned int repo_lookup_num(Repo *repo, Id entry, Id keyname, unsigned int notfound); +unsigned long long repo_lookup_num(Repo *repo, Id entry, Id keyname, unsigned long long notfound); Id repo_lookup_id(Repo *repo, Id entry, Id keyname); int repo_lookup_idarray(Repo *repo, Id entry, Id keyname, Queue *q); int repo_lookup_deparray(Repo *repo, Id entry, Id keyname, Queue *q, Id marker); @@ -133,7 +133,7 @@ const char *repo_lookup_checksum(Repo *repo, Id entry, Id keyname, Id *typep); const unsigned char *repo_lookup_bin_checksum(Repo *repo, Id entry, Id keyname, Id *typep); void repo_set_id(Repo *repo, Id p, Id keyname, Id id); -void repo_set_num(Repo *repo, Id p, Id keyname, unsigned int num); +void repo_set_num(Repo *repo, Id p, Id keyname, unsigned long long num); void repo_set_str(Repo *repo, Id p, Id keyname, const char *str); void repo_set_poolstr(Repo *repo, Id p, Id keyname, const char *str); void repo_add_poolstr_array(Repo *repo, Id p, Id keyname, const char *str); diff --git a/src/repo_solv.c b/src/repo_solv.c index 307811c..8c629ce 100644 --- a/src/repo_solv.c +++ b/src/repo_solv.c @@ -324,6 +324,23 @@ incore_add_id(Repodata *data, Id sx) } static void +incore_add_sizek(Repodata *data, unsigned int sx) +{ + if (sx < (1 << 22)) + incore_add_id(data, (Id)(sx << 10)); + else + { + if ((sx >> 25) != 0) + { + incore_add_id(data, (Id)(sx >> 25)); + data->incoredata[data->incoredatalen - 1] |= 128; + } + incore_add_id(data, (Id)((sx << 10) | 0x80000000)); + data->incoredata[data->incoredatalen - 5] = (sx >> 18) | 128; + } +} + +static void incore_add_ideof(Repodata *data, Id sx, int eof) { unsigned int x = (unsigned int)sx; @@ -1247,6 +1264,16 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key } keyp = schemadata + schemata[id]; break; + case REPOKEY_TYPE_NUM: + if (!(solvflags & SOLV_FLAG_SIZE_BYTES) && keys[key].storage == KEY_STORAGE_INCORE && + (id == SOLVABLE_INSTALLSIZE || id == SOLVABLE_DOWNLOADSIZE || id == DELTA_DOWNLOADSIZE)) + { + /* old solv file with sizes in kilos. transcode. */ + dp = data_read_id(dp, &id); + incore_add_sizek(&data, (unsigned int)id); + break; + } + /* FALLTHROUGH */ default: if (id == RPM_RPMDBID && s && (keys[key].type == REPOKEY_TYPE_U32 || keys[key].type == REPOKEY_TYPE_NUM)) { diff --git a/src/repo_write.c b/src/repo_write.c index a56c477..7c4e0f9 100644 --- a/src/repo_write.c +++ b/src/repo_write.c @@ -1757,6 +1757,7 @@ fprintf(stderr, "dir %d used %d\n", i, cbdata.dirused ? cbdata.dirused[i] : 1); write_u32(fp, target.nschemata); solv_flags = 0; solv_flags |= SOLV_FLAG_PREFIX_POOL; + solv_flags |= SOLV_FLAG_SIZE_BYTES; write_u32(fp, solv_flags); /* diff --git a/src/repodata.c b/src/repodata.c index a282159..41b7b8d 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -678,7 +678,7 @@ repodata_lookup_str(Repodata *data, Id solvid, Id keyname) } int -repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned int *value) +repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned long long *value) { unsigned char *dp; Repokey *key; @@ -694,7 +694,7 @@ repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned int *value) { kv.num = kv.num2 = 0; dp = data_fetch(dp, &kv, key); - *value = kv.num2 ? ~(unsigned int)0 : kv.num; + *value = SOLV_KV_NUM64(&kv); return 1; } return 0; @@ -1989,7 +1989,7 @@ repodata_set_id(Repodata *data, Id solvid, Id keyname, Id id) } void -repodata_set_num(Repodata *data, Id solvid, Id keyname, unsigned int num) +repodata_set_num(Repodata *data, Id solvid, Id keyname, unsigned long long num) { Repokey key; key.name = keyname; @@ -3000,7 +3000,7 @@ repodata_create_stubs(Repodata *data) repodata_set_void(sdata, SOLVID_META, di.key->name); break; case REPOKEY_TYPE_NUM: - repodata_set_num(sdata, SOLVID_META, di.key->name, di.kv.num); + repodata_set_num(sdata, SOLVID_META, di.key->name, SOLV_KV_NUM64(&di.kv)); break; case REPOKEY_TYPE_MD5: case REPOKEY_TYPE_SHA1: diff --git a/src/repodata.h b/src/repodata.h index 0e622a6..b224920 100644 --- a/src/repodata.h +++ b/src/repodata.h @@ -201,7 +201,7 @@ int repodata_filelistfilter_matches(Repodata *data, const char *str); Id repodata_lookup_type(Repodata *data, Id solvid, Id keyname); Id repodata_lookup_id(Repodata *data, Id solvid, Id keyname); const char *repodata_lookup_str(Repodata *data, Id solvid, Id keyname); -int repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned int *value); +int repodata_lookup_num(Repodata *data, Id solvid, Id keyname, unsigned long long *value); int repodata_lookup_void(Repodata *data, Id solvid, Id keyname); const unsigned char *repodata_lookup_bin_checksum(Repodata *data, Id solvid, Id keyname, Id *typep); int repodata_lookup_idarray(Repodata *data, Id solvid, Id keyname, Queue *q); @@ -229,7 +229,7 @@ Id repodata_new_handle(Repodata *data); /* basic types: void, num, string, Id */ void repodata_set_void(Repodata *data, Id solvid, Id keyname); -void repodata_set_num(Repodata *data, Id solvid, Id keyname, unsigned int num); +void repodata_set_num(Repodata *data, Id solvid, Id keyname, unsigned long long num); void repodata_set_id(Repodata *data, Id solvid, Id keyname, Id id); void repodata_set_str(Repodata *data, Id solvid, Id keyname, const char *str); void repodata_set_binary(Repodata *data, Id solvid, Id keyname, void *buf, int len); diff --git a/src/solvable.c b/src/solvable.c index 77a694e..4e46eaf 100644 --- a/src/solvable.c +++ b/src/solvable.c @@ -200,14 +200,24 @@ solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang, int usebase) return solvable_lookup_str(s, keyname); } -unsigned int -solvable_lookup_num(Solvable *s, Id keyname, unsigned int notfound) +unsigned long long +solvable_lookup_num(Solvable *s, Id keyname, unsigned long long notfound) { if (!s->repo) return notfound; return repo_lookup_num(s->repo, s - s->repo->pool->solvables, keyname, notfound); } +unsigned int +solvable_lookup_sizek(Solvable *s, Id keyname, unsigned int notfound) +{ + unsigned long long size; + if (!s->repo) + return notfound; + size = solvable_lookup_num(s, keyname, (unsigned long long)notfound << 10); + return (unsigned int)((size + 1023) >> 10); +} + int solvable_lookup_void(Solvable *s, Id keyname) { @@ -633,11 +643,11 @@ solvable_selfprovidedep(Solvable *s) void solvable_set_id(Solvable *s, Id keyname, Id id) { - repo_set_num(s->repo, s - s->repo->pool->solvables, keyname, id); + repo_set_id(s->repo, s - s->repo->pool->solvables, keyname, id); } void -solvable_set_num(Solvable *s, Id keyname, unsigned int num) +solvable_set_num(Solvable *s, Id keyname, unsigned long long num) { repo_set_num(s->repo, s - s->repo->pool->solvables, keyname, num); } diff --git a/src/solvable.h b/src/solvable.h index 7ecc6cf..5412712 100644 --- a/src/solvable.h +++ b/src/solvable.h @@ -45,7 +45,8 @@ typedef struct _Solvable { /* lookup functions */ Id solvable_lookup_type(Solvable *s, Id keyname); Id solvable_lookup_id(Solvable *s, Id keyname); -unsigned int solvable_lookup_num(Solvable *s, Id keyname, unsigned int notfound); +unsigned long long solvable_lookup_num(Solvable *s, Id keyname, unsigned long long notfound); +unsigned int solvable_lookup_sizek(Solvable *s, Id keyname, unsigned int notfound); const char *solvable_lookup_str(Solvable *s, Id keyname); const char *solvable_lookup_str_poollang(Solvable *s, Id keyname); const char *solvable_lookup_str_lang(Solvable *s, Id keyname, const char *lang, int usebase); @@ -59,7 +60,7 @@ int solvable_lookup_deparray(Solvable *s, Id keyname, Queue *q, Id marker); /* setter functions */ void solvable_set_id(Solvable *s, Id keyname, Id id); -void solvable_set_num(Solvable *s, Id keyname, unsigned int num); +void solvable_set_num(Solvable *s, Id keyname, unsigned long long num); void solvable_set_str(Solvable *s, Id keyname, const char *str); void solvable_set_poolstr(Solvable *s, Id keyname, const char *str); void solvable_add_poolstr_array(Solvable *s, Id keyname, const char *str); |