diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2021-10-31 03:26:16 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2021-10-31 05:38:18 +0100 |
commit | e2d0c0467fb8f5da527f38aa04b2288dbce00a4e (patch) | |
tree | fd34c8d18491bbff6b7541e15a0a933db01ecbf5 /urpm | |
parent | cc60ebdcb51aaa33b212c6161e1706ef4df0c8f3 (diff) | |
download | urpmi-e2d0c0467fb8f5da527f38aa04b2288dbce00a4e.tar urpmi-e2d0c0467fb8f5da527f38aa04b2288dbce00a4e.tar.gz urpmi-e2d0c0467fb8f5da527f38aa04b2288dbce00a4e.tar.bz2 urpmi-e2d0c0467fb8f5da527f38aa04b2288dbce00a4e.tar.xz urpmi-e2d0c0467fb8f5da527f38aa04b2288dbce00a4e.zip |
Convert rpmdb to sqlite also when not chrooted
This is needed for live upgrades, either using urpmi or mgaonline (mga#29364).
Two changes are needed:
- fix detecting rpm version
- fix converting rpmdb when not in a chroot
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/select.pm | 2 | ||||
-rw-r--r-- | urpm/sys.pm | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/urpm/select.pm b/urpm/select.pm index 7225570f..b77303ae 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -759,7 +759,7 @@ sub should_we_migrate_back_rpmdb_db_version { sub migrate_forward_rpmdb_db_if_needed { my ($urpm, $state) = @_; - my ($pkg) = selected_packages_providing($urpm, $state, 'rpm') or return; + my ($pkg) = $urpm->packages_providing('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 diff --git a/urpm/sys.pm b/urpm/sys.pm index bffb7ced..ce2ab3ae 100644 --- a/urpm/sys.pm +++ b/urpm/sys.pm @@ -317,7 +317,7 @@ sub migrate_rpmdb_to_sqlite { $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) { + if (system('rpm', '--rebuilddb', ($urpm->{root} ? ('--dbpath', "$urpm->{root}/var/lib/rpm") : @{[]})) == 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"); |