summaryrefslogtreecommitdiffstats
path: root/urpm/sys.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2021-06-05 09:08:24 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2021-06-05 12:37:18 +0200
commitc338043e44c14fc023e6386cf62c0acf97da51be (patch)
treec613a91cfb3fbb391b21b8164c01eafbd8592f02 /urpm/sys.pm
parentf06d11cd8e450d6542c6b7cc371dead6f8294e4b (diff)
downloadurpmi-c338043e44c14fc023e6386cf62c0acf97da51be.tar
urpmi-c338043e44c14fc023e6386cf62c0acf97da51be.tar.gz
urpmi-c338043e44c14fc023e6386cf62c0acf97da51be.tar.bz2
urpmi-c338043e44c14fc023e6386cf62c0acf97da51be.tar.xz
urpmi-c338043e44c14fc023e6386cf62c0acf97da51be.zip
Convert from bdb backend to sqlite
Rationale: - sqlite backend is supported since rpm-4.16 - bdb backend is deprecated in 4.16 & removed in 4.17 (really 4.16.90)
Diffstat (limited to 'urpm/sys.pm')
-rw-r--r--urpm/sys.pm33
1 files changed, 33 insertions, 0 deletions
diff --git a/urpm/sys.pm b/urpm/sys.pm
index b7cb1220..d8da722a 100644
--- a/urpm/sys.pm
+++ b/urpm/sys.pm
@@ -288,6 +288,39 @@ sub migrate_back_rpmdb_db_version {
clean_rpmdb_shared_regions($root);
}
+=item migrate_rpmdb_to_sqlite($urpm, $root)
+
+Migrate rpmdb to the new sqlite backend.
+
+=cut
+
+sub migrate_rpmdb_to_sqlite {
+ my ($urpm, $root) = @_;
+ $urpm->{info}("migrating db from bdb to sqlite (rpm >= 4.16)");
+ # Whatever is the default backend:
+ URPM::add_macro('_db_backend sqlite');
+ if (system('chroot', $root, 'rpm', '--rebuilddb') == 0) {
+ $urpm->{log}("rpm db converted to sqlite successfully");
+ } else {
+ $urpm->{error}("rpm db conversion failed. You will not be able to run rpm >= 4.17");
+ }
+}
+
+=item migrate_forward_rpmdb_db_version($urpm, $root)
+
+Check if we need to migrate rpmdb to a new backend prior to use it
+and do it if needed.
+
+=cut
+
+sub migrate_forward_rpmdb_db_version {
+ my ($urpm, $root) = @_;
+
+ if ($urpm->{need_migrate_rpmdb_now} eq '4.16') {
+ migrate_rpmdb_to_sqlite($urpm, $root);
+ }
+}
+
=item apply_delta_rpm($deltarpm, $o_dir, $o_pkg)