aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-23 14:47:15 +0000
committerPer Øyvind Karlsen <peroyvind@mandriva.org>2011-06-23 14:47:15 +0000
commitf3bf9af961f4648c1590c19abcecc7c36d1040fc (patch)
tree43f2241162180074b3b942b281873400a4b4a83c
parent68da54f7132c2759ce952f2f450009c7f87500bc (diff)
downloadperl-URPM-f3bf9af961f4648c1590c19abcecc7c36d1040fc.tar
perl-URPM-f3bf9af961f4648c1590c19abcecc7c36d1040fc.tar.gz
perl-URPM-f3bf9af961f4648c1590c19abcecc7c36d1040fc.tar.bz2
perl-URPM-f3bf9af961f4648c1590c19abcecc7c36d1040fc.tar.xz
perl-URPM-f3bf9af961f4648c1590c19abcecc7c36d1040fc.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--NEWS4
-rw-r--r--URPM.xs15
2 files changed, 18 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index b795c29..8de0a06 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
-Version 3.37.2 - 21 June 2011, by Per Øyvind Karlsen
+Version 3.37.2 - 23 June 2011, by Per Øyvind Karlsen
+- create empty DB_CONFIG for rpm first when updating to rpm >= 5.3 to prevent
+ incompatible configurations to break berkeley db during upgrade
- support getting disttag & distepoch from synthesis
- fix URPM::Package->distepoch to actually work
- add disttag & distepoch at end of @info@ line
diff --git a/URPM.xs b/URPM.xs
index e4ba8dc..c5dc22f 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -3329,6 +3329,21 @@ 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);
+ }
+ }
+ }
RETVAL = rpmtsAddInstallElement(trans->ts, pkg->h, (fnpyKey)(1+(long)(pkg->flag & FLAG_ID)), update, relocations) == 0;