diff options
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -1755,6 +1755,18 @@ rpmdb_convert(const char *prefix, int dbtype, int swap, int rebuild) { int doswap = -1; float pct = 0; uint8_t tmp; + /* + * Older rpm places number of keys as first entry of hash database, + * so any package placed at beginning of it will be "missing" from + * rpmdb... + */ + if (dbtype == 1){ + uint32_t keyNo = 0; + key.data = &keyNo; + data.data = &nkeys; + key.size = data.size = sizeof(uint32_t); + xx = dbiNew->dbi_db->put(dbiNew->dbi_db, NULL, &key, &data, 0); + } while ((xx = dbcpCur->c_get(dbcpCur, &key, &data, DB_NEXT)) == 0) { tmp = pct; pct = (100*(float)++i/nkeys) + 0.5; @@ -1763,8 +1775,9 @@ rpmdb_convert(const char *prefix, int dbtype, int swap, int rebuild) { fprintf(stderr, "\rconverting %s%s/Packages: %u/%u %d%%", prefix && prefix[0] ? prefix : "", tmppath, i, nkeys, (int)pct); } fflush(stdout); - if(!*(uint32_t*)key.data) - continue; + if(i == 1 && !*(uint32_t*)key.data) + continue; + if(__builtin_expect(doswap, 1) < 0) { if((htole32(*(uint32_t*)key.data) > 10000000 && swap < 0) || (htole32(*(uint32_t*)key.data) < 10000000 && swap > 0)) |