aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xiurt4
-rw-r--r--lib/Iurt/Chroot.pm21
-rw-r--r--lib/Iurt/Urpmi.pm63
3 files changed, 20 insertions, 68 deletions
diff --git a/iurt b/iurt
index f8b27cb..faa4ac2 100755
--- a/iurt
+++ b/iurt
@@ -132,7 +132,7 @@ $run{todo} = [];
sub { my ($tmp, @media) = @_; $tmp->[0]{media} = \@media; 1 }, "Limiting rebuild to the kernel in the given media regexp"],
] , "[options] <media prefix>",
"Create urpmi media inside the chroot instead of using --root (media prefix is like http:///server.mandriva.com/dis/)",
- sub { my ($opt, $media) = @_; $opt->{rooted_media} = $media; $run{chrooted_urpmi} = $opt; 1 }, "Activating chroot media" ],
+ sub { my ($opt, $media) = @_; $run{chrooted_urpmi} = $opt; 1 }, "Activating chroot media" ],
[ "", "clean-all", 0, "",
"Clean all remaining chroots for all the users",
sub { $run{clean_all} = 1 }, "Activating clean chroot flag" ],
@@ -725,8 +725,6 @@ sub rebuild_one {
my $retry = 0;
retry:
- $urpmi->clean_urpmi_process;
-
my ($srpm_name) = $srpm =~ /(?:.*:)?(.*)-[^-]+-[^-]+\.src\.rpm$/;
$srpm_name or return $srpm;
diff --git a/lib/Iurt/Chroot.pm b/lib/Iurt/Chroot.pm
index 85b06c4..8d7fcd3 100644
--- a/lib/Iurt/Chroot.pm
+++ b/lib/Iurt/Chroot.pm
@@ -309,11 +309,9 @@ sub create_build_chroot {
if ($ret) {
my $urpmi = $run->{urpmi};
- if ($urpmi->{use__urpmi_root} && !$run->{chrooted_urpmi}) {
- if (!$urpmi->add_media__urpmi_root($chroot, $config->{base_media})) {
- plog('ERROR', "urpmi.addmedia --urpmi-root failed");
- return;
- }
+ if (!$urpmi->add_media__urpmi_root($chroot, $config->{base_media})) {
+ plog('ERROR', "urpmi.addmedia --urpmi-root failed");
+ return;
}
}
@@ -412,16 +410,13 @@ sub build_chroot {
# install chroot
my $urpmi = $run->{urpmi}; # perl_checker: $urpmi = Iurt::Urpmi->new
- if ($urpmi->{use__urpmi_root}) {
- if (!$urpmi->add_media__urpmi_root($tmp_chroot, $config->{base_media})) {
- plog('ERROR', "urpmi.addmedia --urpmi-root failed");
- return 0;
- }
- $urpmi->set_command__urpmi_root($tmp_chroot);
- } else {
- $urpmi->set_command__use_distrib($tmp_chroot);
+ if (!$urpmi->add_media__urpmi_root($tmp_chroot, $config->{base_media})) {
+ plog('ERROR', "urpmi.addmedia --urpmi-root failed");
+ return 0;
}
+ $urpmi->set_command($tmp_chroot);
+
# (blino) install meta-task first for prefer.vendor.list to be used
foreach my $packages ([ 'meta-task' ], $config->{basesystem_packages}) {
if (!$urpmi->install_packages(
diff --git a/lib/Iurt/Urpmi.pm b/lib/Iurt/Urpmi.pm
index 0430fd0..eea9c38 100644
--- a/lib/Iurt/Urpmi.pm
+++ b/lib/Iurt/Urpmi.pm
@@ -21,31 +21,15 @@ sub new {
my $config = $self->{config};
my $run = $self->{run};
- if ($run->{chrooted_urpmi}) {
- $run->{chrooted_media} = $run->{chrooted_urpmi}{rooted_media} .
- "/$run->{distro}/$run->{my_arch}";
-
- # Now squash all slashes that don't follow colon
- $run->{chrooted_media} =~ s|(?<!:)/+|/|g;
-
- plog('DEBUG', "installation media: $run->{chrooted_media}");
- }
- $self->{use__urpmi_root} = !urpm::is_local_url($config->{repository});
$self->{distrib_url} = "$config->{repository}/$run->{distro}/$run->{my_arch}";
$self;
}
-sub set_command__urpmi_root {
+sub set_command {
my ($self, $chroot_tmp) = @_;
- $self->{use_iurt_root_command} = 1;
$self->{urpmi_command} = "urpmi $self->{urpmi_options} --urpmi-root $chroot_tmp";
}
-sub set_command__use_distrib {
- my ($self, $chroot_tmp) = @_;
- $self->{use_iurt_root_command} = 1;
- $self->{urpmi_command} = "urpmi $self->{urpmi_options} --use-distrib $self->{distrib_url} --root $chroot_tmp";
-}
sub set_local_media {
my ($self, $local_media) = @_;
@@ -65,10 +49,7 @@ sub urpmi_command {
my $run = $self->{run};
my $local_media = $self->{local_media};
- if ($run->{chrooted_urpmi}) {
- # FIXME chrooted_urpmi should always use urpmi_root and not support local media
- $self->{use__urpmi_root} ? &set_command__urpmi_root : &set_command__use_distrib;
-
+ &set_command;
# Here should be added only the needed media for the given package
# main/release -> main/release
# main/testing -> main/release main/testing
@@ -82,18 +63,17 @@ sub urpmi_command {
my $m_name = $m;
$m_name =~ s,/,_,g;
if (!add_media($self, $chroot_tmp, $m_name,
- "$m_name $run->{chrooted_media}/media/$m")) {
+ "$m_name $self->{distrib_url}/media/$m")) {
$run->{chrooted_urpmi} = 0;
- plog('ERROR', "Failed to add media $m_name. Disabling chrooted_urpmi.");
+ plog('ERROR', "Failed to add media $m_name.");
return;
}
}
} else {
# FIXME Do not hardcode Core
- if (!add_media($self, $chroot_tmp, 'Core', "--distrib $run->{chrooted_media}")) {
- if (!add_media($self, $chroot_tmp, 'Core', "--wget --distrib $run->{chrooted_media}")) {
- $run->{chrooted_urpmi} = 0;
- plog('ERROR', "Failed to add media $run->{chrooted_media}. Disabling chrooted_urpmi.");
+ if (!add_media($self, $chroot_tmp, 'Core', "--distrib $self->{distrib_url}")) {
+ if (!add_media($self, $chroot_tmp, 'Core', "--wget --distrib $self->{distrib_url}")) {
+ plog('ERROR', "Failed to add media $self->{distrib_url}.");
return;
}
}
@@ -149,9 +129,6 @@ sub urpmi_command {
}
return 1;
- } else {
- &set_command__use_distrib;
- }
}
sub check_media_added {
@@ -188,12 +165,9 @@ sub add_media {
my $run = $self->{run};
my $config = $self->{config};
- plog("add chroot media: $run->{chrooted_media}");
+ plog("add chroot media: $self->{distrib_url}");
- my $cmd = "chroot $chroot urpmi.addmedia $media";
- if ($run->{chrooted_urpmi}) {
- $cmd = "urpmi-addmedia -v --urpmi-root $chroot $media";
- }
+ my $cmd = "urpmi-addmedia -v --urpmi-root $chroot $media";
perform_command($cmd,
$run, $config,
mail => $config->{admin},
@@ -215,10 +189,7 @@ sub update {
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";
- }
+ my $cmd = "urpmi --urpmi-root $chroot --auto-update --auto";
perform_command($cmd,
$run, $config,
mail => $config->{admin},
@@ -436,7 +407,7 @@ sub install_packages {
if (!perform_command(
join(' ', $self->{urpmi_command}, @options, @to_install),
$run, $config,
- use_iurt_root_command => $self->{use_iurt_root_command},
+ use_iurt_root_command => 1,
error => $error,
logname => $log,
hash => "${log}_$title",
@@ -473,18 +444,6 @@ sub install_packages {
$ok;
}
-sub clean_urpmi_process {
- my ($self) = @_;
- my $run = $self->{run};
- my $program_name = $run->{program_name};
- if (!$run->{chrooted_urpmi}) {
- my $match = $self->{urpmi_command} or return;
- if (!clean_process($match)) {
- die "FATAL $program_name: Could not have urpmi working !";
- }
- }
-}
-
# return ("exit_code", srpm, spec)
sub recreate_srpm {
my ($_self, $run, $config, $chroot_tmp, $dir, $srpm, $luser, $b_retry) = @_;