summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rwxr-xr-xmdkapplet33
-rw-r--r--mdkonline.pm35
3 files changed, 38 insertions, 33 deletions
diff --git a/NEWS b/NEWS
index c7ad3dc7..295dc4e5 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+- mdkapplet
+ o enable to share some code with mcc
+
Version 2.77.15.1 - 25 January 2010, Thierry Vignaud
- mdkapplet-extended-maintenance-helper
diff --git a/mdkapplet b/mdkapplet
index 1dedf9d1..5e477371 100755
--- a/mdkapplet
+++ b/mdkapplet
@@ -53,7 +53,7 @@ if (!find { $_ eq '--auto-update' } @ARGV) {
my $online_site = "http://www.mandrivalinux.com/";
my ($menu, $timeout, $network_timeout, $state_global, $sub_state);
-my %config = getVarsFromSh('/etc/sysconfig/mdkapplet');
+%config = getVarsFromSh('/etc/sysconfig/mdkapplet');
$config{UPDATE_FREQUENCY} ||= 3*60*60; # default to 3hours
if ($::testing) {
$config{FIRST_CHECK_DELAY} = 1 * 1000; # 1 second
@@ -285,37 +285,6 @@ Gtk2->main;
ugtk2::exit(0);
-sub get_distro_list() {
- #- contact the following URL to retrieve the list of released distributions.
- my $type = lc($product_id->{type}); $type =~ s/\s//g;
- my $extra_path = $::testing || uc($config{TEST_DISTRO_UPGRADE}) eq 'YES' ? 'testing-' : '';
- my $list =
- join('&',
- "https://api.mandriva.com/distributions/$extra_path$type.$product_id->{arch}.list?product=$product_id->{product}",
- "version=$product_id->{version}",
- "mdkonline_version=$mdkonline::version",
- );
- log::explanations("trying distributions list from $list");
-
- eval {
- my $urpm = Rpmdrake::open_db::fast_open_urpmi_db();
-
- # prevent SIGCHILD handler's waitpid to interfere with urpmi waiting
- # 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 mdkapplet_urpm;
- mdkapplet_urpm::ensure_valid_cachedir($urpm);
- mdkapplet_urpm::get_content($urpm, $list);
- } else {
- urpm::ensure_valid_cachedir($urpm);
- urpm::download::get_content($urpm, $list);
- }
- };
-}
-
sub is_there_a_new_distributions() {
return if $product_id->{product} =~ /Flash/;
diff --git a/mdkonline.pm b/mdkonline.pm
index 5849f2c0..e1acf383 100644
--- a/mdkonline.pm
+++ b/mdkonline.pm
@@ -32,6 +32,7 @@ use ugtk2;
our @ISA = qw(Exporter);
our @EXPORT = qw(fork_exec
get_banner
+ get_distro_list
get_from
get_product_id
get_stale_upgrade_filename
@@ -39,10 +40,11 @@ our @EXPORT = qw(fork_exec
is_restricted_media_supported
translate_product
xml2perl
+ %config
$product_id
$root);
-our ($product_id, $root);
+our (%config, $product_id, $root);
our $version = 2.67;
use log;
@@ -71,6 +73,37 @@ sub is_restricted_media_supported() {
to_bool($product_id->{product} =~ /powerpack/i);
}
+sub get_distro_list() {
+ #- contact the following URL to retrieve the list of released distributions.
+ my $type = lc($product_id->{type}); $type =~ s/\s//g;
+ my $extra_path = $::testing || uc($config{TEST_DISTRO_UPGRADE}) eq 'YES' ? 'testing-' : '';
+ my $list =
+ join('&',
+ "https://api.mandriva.com/distributions/$extra_path$type.$product_id->{arch}.list?product=$product_id->{product}",
+ "version=$product_id->{version}",
+ "mdkonline_version=$mdkonline::version",
+ );
+ log::explanations("trying distributions list from $list");
+
+ eval {
+ my $urpm = Rpmdrake::open_db::fast_open_urpmi_db();
+
+ # prevent SIGCHILD handler's waitpid to interfere with urpmi waiting
+ # 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 mdkapplet_urpm;
+ mdkapplet_urpm::ensure_valid_cachedir($urpm);
+ mdkapplet_urpm::get_content($urpm, $list);
+ } else {
+ urpm::ensure_valid_cachedir($urpm);
+ urpm::download::get_content($urpm, $list);
+ }
+ };
+}
+
sub clean_confdir() {
my $confdir = '/root/.MdkOnline';
system "/bin/rm", "-f", "$confdir/*log.bz2", "$confdir/*log.bz2.uue", "$confdir/*.dif $confdir/rpm_qa_installed_before", "$confdir/rpm_qa_installed_after";