summaryrefslogtreecommitdiffstats
path: root/mdkupdate
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2006-03-30 02:09:26 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2006-03-30 02:09:26 +0000
commit46f26f50cb658577b1cf0148f18e7cd562c1be0a (patch)
tree09797bedf327c3fe94a49e834415f1e4d192f220 /mdkupdate
parent0213a8596bdcb113b5be3709b567865d740e3b51 (diff)
downloadmgaonline-46f26f50cb658577b1cf0148f18e7cd562c1be0a.tar
mgaonline-46f26f50cb658577b1cf0148f18e7cd562c1be0a.tar.gz
mgaonline-46f26f50cb658577b1cf0148f18e7cd562c1be0a.tar.bz2
mgaonline-46f26f50cb658577b1cf0148f18e7cd562c1be0a.tar.xz
mgaonline-46f26f50cb658577b1cf0148f18e7cd562c1be0a.zip
(add_mirrors) create it out of the bundle path in order to factorize code with incomind updates support
Diffstat (limited to 'mdkupdate')
-rwxr-xr-xmdkupdate44
1 files changed, 25 insertions, 19 deletions
diff --git a/mdkupdate b/mdkupdate
index 6e1c4dcb..c130e62f 100755
--- a/mdkupdate
+++ b/mdkupdate
@@ -170,27 +170,9 @@ You need to update to a newer version. You can get a new one from http://start.m
my @bundles;
$w = $in->wait_message(N("Please wait"), N("Preparing..."));
my ($mirrors, $bundle) = ($bundle_info->{data}{mirrors}, $bundle_info->{data}{bundle});
- foreach my $mirror (@$mirrors) {
- next if $mirror->{mode} eq 'anon'; # nothing to do
- if ($mirror->{mode} eq 'auth') {
- # add "user:pass@" substring if needed:
- # user password & login provided by server on those provided with the bundle:
- $bundle_vars{USER} = $mirror->{user} if $mirror->{user};
- $bundle_vars{PASS} = $mirror->{pass} if $mirror->{pass};
- my $encoded_login = uri_escape($bundle_vars{USER});
- my $encoded_pass = uri_escape($bundle_vars{PASS});
- $mirror->{url} =~ s!^([^:]*)://!\1://$encoded_login:$encoded_pass@!;
- } else { # unknown method, aborting
- undef $w;
- log::explanations("we got a bad bundle");
- $in->ask_warn(N("Error"), N("This bundle is not well formated. Aborting."));
- $in->exit(1);
- }
- }
- my %mirrors = map { $_->{name} => join('@', grep { $_ } $_->{auth}, $_->{url}) } @$mirrors;
- add_media($_, $mirrors{$_}, 'media_info/synthesis.hdlist.cz', '') foreach keys %mirrors;
$bundle =~ s/-[^-]*-[^-]*\.[^.]*\.rpm$//;
push @bundles, $bundle;
+ my %mirrors = add_mirrors($in, $w, $mirrors, \%bundle_vars);
install_pkgs($in, \@bundles, (find { /^bundle/ } keys %mirrors),
{ is_bundle => 1,
auto_select => ($wc->{POST} =~ /AUTO_SELECT/ ? 1 : 0),
@@ -203,6 +185,30 @@ You need to update to a newer version. You can get a new one from http://start.m
}
}
+sub add_mirrors {
+ my ($in, $w, $mirrors, $bundle_vars, $option) = @_;
+ foreach my $mirror (@$mirrors) {
+ next if $mirror->{mode} eq 'anon'; # nothing to do
+ if ($mirror->{mode} eq 'auth') {
+ # add "user:pass@" substring if needed:
+ # user password & login provided by server on those provided with the bundle:
+ $bundle_vars->{USER} = $mirror->{user} if $mirror->{user};
+ $bundle_vars->{PASS} = $mirror->{pass} if $mirror->{pass};
+ my $encoded_login = uri_escape($bundle_vars->{USER});
+ my $encoded_pass = uri_escape($bundle_vars->{PASS});
+ $mirror->{url} =~ s!^([^:]*)://!\1://$encoded_login:$encoded_pass@!;
+ } else { # unknown method, aborting
+ undef $w;
+ log::explanations("we got a bad bundle");
+ $in->ask_warn(N("Error"), N("This bundle is not well formated. Aborting."));
+ $in->exit(1);
+ }
+ }
+ my %mirrors = map { $_->{name} => join('@', grep { $_ } $_->{auth}, $_->{url}) } @$mirrors;
+ add_media($_, $mirrors{$_}, 'media_info/synthesis.hdlist.cz', $option) foreach keys %mirrors;
+ %mirrors;
+}
+
sub ask_pkgs {
my ($in) = @_;
my $pkgs = get_updatable_pkgs();