aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Terjan <pterjan@mageia.org>2020-06-14 20:42:29 +0000
committerPascal Terjan <pterjan@mageia.org>2020-06-14 21:05:06 +0000
commit0f787cafa6a38ff84d4d0cec48837d75539575d7 (patch)
treee9c91162a694ebe513b0a224c1b5ca306391c1f6
parent515ce69e72f20290ef7366487e92ec7ff99d78bb (diff)
downloadiurt-0f787cafa6a38ff84d4d0cec48837d75539575d7.tar
iurt-0f787cafa6a38ff84d4d0cec48837d75539575d7.tar.gz
iurt-0f787cafa6a38ff84d4d0cec48837d75539575d7.tar.bz2
iurt-0f787cafa6a38ff84d4d0cec48837d75539575d7.tar.xz
iurt-0f787cafa6a38ff84d4d0cec48837d75539575d7.zip
Update packages after creating chroot
This is useful when building for updates_testing or with additional media as basesystem/urpmi/... were installed without those media.
-rw-r--r--NEWS1
-rw-r--r--lib/Iurt/Chroot.pm5
-rw-r--r--lib/Iurt/Urpmi.pm21
3 files changed, 27 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 6b2aee5..e954025 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
- iurt: allow building arm v5 and v7 on armv8l
- move check_{no,}arch from Config into a new RPM module. They have nothing
to do with the config and work on an RPM file.
+- iurt: update packages after creating chroot
0.7.10
- ulri: allow - in host when parsing lock file name
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 85b06c4..f0cf512 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -102,6 +102,11 @@ sub clean_and_build_chroot {
}
}
+ # We may have media not used to create the chroot (when building for updates_testing
+ # or if using additional_media) so need to update basesystem packages.
+ my $urpmi = $run->{urpmi};
+ $urpmi->update($chroot);
+
1;
}
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index 7ac6a74..0430fd0 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -208,6 +208,27 @@ sub add_media {
1;
}
+sub update {
+ my ($self, $chroot) = @_;
+ my $run = $self->{run};
+ my $config = $self->{config};
+
+ plog('INFO', "updating packages in $chroot");
+
+ my $cmd = "chroot $chroot urpmi --auto-update --auto";
+ if ($run->{chrooted_urpmi}) {
+ $cmd = "urpmi --urpmi-root $chroot --auto-update --auto";
+ }
+ perform_command($cmd,
+ $run, $config,
+ mail => $config->{admin},
+ retry => 2,
+ use_iurt_root_command => 1,
+ debug_mail => $run->{debug})
+ or return;
+ 1;
+}
+
sub get_local_provides {
my ($self) = @_;
my $run = $self->{run};