diff options
author | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-27 10:38:48 +0000 |
---|---|---|
committer | Per Øyvind Karlsen <peroyvind@mandriva.org> | 2011-06-27 10:38:48 +0000 |
commit | 27d8a748a7d2e62cb713e14067fbb8f24233b90a (patch) | |
tree | 5929ee7b44f9f9c0f633aa9c2dcd1ec68e5ead90 /URPM.xs | |
parent | 64fe989d04eba28e901645b1fb59b4b222984e12 (diff) | |
download | perl-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
Diffstat (limited to 'URPM.xs')
-rw-r--r-- | URPM.xs | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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; |