summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2006-03-30 02:13:21 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2006-03-30 02:13:21 +0000
commit72c516d822834c0d56b28cef3f7660e4119e21d4 (patch)
tree1dc7aba71ec21d2bb5763f886d7108a29d8abaf9
parent46f26f50cb658577b1cf0148f18e7cd562c1be0a (diff)
downloadmgaonline-72c516d822834c0d56b28cef3f7660e4119e21d4.tar
mgaonline-72c516d822834c0d56b28cef3f7660e4119e21d4.tar.gz
mgaonline-72c516d822834c0d56b28cef3f7660e4119e21d4.tar.bz2
mgaonline-72c516d822834c0d56b28cef3f7660e4119e21d4.tar.xz
mgaonline-72c516d822834c0d56b28cef3f7660e4119e21d4.zip
fix updates support: make it use the new SOAP interface and implement
updating the system
-rwxr-xr-xmdkupdate33
1 files changed, 21 insertions, 12 deletions
diff --git a/mdkupdate b/mdkupdate
index c130e62f..eec1a739 100755
--- a/mdkupdate
+++ b/mdkupdate
@@ -108,22 +108,29 @@ if (!$bundle) {
if ($wc->{HOST_ID} && $wc->{HOST_KEY}) {
my $getupdates;
$getupdates = mdkonline::soap_get_updates_for_host($wc->{HOST_ID}, $wc->{HOST_KEY});
+
+ my $ret = mdkonline::check_server_response($getupdates);
print Data::Dumper->Dump([ $getupdates ], [ qw(getupdates) ]);
- if ($getupdates->{message}) {
- exit(0);
- my $rpms_scheduled;
- -f $currentrpm or rpm_qa($currentrpm);
+ if ($ret eq 'OK') {
+ # doble check mdkapplet:
+ if (my $updates = $getupdates->{data}{updates}) { # there're updates
+
+ my %mirrors = add_mirrors($in, undef, $getupdates->{data}{mirrors}, {}, '--update');
+ my $mirror = find { $_ } keys %mirrors; # pick a random mirror
+ my $pkgs = [ map { $_->{filename} } @$updates ];
+ print Data::Dumper->Dump([ $updates, $pkgs], [ qw(updates pkgs) ]);
+
my ($release) = mdkonline::get_release();
if ($applet) {
my $rpm_exec_name = $release >= 2006.0 ? "/usr/bin/MandrivaUpdate" : "/usr/bin/MandrakeUpdate";
my $is_no_media_update = $release <= 10.1 ? '' : "--no-media-update";
- system $rpm_exec_name, "--no-confirmation", $is_no_media_update, "--media=update_source";
- } elsif ($noX) {
+ system $rpm_exec_name, "--no-confirmation", $is_no_media_update, "--media=$mirror";
+ } elsif ($auto) { # FIXME
+ auto_install_rpms();
+ } else {
my $pkgs = ask_pkgs($in);
- install_pkgs($in, $pkgs, 'update_source') if $pkgs;
+ install_pkgs($in, $pkgs, $mirror, { no_X => $noX });
$in->exit(0);
- } elsif ($auto) { # FIXME
- auto_install_rpms($rpms_scheduled);
}
rpm_qa($afterrpm);
my $wc = mdkonline::read_conf();
@@ -133,9 +140,11 @@ if (!$bundle) {
$result = mdkonline::prepare_upload_conf($wc);
}
clean_dir();
- } else { # code return a problem to get updates
-
- }
+ }
+ } else {
+ log::explanations("geting updates failed: $ret");
+ $in->ask_warn(N("Error"), N("Cannot get list of updates: %s", $ret)) if $applet;
+ }
} else { # no HOST_ID
}