summaryrefslogtreecommitdiffstats
path: root/urpm/sys.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-09 08:06:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-09 08:06:28 +0000
commitd8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4 (patch)
tree1a53003791e480bee0d0d7bc1be15eb0b16f3c4d /urpm/sys.pm
parent740c2e83717643482caf3ba4133c5cf83b07563f (diff)
downloadurpmi-d8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4.tar
urpmi-d8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4.tar.gz
urpmi-d8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4.tar.bz2
urpmi-d8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4.tar.xz
urpmi-d8cf4a35e631ca6ca54c18d247a5283cbb9bfcc4.zip
- urpmi
o after installing in chroot, migrate back rpmdb db version to one compatible with the rpm in the chroot
Diffstat (limited to 'urpm/sys.pm')
-rw-r--r--urpm/sys.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm
index 2e36a273..088a3150 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -221,6 +221,24 @@ sub print_need_restart() {
print "$_\n" foreach values %$h;
}
+sub migrate_back_rpmdb_db_version {
+ my ($urpm, $root) = @_;
+
+ $urpm->{info}("migrating back the created rpm db from Hash version 9 to Hash version 8");
+
+ foreach my $db_file (glob("$root/var/lib/rpm/[A-Z]*")) {
+ rename $db_file, "$db_file.";
+ system("db_dump $db_file. | db42_load $db_file");
+ if (-e $db_file) {
+ unlink "$db_file.";
+ } else {
+ rename "$db_file.", $db_file;
+ $urpm->{error}("rpm db migration failed on $db_file. You will not be able to run rpm chrooted");
+ return;
+ }
+ }
+ clean_rpmdb_shared_regions($root);
+}
#- create a plain rpm from an installed rpm and a delta rpm (in the current directory)
#- returns the new rpm filename in case of success