summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-14 01:26:09 +0000
committerJoão Victor Duarte Martins <jvictor@mandriva.com>2010-05-14 01:26:09 +0000
commitd89150b6df90859a55c10d7f3bc495a8cf05c9bb (patch)
treee1022e2ce3792cc08247a26def2423304f93ff88
parent3060b9ba67bf87b3de0bfdd288a4f3f329eaaa25 (diff)
downloadmgaonline-d89150b6df90859a55c10d7f3bc495a8cf05c9bb.tar
mgaonline-d89150b6df90859a55c10d7f3bc495a8cf05c9bb.tar.gz
mgaonline-d89150b6df90859a55c10d7f3bc495a8cf05c9bb.tar.bz2
mgaonline-d89150b6df90859a55c10d7f3bc495a8cf05c9bb.tar.xz
mgaonline-d89150b6df90859a55c10d7f3bc495a8cf05c9bb.zip
moved add_medium_powerpack and add_medium_enterprise for reusability.
-rwxr-xr-xmdkapplet-add-media-helper32
-rw-r--r--mdkonline.pm38
2 files changed, 39 insertions, 31 deletions
diff --git a/mdkapplet-add-media-helper b/mdkapplet-add-media-helper
index 0130b12b..61180634 100755
--- a/mdkapplet-add-media-helper
+++ b/mdkapplet-add-media-helper
@@ -34,7 +34,6 @@ use mdkapplet_gui;
use urpm::cfg;
use XML::Simple;
-use URI::Escape;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Request;
@@ -51,7 +50,7 @@ my %product = (
$profile->{data}{'can-access-restricted-repositories'} eq 'YES';
},
media_name => 'Restricted',
- add_medium => \&add_medium_powerpack
+ add_medium => \&mdkonline::add_medium_powerpack
},
server => {
@@ -62,7 +61,7 @@ my %product = (
$profile->{data}{groups}{'es5-demo'};
},
media_name => 'Update',
- add_medium => \&add_medium_enterprise
+ add_medium => \&mdkonline::add_medium_enterprise
},
);
@@ -202,30 +201,3 @@ sub add_medium_for_product {
ugtk2::main($w);
}
}
-
-sub add_medium_enterprise {
- my ($email, $password, $version, $arch) = @_;
- my $uri = sprintf("https://%s:%s\@download.mandriva.com/%s/rpms/%s/",
- uri_escape($email),
- uri_escape($password),
- $version,
- $arch);
- my @options = mdkonline::get_urpmi_options();
- run_program::raw(@options, '--update', '--distrib', $uri);
-}
-
-sub add_medium_powerpack {
- my ($email, $password, $version, $arch) = @_;
- my $uri = sprintf("https://%s:%s\@dl.mandriva.com/rpm/comm/%s/",
- uri_escape($email),
- uri_escape($password),
- $version);
- my @options = mdkonline::get_urpmi_options();
- 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");
-}
diff --git a/mdkonline.pm b/mdkonline.pm
index 02399a66..d6964d98 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -29,6 +29,8 @@ use lib qw(/usr/lib/libDrakX);
use common;
use ugtk2;
+use URI::Escape;
+
our @ISA = qw(Exporter);
our @EXPORT = qw(find_current_distro
fork_exec
@@ -50,7 +52,11 @@ our @EXPORT = qw(find_current_distro
$config_file
$product_id
$root);
-our @EXPORT_OK = qw(get_my_mdv_profile);
+our @EXPORT_OK = qw(
+ get_my_mdv_profile
+ add_medium_powerpack
+ add_medium_powerpack
+);
our (%config, $product_id, $root);
our $version = 1;
@@ -186,6 +192,36 @@ sub get_urpmi_options() {
({ sensitive_arguments => 1 }, 'urpmi.addmedia', if_(!is_it_2008_0(), '--xml-info', 'always'));
}
+sub add_medium_enterprise {
+ my ($email, $password, $version, $arch) = @_;
+ my $uri = sprintf("https://%s:%s\@download.mandriva.com/%s/rpms/%s/",
+ uri_escape($email),
+ uri_escape($password),
+ $version,
+ $arch);
+ my @options = get_urpmi_options();
+ run_program::raw(@options, '--update', '--distrib', $uri);
+}
+
+sub add_medium_powerpack {
+ my ($email, $password, $version, $arch) = @_;
+ my $uri = sprintf("https://%s:%s\@dl.mandriva.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',
+ "Restrictend Updates $arch " . int(rand(100000)),
+ "${uri}updates/$arch");
+}
+
sub is_running {
my ($name) = @_;
my $found;