diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | URPM.pm | 2 | ||||
-rw-r--r-- | URPM.xs | 17 |
3 files changed, 21 insertions, 3 deletions
@@ -1,3 +1,8 @@ +Version 4.17 - 30 March 2011, by Per Øyvind Karlsen + +- fix conversion to older hash database format resulting in "missing" package + from rpmdb + Version 4.16 - 29 March 2011, by Per Øyvind Karlsen - add setInternalVariable() for changing various variables for debugging etc. @@ -11,7 +11,7 @@ use URPM::Resolve; use URPM::Signature; our @ISA = qw(DynaLoader); -our $VERSION = '4.16'; +our $VERSION = '4.17'; URPM->bootstrap($VERSION); @@ -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)) |