aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-27 10:38:48 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-27 10:38:48 +0000
commit27d8a748a7d2e62cb713e14067fbb8f24233b90a (patch)
tree5929ee7b44f9f9c0f633aa9c2dcd1ec68e5ead90
parent64fe989d04eba28e901645b1fb59b4b222984e12 (diff)
downloadperl-URPM-27d8a748a7d2e62cb713e14067fbb8f24233b90a.tar
perl-URPM-27d8a748a7d2e62cb713e14067fbb8f24233b90a.tar.gz
perl-URPM-27d8a748a7d2e62cb713e14067fbb8f24233b90a.tar.bz2
perl-URPM-27d8a748a7d2e62cb713e14067fbb8f24233b90a.tar.xz
perl-URPM-27d8a748a7d2e62cb713e14067fbb8f24233b90a.zip
create empty DB_CONFIG for rpm first when updating to rpm >= 5.3 to prevent
incompatible configurations to break berkeley db during upgrade
-rw-r--r--URPM.xs16
1 files changed, 16 insertions, 0 deletions
diff --git a/URPM.xs b/URPM.xs
index e4ba8dc..1b11530 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3329,6 +3329,22 @@ Trans_add(trans, pkg, ...)
pretend_distepoch(pkg->h, RPMTAG_REQUIRENAME, RPMTAG_REQUIREFLAGS, RPMTAG_REQUIREVERSION);
}
remap_suggests(pkg->h);
+ /* If we're going to update to rpm 5.3, we'll create an empty DB_CONFIG
+ * first iff there's no existing DB_CONFIG in place. This will prevent
+ * switching to possibly incompatible configurations during upgrade.
+ */
+ if (!strcmp(get_name(pkg->h, RPMTAG_NAME), "rpm")) {
+ const char *version = get_name(pkg->h, RPMTAG_VERSION);
+ if (rpmvercmp(version, "5.3") >= 0) {
+ char *fn = rpmGetPath("%{_dbpath}", "/DB_CONFIG", NULL);
+ struct stat st;
+ if (stat(fn, &st)) {
+ FD_t fd = Fopen(fn, "w");
+ Fclose(fd);
+ }
+ fn = _free(fn);
+ }
+ }
RETVAL = rpmtsAddInstallElement(trans->ts, pkg->h, (fnpyKey)(1+(long)(pkg->flag & FLAG_ID)), update, relocations) == 0;