summaryrefslogtreecommitdiffstats
path: root/mdkonline.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2010-01-25 14:09:05 +0000
committerThierry Vignaud <tv@mandriva.org>2010-01-25 14:09:05 +0000
commit97f967e55040f3d5434e90d2cf81629e9d680be9 (patch)
tree8259364490840d6115dfb6b99bdb9fac3003dc24 /mdkonline.pm
parent3a326da0996a84db58f0134df7229072222c2ff3 (diff)
downloadmgaonline-97f967e55040f3d5434e90d2cf81629e9d680be9.tar
mgaonline-97f967e55040f3d5434e90d2cf81629e9d680be9.tar.gz
mgaonline-97f967e55040f3d5434e90d2cf81629e9d680be9.tar.bz2
mgaonline-97f967e55040f3d5434e90d2cf81629e9d680be9.tar.xz
mgaonline-97f967e55040f3d5434e90d2cf81629e9d680be9.zip
(get_distro_list) move it so that it's reusable by mcc
Diffstat (limited to 'mdkonline.pm')
-rw-r--r--mdkonline.pm35
1 files changed, 34 insertions, 1 deletions
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";