aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS5
-rw-r--r--URPM.pm2
-rw-r--r--URPM.xs17
3 files changed, 21 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 2b01e41..a253938 100644
--- a/NEWS
+++ b/NEWS
@@ -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.
diff --git a/URPM.pm b/URPM.pm
index c71f41f..c594243 100644
--- a/URPM.pm
+++ b/URPM.pm
@@ -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);
diff --git a/URPM.xs b/URPM.xs
index dce24a2..a379c6d 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -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))