From 07b59c7e75275967ad854a41b1d90ac143213ed2 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 12 Mar 2012 19:27:36 +0000 Subject: drop support for mdv2007.x/2008.x/2009.x (simplify code and increase perl_checker's SNR) --- NEWS | 2 ++ mgaapplet | 35 +++++++---------------------------- mgaapplet_gui.pm | 6 +----- mgaonline.pm | 20 +++----------------- 4 files changed, 13 insertions(+), 50 deletions(-) diff --git a/NEWS b/NEWS index 2e81024f..2f442d3d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- drop support for mdv2007.x/2008.x/2009.x + Version 2.77.30 - 14 June 2011, Thomas Backlund - Adapt to new libnotify API (mga #1780) diff --git a/mgaapplet b/mgaapplet index f7e9a65d..117269d6 100755 --- a/mgaapplet +++ b/mgaapplet @@ -309,8 +309,7 @@ sub is_extended_support_not_ended() { sub is_there_a_new_distributions() { # sanity check for cooker: - # (2008.0 wrongly reports 'Devel' instead of 'Official'): - return if $product_id->{branch} eq 'Devel' && !is_it_2008_0(); + return if $product_id->{branch} eq 'Devel'; # some OEM Philco systems have no specific updates repo # so we can only blacklist them here directly return if cat_("/etc/oem-release") =~ /philco/i; @@ -339,9 +338,6 @@ sub is_there_a_new_distributions() { return if is_extended_support_not_ended(); } - # the "live upgrade" is not available on 2008.0: - return if is_it_2008_0(); - # no if we're using the extended maintenance: return if is_extended_support_not_ended(); @@ -450,8 +446,7 @@ sub configNetwork() { # only enable 'download all packages at once' on 2010.1 and further: sub is_download_all_enabled() { - # prevent crashing on 2008.1 and 2009.0: - eval { is_it_a_devel_distro() } || !member($product_id->{version}, qw(2008.0 2008.1 2009.0 2009.1)); + is_it_a_devel_distro(); } sub confirm_upgrade() { @@ -478,7 +473,6 @@ sub confirm_upgrade() { gtknew('Label_Left', text => N("Do you want to upgrade to the '\%s' distribution?", $new_distro->{name} || $new_distro->{version}), @common), gtknew('CheckButton', text => N("Do not ask me next time"), active_ref => \$warn_me), - # active_ref option is missing on 2008.0: (is_download_all_enabled() ? (gtknew('CheckButton', text => N("Download all packages at once") . "\n" . N("(Warning: You will need quite a lot of free space)"), @@ -755,17 +749,14 @@ sub silentCheck() { } checker_exit('locked') if $will_not_update_media; - # prevent crashing on 2008.1 and 2009.0: - my $is_it_a_devel_distro = eval { is_it_a_devel_distro() }; + my $is_it_a_devel_distro = is_it_a_devel_distro(); my $media = $is_it_a_devel_distro ? '-a' : '--update'; if (!run_program::run('urpmi.update', $media, if_($root, "--urpmi-root=$root"))) { checker_exit('error_updating') if $will_not_update_media; } - if (!is_it_2008_0()) { - update_backport_media($urpm); - } + update_backport_media($urpm); require urpm::select; require urpm::media; @@ -773,8 +764,7 @@ sub silentCheck() { # (hence we do it in the forked helper so that the applet doesn't eat too much RAM) urpm::media::configure($urpm, if_(!$is_it_a_devel_distro, update => 1)); - # prevent crashing on 2008.1 and 2009.0: - my @update_medias = eval { get_update_medias($urpm) }; + my @update_medias = get_update_medias($urpm); if ($@) { @update_medias = grep { $_->{update} } @{$urpm->{media}}; } @@ -847,22 +837,11 @@ sub setLastTime() { setVar('LASTCHECK', $date); } -sub has_network_connection_2008() { - require network::network; - require network::tools; - my $net = {}; - network::network::read_net_conf($net); - my ($_gw_intf, $_is_up, $gw_address, $_dns_server) = network::tools::get_internet_connection($net); - to_bool($gw_address); -} - sub checkNetwork() { return if $checker_pid; require network::tools; - # alternatively we could have used 2008.0's network::tools::connected() - my $has_network = is_it_2008_0() ? has_network_connection_2008() - : network::tools::has_network_connection(); - if (!$has_network) { + + if (!network::tools::has_network_connection()) { # do not notify if already done: return if member($state_global, qw(disconnected)); log::explanations(N_("Checking Network: seems disabled\n")); diff --git a/mgaapplet_gui.pm b/mgaapplet_gui.pm index 802a70ed..8ac332ea 100644 --- a/mgaapplet_gui.pm +++ b/mgaapplet_gui.pm @@ -64,11 +64,7 @@ our $localfile = "$localdir/mgaonline"; mkdir_p($localdir) if !-d $localdir; -e "$ENV{HOME}/.mgaonline" and system("mv", "$ENV{HOME}/.mgaonline", $localfile); -# make it work on 2008.X: -eval { interactive::gtk::add_padding(Gtk2::Label->new) }; -if ($@) { - *interactive::gtk::add_padding = sub { $_[0] }; -} +interactive::gtk::add_padding(Gtk2::Label->new); our %local_config; read_local_config(); diff --git a/mgaonline.pm b/mgaonline.pm index c6bb4ea1..2cce07af 100644 --- a/mgaonline.pm +++ b/mgaonline.pm @@ -45,7 +45,6 @@ our @EXPORT = qw(find_current_distro get_release get_stale_upgrade_filename get_urpmi_options - is_it_2008_0 is_enterprise_media_supported is_extmaint_supported is_restricted_media_supported @@ -89,10 +88,6 @@ sub get_release() { ($r); } -sub is_it_2008_0() { - $product_id->{version} eq '2008.0'; -} - sub is_extmaint_supported() { return; # NOT SUPPORTED ON MAGEIA $product_id->{support} eq 'extended'; @@ -100,13 +95,11 @@ sub is_extmaint_supported() { sub is_enterprise_media_supported() { return; # NOT SUPPORTED ON MAGEIA - return if is_it_2008_0(); to_bool($product_id->{type} eq 'Enterprise' && $product_id->{product} eq 'Server'); } sub is_restricted_media_supported() { return; # NOT SUPPORTED ON MAGEIA - return if is_it_2008_0(); to_bool($product_id->{product} =~ /powerpack/i); } @@ -133,15 +126,8 @@ sub get_distro_list_() { # for curl exit code, which broke downloads: local $SIG{CHLD} = 'DEFAULT'; - # old API: - if (member($product_id->{version}, qw(2007.1 2008.0 2008.1))) { - require mgaapplet_urpm; - mgaapplet_urpm::ensure_valid_cachedir($urpm); - mgaapplet_urpm::get_content($urpm, $list); - } else { - urpm::ensure_valid_cachedir($urpm); - urpm::download::get_content($urpm, $list); - } + urpm::ensure_valid_cachedir($urpm); + urpm::download::get_content($urpm, $list); }; } @@ -217,7 +203,7 @@ sub get_banner { } sub get_urpmi_options() { - ({ sensitive_arguments => 1 }, 'urpmi.addmedia', if_(!is_it_2008_0(), '--xml-info', 'always')); + ({ sensitive_arguments => 1 }, 'urpmi.addmedia', '--xml-info', 'always'); } sub add_medium_enterprise { -- cgit v1.2.1