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) {
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) {
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));
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)
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);
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. */
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)
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))
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))
if ((sizestr = strchr(epochstr, '@')) != 0)
{
char *groupstr;
- unsigned long size;
*sizestr++ = 0;
if ((groupstr = strchr(sizestr, '@')) != 0)
{
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);
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)
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);
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);
}
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:
}
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'):
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'):
solvable_lookup_id;
solvable_lookup_idarray;
solvable_lookup_num;
+ solvable_lookup_sizek;
solvable_lookup_str;
solvable_lookup_str_lang;
solvable_lookup_str_poollang;
continue;
if (!MAPTST(installedmap, sp))
continue;
- change += solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0);
+ change += solvable_lookup_sizek(s, SOLVABLE_INSTALLSIZE, 0);
}
if (oldinstalled)
{
{
if (MAPTST(installedmap, sp))
continue;
- change -= solvable_lookup_num(s, SOLVABLE_INSTALLSIZE, 0);
+ change -= solvable_lookup_sizek(s, SOLVABLE_INSTALLSIZE, 0);
}
}
return change;
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;
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);
#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;
}
-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)
{
}
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)
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);
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);
}
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;
}
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))
{
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);
/*
}
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;
{
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;
}
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;
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:
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);
/* 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);
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)
{
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);
}
/* 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);
/* 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);