diff options
author | Thierry Vignaud <tv@mandriva.org> | 2010-01-25 14:09:09 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2010-01-25 14:09:09 +0000 |
commit | e21496c91b490d791375e4316bc5d6b475633fe9 (patch) | |
tree | f6edd4d5a9a01390aa3580621e02b16d277d3e64 | |
parent | da2895c06e2fdde78b0a9eec63d906b85969e987 (diff) | |
download | mgaonline-e21496c91b490d791375e4316bc5d6b475633fe9.tar mgaonline-e21496c91b490d791375e4316bc5d6b475633fe9.tar.gz mgaonline-e21496c91b490d791375e4316bc5d6b475633fe9.tar.bz2 mgaonline-e21496c91b490d791375e4316bc5d6b475633fe9.tar.xz mgaonline-e21496c91b490d791375e4316bc5d6b475633fe9.zip |
(get_distro_list_,get_distro_list) share even more code for mcc
-rwxr-xr-x | mdkapplet | 17 | ||||
-rw-r--r-- | mdkonline.pm | 22 |
2 files changed, 23 insertions, 16 deletions
@@ -286,24 +286,11 @@ Gtk2->main; ugtk2::exit(0); sub is_there_a_new_distributions() { - return if $product_id->{product} =~ /Flash/; - # sanity check for cooker: return if $product_id->{branch} eq 'Devel'; - my @lines = get_distro_list(); - - if (my $err = $@) { - log::explanations("failed to download distribution list:\n$err"); - return; # not a fatal error - } - - if (!@lines) { - log::explanations("empty distribution list"); - return; - } - - my @distros = map { common::parse_LDAP_namespace_structure(chomp_($_)) } @lines; + my @distros = get_distro_list(); + return if !@distros; # do not do anything if current distribution isn't listed on api.mdv.com: return if !member($product_id->{version}, map { $_->{version} } @distros); diff --git a/mdkonline.pm b/mdkonline.pm index 3cf4366e..a5b4d16d 100644 --- a/mdkonline.pm +++ b/mdkonline.pm @@ -33,6 +33,7 @@ our @ISA = qw(Exporter); our @EXPORT = qw(find_current_distro fork_exec get_banner + get_distro_list_ get_distro_list get_from get_product_id @@ -78,7 +79,7 @@ sub find_current_distro { find { $_->{version} eq $product_id->{version} } @_; } -sub get_distro_list() { +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-' : ''; @@ -109,6 +110,25 @@ sub get_distro_list() { }; } +sub get_distro_list() { + return if $product_id->{product} =~ /Flash/; + + my @lines = get_distro_list_(); + + if (my $err = $@) { + log::explanations("failed to download distribution list:\n$err"); + return; # not a fatal error + } + + if (!@lines) { + log::explanations("empty distribution list"); + return; + } + + map { common::parse_LDAP_namespace_structure(chomp_($_)) } @lines; +} + + 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"; |