summaryrefslogtreecommitdiffstats
path: root/urpm/select.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/select.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/select.pm')
-rw-r--r--urpm/select.pm21
1 files changed, 21 insertions, 0 deletions
diff --git a/urpm/select.pm b/urpm/select.pm
index a015f7a5..dbde19a3 100644
--- a/urpm/select.pm
+++ b/urpm/select.pm
@@ -756,6 +756,27 @@ sub should_we_migrate_back_rpmdb_db_version {
0;
}
+sub migrate_forward_rpmdb_db_if_needed {
+ my ($urpm, $state) = @_;
+
+ my ($pkg) = selected_packages_providing($urpm, $state, 'rpm') or return;
+ my $rooted_rpm_version = version->new("v" . $pkg->version); # perl_checker: $self = revision
+ my $rpm_version = _rpm_version(); # perl_checker: $self = revision
+
+ if ($rpm_version ge v4.16.0) {
+ if ($rooted_rpm_version && $rooted_rpm_version ge v4.16) {
+ $urpm->{debug} and $urpm->{debug}("chrooted db version used by librpm is at least as good as non-rooted one");
+ if (-f "$urpm->{root}/var/lib/rpm/Packages") {
+ $urpm->{debug} and $urpm->{debug}("Migrating chrooted db");
+ $urpm->{need_migrate_rpmdb_now} = '4.16';
+ urpm::sys::migrate_forward_rpmdb_db_version($urpm, $urpm->{root});
+ return 1;
+ }
+ }
+ }
+ 0;
+}
+
1;
=back