From: Michael Schroeder Date: Fri, 21 Mar 2008 16:14:06 +0000 (+0000) Subject: - also set installtime, downloadsize and license X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~477 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=a8c85b1c1816229f6e250eea267c16a6359bb0db;p=thirdparty%2Flibsolv.git - also set installtime, downloadsize and license --- diff --git a/tools/repo_rpmdb.c b/tools/repo_rpmdb.c index ad72346c..58b82faf 100644 --- a/tools/repo_rpmdb.c +++ b/tools/repo_rpmdb.c @@ -38,8 +38,10 @@ #define TAG_SUMMARY 1004 #define TAG_DESCRIPTION 1005 #define TAG_BUILDTIME 1006 +#define TAG_INSTALLTIME 1008 #define TAG_SIZE 1009 #define TAG_VENDOR 1011 +#define TAG_LICENSE 1014 #define TAG_GROUP 1016 #define TAG_ARCH 1022 #define TAG_FILESIZES 1028 @@ -800,9 +802,15 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *repodata, Solvable *s, RpmHead *rpmhe str = headstring(rpmhead, TAG_GROUP); if (str) repodata_set_poolstr(repodata, entry, SOLVABLE_GROUP, str); + str = headstring(rpmhead, TAG_LICENSE); + if (str) + repodata_set_poolstr(repodata, entry, SOLVABLE_LICENSE, str); u32 = headint32(rpmhead, TAG_BUILDTIME); if (u32) repodata_set_num(repodata, entry, SOLVABLE_BUILDTIME, u32); + u32 = headint32(rpmhead, TAG_INSTALLTIME); + if (u32) + repodata_set_num(repodata, entry, SOLVABLE_INSTALLTIME, u32); u32 = headint32(rpmhead, TAG_SIZE); if (u32) repodata_set_num(repodata, entry, SOLVABLE_INSTALLSIZE, (u32 + 1023) / 1024); @@ -1464,6 +1472,7 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms) FILE *fp; unsigned char lead[4096]; int headerstart, headerend; + struct stat stb; if (nrpms <= 0) return; @@ -1475,6 +1484,11 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms) perror(rpms[i]); continue; } + if (fstat(fileno(fp), &stb)) + { + perror("stat"); + continue; + } if (fread(lead, 96 + 16, 1, fp) != 1 || getu32(lead) != 0xedabeedb) { fprintf(stderr, "%s: not a rpm\n", rpms[i]); @@ -1566,7 +1580,11 @@ repo_add_rpms(Repo *repo, const char **rpms, int nrpms) rpm2solv(pool, repo, repodata, s, rpmhead); add_location(repodata, s, rpms[i]); if (repodata) - repodata_set_num(repodata, (s - pool->solvables) - repodata->start, SOLVABLE_HEADEREND, headerend); + { + Id entry = (s - pool->solvables) - repodata->start; + repodata_set_num(repodata, entry, SOLVABLE_DOWNLOADSIZE, (unsigned int)((stb.st_size + 1023) / 1024)); + repodata_set_num(repodata, entry, SOLVABLE_HEADEREND, headerend); + } } if (rpmhead) sat_free(rpmhead);