From 5ee5f745ef8b7e123e618cdf91f581d064c72e75 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 6 Mar 2003 13:10:05 +0000 Subject: fixed newer export methodology. --- urpm.pm | 177 +++++++++++++++++++++++++++--------------------------- urpme | 5 +- urpmf | 5 +- urpmi | 5 +- urpmi.addmedia | 3 - urpmi.removemedia | 3 - urpmi.spec | 5 +- urpmi.update | 3 - urpmq | 3 - 9 files changed, 96 insertions(+), 113 deletions(-) diff --git a/urpm.pm b/urpm.pm index 602328e5..62bfedc5 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1,95 +1,11 @@ package urpm; use strict; -use vars qw($VERSION); -use base 'URPM'; +use vars qw($VERSION @ISA @EXPORT); $VERSION = '4.2'; - -=head1 NAME - -urpm - Mandrake perl tools to handle urpmi database - -=head1 SYNOPSYS - - require urpm; - - my $urpm = new urpm; - $urpm->read_config(); - $urpm->add_medium('medium_ftp', - 'ftp://ftp.mirror/pub/linux/distributions/mandrake-devel/cooker/i586/Mandrake/RPMS', - 'synthesis.hdlist.cz', - update => 0); - $urpm->add_distrib_media('stable', 'removable://mnt/cdrom', - update => 1); - $urpm->select_media('contrib', 'update'); - $urpm->update_media(%options); - $urpm->write_config(); - - my $urpm = new urpm; - $urpm->read_config(nocheck_access => $uid > 0); - foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) { - $urpm->parse_synthesis($_); - } - if (@files) { - push @names, $urpm->register_rpms(@files); - } - $urpm->relocate_depslist_provides(); - - my %packages; - @names and $urpm->search_packages(\%packages, [ @names], - use_provides => 1); - if ($auto_select) { - my (%to_remove, %keep_files); - - $urpm->select_packages_to_upgrade('', \%packages, - \%to_remove, \%keep_files, - use_parsehdlist => $complete); - } - $urpm->filter_packages_to_upgrade(\%packages, - $ask_choice); - $urpm->deselect_unwanted_packages(\%packages); - - my ($local_sources, $list) = $urpm->get_source_packages(\%packages); - my %sources = $urpm->download_source_packages($local_sources, - $list, - 'force_local', - $ask_medium_change); - my @rpms_install = grep { $_ !~ /\.src.\.rpm/ } values %{ - $urpm->extract_packages_to_install(\%sources) - || {}}; - my @rpms_upgrade = grep { $_ !~ /\.src.\.rpm/ } values %sources; - - -=head1 DESCRIPTION - -C is used by urpmi executables to manipulate packages and media -on a Linux-Mandrake distribution. - -=head1 SEE ALSO - -perl-URPM (obsolete rpmtools) package is used to manipulate at a lower -level hdlist and rpm files. - -=head1 COPYRIGHT - -Copyright (C) 2000,2001,2002 MandrakeSoft - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -=cut +@ISA = qw(Exporter URPM); +@EXPORT = qw(*N); use URPM; use POSIX; @@ -2658,3 +2574,90 @@ sub parallel_remove { } 1; + +__END__ + +=head1 NAME + +urpm - Mandrake perl tools to handle urpmi database + +=head1 SYNOPSYS + + require urpm; + + my $urpm = new urpm; + $urpm->read_config(); + $urpm->add_medium('medium_ftp', + 'ftp://ftp.mirror/pub/linux/distributions/mandrake-devel/cooker/i586/Mandrake/RPMS', + 'synthesis.hdlist.cz', + update => 0); + $urpm->add_distrib_media('stable', 'removable://mnt/cdrom', + update => 1); + $urpm->select_media('contrib', 'update'); + $urpm->update_media(%options); + $urpm->write_config(); + + my $urpm = new urpm; + $urpm->read_config(nocheck_access => $uid > 0); + foreach (grep { !$_->{ignore} } @{$urpm->{media} || []}) { + $urpm->parse_synthesis($_); + } + if (@files) { + push @names, $urpm->register_rpms(@files); + } + $urpm->relocate_depslist_provides(); + + my %packages; + @names and $urpm->search_packages(\%packages, [ @names], + use_provides => 1); + if ($auto_select) { + my (%to_remove, %keep_files); + + $urpm->select_packages_to_upgrade('', \%packages, + \%to_remove, \%keep_files, + use_parsehdlist => $complete); + } + $urpm->filter_packages_to_upgrade(\%packages, + $ask_choice); + $urpm->deselect_unwanted_packages(\%packages); + + my ($local_sources, $list) = $urpm->get_source_packages(\%packages); + my %sources = $urpm->download_source_packages($local_sources, + $list, + 'force_local', + $ask_medium_change); + my @rpms_install = grep { $_ !~ /\.src.\.rpm/ } values %{ + $urpm->extract_packages_to_install(\%sources) + || {}}; + my @rpms_upgrade = grep { $_ !~ /\.src.\.rpm/ } values %sources; + + +=head1 DESCRIPTION + +C is used by urpmi executables to manipulate packages and media +on a Linux-Mandrake distribution. + +=head1 SEE ALSO + +perl-URPM (obsolete rpmtools) package is used to manipulate at a lower +level hdlist and rpm files. + +=head1 COPYRIGHT + +Copyright (C) 2000,2001,2002 MandrakeSoft + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +=cut diff --git a/urpme b/urpme index 1110c177..6c914d71 100644 --- a/urpme +++ b/urpme @@ -25,9 +25,6 @@ use URPM; use URPM::Resolve; use urpm; -#- get I18N translation method. -import urpm N; - my (@nextargv, $root, $test, $parallel, $auto, $matches, $maymatch, @l); my $askok = N("Is this OK?"); # Translator: Add here the keys which might be pressed in the "No"-case. @@ -53,7 +50,7 @@ usage: @ARGV or usage; while (defined($_ = shift @ARGV)) { /^--help$/ and do { usage; next }; - /^--no-locales$/ and do { undef *_; undef *urpm::_; *_ = *urpm::_ = sub { sprintf(shift @_, @_) }; next }; + /^--no-locales$/ and do { undef *N; undef *urpm::N; *N = *urpm::N = sub { sprintf(shift @_, @_) }; next }; /^--?auto$/ and do { $auto = 1; next }; /^--(no-)?test$/ and do { $test = !$1; next }; /^--root$/ and do { push @nextargv, \$root; next }; diff --git a/urpmf b/urpmf index bb621543..522f3910 100755 --- a/urpmf +++ b/urpmf @@ -19,9 +19,6 @@ #use strict qw(subs vars refs); use urpm; -#- get I18N translation method. -import urpm N; - sub usage { print STDERR N("urpmf version %s Copyright (C) 2002 MandrakeSoft. @@ -75,7 +72,7 @@ my $expr; my @nextargv; while (defined($_ = shift @ARGV)) { /^--help$/ and do { usage; next }; - /^--no-locales$/ and do { undef *_; undef *urpm::_; *_ = *urpm::_ = sub { sprintf(shift @_, @_) }; next }; + /^--no-locales$/ and do { undef *N; undef *urpm::N; *N = *urpm::N = sub { sprintf(shift @_, @_) }; next }; /^--update$/ and do { $update = 1; next }; /^--media$/ and do { push @nextargv, \$media; next }; /^--mediums$/ and do { push @nextargv, \$media; next }; diff --git a/urpmi b/urpmi index 7bf00d2b..06af1270 100755 --- a/urpmi +++ b/urpmi @@ -19,9 +19,6 @@ #use strict qw(subs vars refs); use urpm; -#- get I18N translation method. -import urpm N; - #- contains informations to parse installed system. my $urpm = new urpm; @@ -132,7 +129,7 @@ my $command_line = join " ", @ARGV; @ARGV or usage; while (defined($_ = shift @ARGV)) { /^--help$/ and do { usage; next }; - /^--no-locales$/ and do { undef *_; undef *urpm::_; *_ = *urpm::_ = sub { sprintf(shift @_, @_) }; next }; + /^--no-locales$/ and do { undef *N; undef *urpm::N; *N = *urpm::N = sub { sprintf(shift @_, @_) }; next }; /^--update$/ and do { $update = 1; next }; /^--media$/ and do { push @nextargv, \$media; next }; /^--mediums$/ and do { push @nextargv, \$media; next }; diff --git a/urpmi.addmedia b/urpmi.addmedia index 417d1396..179524de 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -21,9 +21,6 @@ #use strict qw(subs vars refs); use urpm; -#- get I18N translation method. -import urpm N; - sub main { my ($name, $url, $with, $relative_hdlist, %options); #- parse /etc/urpmi/mirror.config if present, or use default mandrake mirror. diff --git a/urpmi.removemedia b/urpmi.removemedia index 09d344bb..5ed4717f 100755 --- a/urpmi.removemedia +++ b/urpmi.removemedia @@ -21,9 +21,6 @@ #use strict qw(subs vars refs); use urpm; -#- get I18N translation method. -import urpm N; - sub main { my (@toremoves, %options); diff --git a/urpmi.spec b/urpmi.spec index ca926c36..297807c3 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -207,8 +207,9 @@ fi %changelog * Thu Mar 6 2003 François Pons 4.2-29mdk -- reworked po generation completely due to missing - translations now using perl_checker. (pablo) +- reworked po generation completely due to missing translations + now using perl_checker. (pablo) +- changed library exports (now N function is always exported). * Tue Mar 4 2003 Guillaume Cottenceau 4.2-28mdk - fixed french translations. diff --git a/urpmi.update b/urpmi.update index 67bc196f..a8854538 100755 --- a/urpmi.update +++ b/urpmi.update @@ -21,9 +21,6 @@ #use strict qw(subs vars refs); use urpm; -#- get I18N translation method. -import urpm N; - sub main { my (@toupdates, %options); my $urpm = new urpm; diff --git a/urpmq b/urpmq index 097692ee..523a8508 100755 --- a/urpmq +++ b/urpmq @@ -21,9 +21,6 @@ use strict; use urpm; -# get I18N translation method. -import urpm N; - #- default options. my $query = { use_provides => 1, }; -- cgit v1.2.1