diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-09-06 17:28:57 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-09-06 17:28:57 +0000 |
commit | 8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6 (patch) | |
tree | e711b5f4bdf912a1f06866789e63a1784345780f | |
parent | 1b1a0a4434e2eb4adadd651d5ca3b55a0bcb444c (diff) | |
download | mgaonline-8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6.tar mgaonline-8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6.tar.gz mgaonline-8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6.tar.bz2 mgaonline-8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6.tar.xz mgaonline-8fca0c38d4cb54ecca849d8ecc6d15aec6b81dd6.zip |
drop support for Enterprise & PowerPack media (mga#6292)
-rw-r--r-- | NEWS | 2 | ||||
-rwxr-xr-x | mgaapplet | 71 | ||||
-rwxr-xr-x | mgaapplet-add-media-helper | 10 | ||||
-rwxr-xr-x | mgaapplet-config | 8 | ||||
-rwxr-xr-x | mgaapplet-upgrade-helper | 113 | ||||
-rw-r--r-- | mgaapplet_gui.pm | 76 | ||||
-rw-r--r-- | mgaonline.pm | 32 |
7 files changed, 4 insertions, 308 deletions
@@ -1,4 +1,4 @@ -- drop support for Enterprise media (mga#6292) +- drop support for Enterprise & PowerPack media (mga#6292) Version 2.78 - 31 August 2012, Thierry Vignaud @@ -113,12 +113,6 @@ my %state = ( urgency => 'low', tt => [] }, - unconfigured_restricted_media => { - colour => [ 'bundle' ], - menu => [ 'add_restricted_media', 'check' ], - urgency => 'low', - tt => [ N("An additional package medium is available for your distribution.") ] - }, disconnected => { colour => [ 'disconnect' ], menu => [ 'confNetwork' ], @@ -204,16 +198,10 @@ my %comm_codes = ( status => 'critical', log => "Failed to open urpmi database\n", }, - unconfigured_restricted_media => { - code => 9, - status => 'unconfigured_restricted_media', - log => "Missing restricted media\n", - }, ); my %actions = ( 'update' => { name => N("Install updates"), launch => \&installUpdates }, - 'add_restricted_media' => { name => N("Add additional package medium"), launch => \&prepare_add_restricted }, 'check' => { name => N("Check Updates"), launch => \&checkUpdates }, 'confNetwork' => { name => N("Configure Network"), launch => \&configNetwork }, 'upgrade_distro' => { name => N("Upgrade the system"), launch => \&upgrade }, @@ -227,7 +215,6 @@ $icon->signal_connect(popup_menu => sub { }); $icon->signal_connect(activate => sub { my %click_actions = ( - unconfigured_restricted_media => \&prepare_add_restricted, no_update_medium => \&add_media, no_enabled_medium => \&add_media, updates => \&installUpdates, @@ -364,7 +351,7 @@ sub process_state { $locked_count = 0; } - # busy critical delayed disabled disconnected locked loop_locked new_distribution no_enabled_medium no_more_supported no_update_medium notsupported okay unconfigured_restricted_media update + # busy critical delayed disabled disconnected locked loop_locked new_distribution no_enabled_medium no_more_supported no_update_medium notsupported okay update if (!member($sub_state, qw(okay))) { go2State($sub_state); } elsif ($no_more_supported @@ -779,15 +766,7 @@ sub silentCheck() { warn ">> need_restart=$need_restart, updates=" . join(', ', @requested_strict) . "\n"; checker_exit('updates'); } else { - if (!text2bool($local_config{DO_NOT_ASK_FOR_RESTRICTED})) { - if (is_restricted_media_configured($urpm)) { - checker_exit('uptodate'); - } else { - checker_exit('unconfigured_restricted_media'); - } - } else { - checker_exit('uptodate'); - } + checker_exit('uptodate'); } } else { checker_exit('db_not_open'); @@ -910,8 +889,6 @@ sub setState { } elsif ($state eq 'updates') { unshift @arr, 'upgrade_distro' if $new_distro; $bubble->add_action('clicked', N("Install updates"), \&installUpdates); - } elsif ($state eq 'unconfigured_restricted_media') { - $bubble->add_action('clicked', N("More Information"), \&prepare_add_restricted); } elsif (member($state, qw(no_enabled_medium no_update_medium))) { $bubble->add_action('clicked', N("Add media"), \&add_media); } @@ -957,47 +934,3 @@ sub mainQuit() { Glib::Source->remove($network_timeout) if $network_timeout; Gtk2->main_quit; } - -sub get_enabled_restricted_media { - my ($urpm) = @_; - grep { $_->{name} =~ /restricted/i && !$_->{ignore} } @{$urpm->{media}}; -} - -sub is_restricted_media_configured { - my ($urpm) = @_; - return 1 if !is_restricted_media_supported(); - - my @restricted_media = get_enabled_restricted_media($urpm); - my @names = map { $_->{name} } @restricted_media; - # we need both 'Restricted' & 'Restricted Updates' media - # those who did online update trough mgaapplet do not have restricted medium, hence the test for 2 medium: - @restricted_media >= (urpm::cfg::get_arch() =~ /64/ ? 4 : 2) - && (grep { /Restricted Updates/ } @names) && (grep { /Restricted/ && !/Updates/ } @names); -} - -sub really_prepare_add_restricted() { - $mdv_update_pid = run_program::raw({ detach => 1 }, - 'mgaapplet-add-media-helper', - $product_id->{version}); -} - -sub prepare_add_restricted() { - my $warn_me = text2bool($local_config{DO_NOT_ASK_FOR_RESTRICTED}); - return if $warn_me; - my $w = new_portable_dialog(N("New medium available")); - my $res = - fill_n_run_portable_dialog( - $w, - [ - get_banner(N("New medium available")), - gtknew('Label_Left', text => - N("You use '%s' distribution and therefore have privileged access to additional software.", - translate_product($product_id->{version})) . "\n\n" . - N("Do you want to install this additional software repository?"), @common), - gtknew('CheckButton', text => N("Do not ask me next time"), active_ref => \$warn_me), - create_okcancel($w, N("Next"), N("Cancel")), - ]); - setVar('DO_NOT_ASK_FOR_RESTRICTED', bool2text($warn_me)); - $local_config{DO_NOT_ASK_FOR_RESTRICTED} = bool2text($warn_me); - $res ? really_prepare_add_restricted() : 0; -} diff --git a/mgaapplet-add-media-helper b/mgaapplet-add-media-helper index 668d3740..d1964228 100755 --- a/mgaapplet-add-media-helper +++ b/mgaapplet-add-media-helper @@ -39,16 +39,6 @@ use utf8; # %product is keyed by product id and it contains the data to add # restricted media for each product. my %product = ( - powerpack => { - info_url => 'https://www.mageia.org/', - has_rights => sub { - my $profile = shift @_; - $profile->{data}{'can-access-restricted-repositories'} eq 'YES'; - }, - media_name => 'Restricted', - add_medium => \&mgaonline::add_medium_powerpack - - }, extended => { info_url => 'https://www.mageia.org/', has_rights => sub { diff --git a/mgaapplet-config b/mgaapplet-config index 768b41a1..cd3e121b 100755 --- a/mgaapplet-config +++ b/mgaapplet-config @@ -90,12 +90,6 @@ sub configure() { active_ref => \$config{DO_NOT_ASK_FOR_DISTRO_UPGRADE}, ), ], - if_(is_restricted_media_supported(), - [ gtknew('CheckButton', - text => N("Check for missing \"%s\" media", N("Restricted")), - active_ref => \$config{DO_NOT_ASK_FOR_RESTRICTED}, - ), - ]), ]), create_okcancel($w), #, N("Next"), N("Cancel")), ]); @@ -119,7 +113,7 @@ sub configure() { sub invbools_for_display { my ($config) = @_; - foreach (qw(DO_NOT_ASK_FOR_DISTRO_UPGRADE DO_NOT_ASK_FOR_RESTRICTED)) { + foreach (qw(DO_NOT_ASK_FOR_DISTRO_UPGRADE)) { invbool(\$config->{$_}); } } diff --git a/mgaapplet-upgrade-helper b/mgaapplet-upgrade-helper index c9b8bad6..1089a805 100755 --- a/mgaapplet-upgrade-helper +++ b/mgaapplet-upgrade-helper @@ -159,87 +159,6 @@ sub create_upgrade_succeeded_window() { return $w; } -# Returns: undef if failed to authenticate, [$email, $passwd] otherwise -sub powerpack_auth_callback { - my ($email, $passwd) = @_; - my $profile = mgaonline::get_my_mdv_profile($email, $passwd); - - # Checking for profile retrieving errors... - if ($profile->{code} != 0) { - my $in = interactive->vnew; - $in->ask_warn(N("Error"), - N("An error occurred") . "\n" . $profile->{message}); - return; - } - - # Checking rights to powerpack media... - # - # level 2 => mandriva group - # level 6 => powerpack subscriber group - # data.families => acces to especific version if matches - # powerpack-VERSION - # - my $level = $profile->{data}{club}{level}; - if ($level == 2 || $level == 6) { - return [$email, $passwd]; - } - elsif ($profile->{data}{families} =~ /powerpack-$new_distro_version/i) { - return [$email, $passwd]; - } - else { - mgaapplet_gui::run_no_rights_dialog( - N("Powerpack Media Configuration"), - N("You current Mageia account does not have Powerpack subscription enabled."), - 'http://www.mageia.org', - ); - return; - } -} - -sub try_to_add_powerpack_media() { - my $is_powerpack = mgaonline::is_restricted_media_supported(); - my $auth_info; - - # Validating current product for offering powerpack medias... - - if ($is_powerpack) { - # Verifying rights of current powerpack users... - my $title = N("Powerpack Media Configuration"); - my $description = N("Please fill your My.Mageia login and password to add additional package media for Powerpack."); - - # If no rights @auth_info == ()... - $auth_info = run_ask_credentials_dialog( - $title, - $description, - \&powerpack_auth_callback, - ); - } - elsif ($product_id->{product} !~ /flash|free|one/i) { - return; # don't offer pwp for any other product - } - - my $choice; # will be 'powerpack', 'free' or undef - while ($auth_info - || ($choice = mgaapplet_gui::open_ask_powerpack_dialog( - $product_id->{product}, - $new_distro_version))) { - $auth_info and return $auth_info; - - # Get the new authentication info from user... - my $title = N("Powerpack Media Configuration"); - my $description = N("Please fill your account ID to add Powerpack %s version packages media once you have subscribed online", - $new_distro_version); - $auth_info = run_ask_credentials_dialog( - $title, - $description, - \&powerpack_auth_callback, - top_extra => $mgaapplet_gui::powerpack_ad, - ); - } - defined $choice or exit 0; # means user has canceled upgrade - return; -} - sub upgrade() { my $xid = gtkroot()->XWINDOW; @@ -273,13 +192,6 @@ packages as well?).")) touch(get_stale_upgrade_filename()); - # disabled for mageia, should be cleaned - #log::explanations( - # "checking if restricted (powerpack) media is to be addded"); - # add_pwp_auth != undef, means user asked for pwp with good credentials - #my $add_pwp_auth = try_to_add_powerpack_media(); - my $add_pwp_auth; - log::explanations("removing all existing urpmi media for upgrade"); run_program::run('urpmi.removemedia', if_($root, '--urpmi-root', $root), '-a'); @@ -313,31 +225,6 @@ packages as well?).")) exit(2); }; - if ($add_pwp_auth) { - log::explanations("adding restricted (powerpack) media"); - - my ($email, $passwd) = @$add_pwp_auth; - unless (mgaonline::add_medium_powerpack( - $email, - $passwd, - $new_distro_version, - urpm::cfg::get_arch() - )) { - # FIXME Don't replicate code like this! - log::explanations("adding media for new distribution failed"); - rm_rf(get_stale_upgrade_filename()); - log::explanations("restoringing urpmi configuration from $file"); - cp_af($file, "$root/etc/urpmi/urpmi.cfg"); - update_media(); - ugtk2::ask_warn(N("Error"), - N("Installation failed"), - N("Failed to add powerpack restricted medium"), - ); - exit(2); - } - # Media was added, update it and move along... - update_media(); - } log::explanations("upgrading urpmi and rpmdrake"); log::explanations("upgrading the whole system"); diff --git a/mgaapplet_gui.pm b/mgaapplet_gui.pm index 8ac332ea..ebec40a3 100644 --- a/mgaapplet_gui.pm +++ b/mgaapplet_gui.pm @@ -42,10 +42,8 @@ our @EXPORT = qw( ); our @EXPORT_OK = qw( - $powerpack_ad run_ask_credentials_dialog run_no_rights_dialog - open_ask_powerpack_dialog ); use mygtk2 qw(gtknew); #- do not import gtkadd which conflicts with ugtk2 version @@ -77,32 +75,6 @@ our @common = ( width => $width - 50, ); -# List of widgets advertising Powerpack -our $powerpack_ad = [ - gtknew('Label_Left', - text => N("Mageia Powerpack brings you the best of Linux experience for desktop: stability and efficiency of open source solutions together with exclusive softwares and Mageia official support."), - @common), - gtknew('HButtonBox', - layout => 'center', - children_tight => [ - new_link_button( - 'http://www.mageia.org/', # FIXME: URL! - N("Mageia Linux Features") - ) - ]), - gtknew('Label_Left', - text => 'You can order now access for Powerpack', - ), - gtknew('HButtonBox', - layout => 'center', - children_tight => [ - new_link_button( - 'http://www.mageia.org/', # FIXME: URL! - N("Online subscription") - ) - ]), -]; - sub new_portable_dialog { my ($title) = @_; ugtk2->new($title, width => $width + 20); @@ -264,51 +236,3 @@ sub run_no_rights_dialog { ); fill_n_run_portable_dialog($w, \@widgets); } - -# Returns a string of user's choice: 'powerpack' or 'free'. -sub open_ask_powerpack_dialog { - my ($current_product, $new_version) = @_; - - # Setup powerpack offering radio buttons... - - my @radio_widgets; - my $rbutton; - # pwp/flash users will be offered powerpack by default - my $want_powerpack = $current_product =~ /powerpack|flash/i; - foreach my $product ($want_powerpack - ? ('powerpack', 'free') : ('free', 'powerpack')) { - my $info = mgaonline::get_product_info($product); - $rbutton - = Gtk2::RadioButton->new_with_label($rbutton - ? $rbutton->get_group - : undef, - $info->{name}); - $rbutton->signal_connect('toggled', - sub { - my ($button, $is_pwp) = @_; - $want_powerpack = $is_pwp - if $button->get_active; - }, - $product eq 'powerpack'); - push @radio_widgets, [ $rbutton, $info->{description} ]; - } - - # Setup dialog widgets... - - my $title = N("Choose your upgrade version"); - my $w = new_portable_dialog($title); - my @widgets - = (mgaonline::get_banner($current_product =~ /powerpack/i - ? N("Your Powerpack access has ended") - : $title), - gtknew('Label_Left', - text => N("%s is now available, you can upgrade to:", - $new_version), - @common), - gtknew('Table', children => \@radio_widgets, row_spacings => 10), - ugtk2::create_okcancel($w, N("Next"), N("Cancel")), - ); - - fill_n_run_portable_dialog($w, \@widgets) or return undef; - return $want_powerpack; -} diff --git a/mgaonline.pm b/mgaonline.pm index cbabd47d..43a149f8 100644 --- a/mgaonline.pm +++ b/mgaonline.pm @@ -46,7 +46,6 @@ our @EXPORT = qw(find_current_distro get_stale_upgrade_filename get_urpmi_options is_extmaint_supported - is_restricted_media_supported read_sys_config translate_product xml2perl @@ -57,7 +56,6 @@ our @EXPORT = qw(find_current_distro our @EXPORT_OK = qw( get_product_info get_my_mdv_profile - add_medium_powerpack add_medium_extended ); @@ -91,12 +89,6 @@ sub is_extmaint_supported() { $product_id->{support} eq 'extended'; } - -sub is_restricted_media_supported() { - return; # NOT SUPPORTED ON MAGEIA - to_bool($product_id->{product} =~ /powerpack/i); -} - sub find_current_distro { find { $_->{version} eq $product_id->{version} } @_; } @@ -161,7 +153,6 @@ sub translate_product { free => N("Mageia Free"), mini => N("Mageia Mini"), one => N("Mageia One"), - powerPack => N("Mageia PowerPack"), ); $product ||= lc $product_id->{product}; $strings{$product} || $product; @@ -172,10 +163,6 @@ sub translate_product { sub get_product_info { my ($product) = @_; my %info = ( - powerpack => { - name => N("Mageia PowerPack"), - description => N("The Mageia Linux distribution with even more softwares and official support."), - }, free => { name => N("Mageia Free"), description => N("The 100%% Open Source distribution freely available."), @@ -199,25 +186,6 @@ sub get_urpmi_options() { ({ sensitive_arguments => 1 }, 'urpmi.addmedia', '--xml-info', 'always'); } -sub add_medium_powerpack { - my ($email, $password, $version, $arch) = @_; - my $uri = sprintf('https://%s:%s@dl.FIXME.com/rpm/comm/%s/', - uri_escape($email), - uri_escape($password), - $version); - my @options = get_urpmi_options(); - - # add release and updates media... - run_program::raw(@options, - "Restricted $arch " . int(rand(100000)), - "$uri$arch") - or return 0; - run_program::raw(@options, - '--update', - "Restricted Updates $arch " . int(rand(100000)), - "${uri}updates/$arch"); -} - sub add_medium_extended { my ($email, $password, $version, $arch) = @_; my $uri = sprintf("https://%s:%s\@dl.FIXME.com/extended/%s/%s", |