summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2002-12-06 15:15:13 +0000
committerFrancois Pons <fpons@mandriva.com>2002-12-06 15:15:13 +0000
commit60d4ad6c90817f674088bf32302c575b7b5129f2 (patch)
tree4b6615e0d16757d4d8101e1449a441b1168c4081
parent6df583d5c4a24b38545e8ee8fd26d19b7ff6b728 (diff)
downloadurpmi-60d4ad6c90817f674088bf32302c575b7b5129f2.tar
urpmi-60d4ad6c90817f674088bf32302c575b7b5129f2.tar.gz
urpmi-60d4ad6c90817f674088bf32302c575b7b5129f2.tar.bz2
urpmi-60d4ad6c90817f674088bf32302c575b7b5129f2.tar.xz
urpmi-60d4ad6c90817f674088bf32302c575b7b5129f2.zip
4.1-9mdk
-rw-r--r--urpm.pm13
-rw-r--r--urpm/parallel_ka_run.pm2
-rw-r--r--urpm/parallel_ssh.pm2
-rwxr-xr-xurpmf182
-rwxr-xr-xurpmi.addmedia1
-rw-r--r--urpmi.spec14
6 files changed, 140 insertions, 74 deletions
diff --git a/urpm.pm b/urpm.pm
index e3f39ed0..939f7292 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -620,17 +620,16 @@ sub configure {
if ($options{callback}) {
if (-s "$urpm->{statedir}/$_->{hdlist}" > 32) {
$urpm->{log}(_("examining hdlist file [%s]", "$urpm->{statedir}/$_->{hdlist}"));
- eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$_->{hdlist}", 0) };
+ eval { ($_->{start}, $_->{end}) = $urpm->parse_hdlist("$urpm->{statedir}/$_->{hdlist}",
+ packing => 1, callback => $options{callback}) };
+ } elsif (-s "$urpm->{statedir}/synthesis.$_->{hdlist}" > 32) {
+ $urpm->{log}(_("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$_->{hdlist}"));
+ eval { ($_->{start}, $_->{end}) = $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$_->{hdlist}",
+ callback => $options{callback}) };
}
unless (defined $_->{start} && defined $_->{end}) {
$urpm->{error}(_("problem reading hdlist file of medium \"%s\"", $_->{name}));
$_->{ignore} = 1;
- } else {
- #- medium has been read correclty, now call the callback for each packages.
- #- it is the responsability of callback to pack the header.
- foreach ($_->{start} .. $_->{end}) {
- $options{callback}->($urpm, $_, %options);
- }
}
} else {
if (-s "$urpm->{statedir}/synthesis.$_->{hdlist}" > 32) {
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 10f29d66..7c43b34d 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -106,7 +106,7 @@ sub parallel_install {
/^\s*$/ and next;
$bad_nodes{$node} .= $_;
/Installation failed/ and $bad_nodes{$node} = '';
- /Installation is possible/ and delete $bad_nodes{$node};
+ /Installation is possible|everything already installed/ and delete $bad_nodes{$node};
}
close F or $urpm->{fatal}(1, _("rshp failed"));
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 9cc0198a..e376b8f8 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -108,7 +108,7 @@ sub parallel_install {
while ($_ = <F>) {
$bad_nodes{$node} .= $_;
/Installation failed/ and $bad_nodes{$node} = '';
- /Installation is possible/ and delete $bad_nodes{$node}, last;
+ /Installation is possible|everything already installed/ and delete $bad_nodes{$node}, last;
}
close F;
}
diff --git a/urpmf b/urpmf
index 1cce7060..cdd1ed92 100755
--- a/urpmf
+++ b/urpmf
@@ -1,63 +1,119 @@
-#!/bin/sh
-
-# NOTE TO MANTAINERS: when you add a string that is displayed to
-# the user use $ECHO not echo (that will use gettext if available)
-
-# i18n support
-ECHO=`which gettext 2> /dev/null`
-[ -z "$ECHO" ] && ECHO="echo" || ECHO="$ECHO -s"
-TEXTDOMAIN="urpmi"
-export TEXTDOMAIN
-
-dir="/var/lib/urpmi"
-options=
-
-while true
-do
- case $1 in
- -h|--help)
- TMPDATA=`$ECHO "urpmf version %s"`
- printf "$TMPDATA" `rpm -q rpmtools --qf '%{VERSION}'` ; echo
- $ECHO "Copyright (C) 1999, 2000, 2001, 2002 MandrakeSoft."
- $ECHO "This is free software and may be redistributed under the terms of the GNU GPL."
- echo
- $ECHO "usage: urpmf [options] <file>"
- $ECHO " --help - print this help message."
- $ECHO " --quiet - do not print tag name (default if no tag given on command"
- $ECHO " line, incompatible with interactive mode)."
- $ECHO " --all - print all tags."
- $ECHO " --name - print tag name: rpm filename (assumed if no tag given on"
- $ECHO " command line but without package name)."
- $ECHO " --group - print tag group: group."
- $ECHO " --size - print tag size: size."
- $ECHO " --serial - print tag serial: serial."
- $ECHO " --summary - print tag summary: summary."
- $ECHO " --description - print tag description: description."
- $ECHO " --provides - print tag provides: all provides (multiple lines)."
- $ECHO " --requires - print tag requires: all requires (multiple lines)."
- $ECHO " --files - print tag files: all files (multiple lines)."
- $ECHO " --conflicts - print tag conflicts: all conflicts (multiple lines)."
- $ECHO " --obsoletes - print tag obsoletes: all obsoletes (multiple lines)."
- $ECHO " --prereqs - print tag prereqs: all prereqs (multiple lines)."
- exit 1
- ;;
- --*)
- options="$1 $options"
- shift
- ;;
- *)
- if [ $# -gt 1 ]; then
- $ECHO "usage: urpmf [options] <file>"
- $ECHO "try urpmf --help for more options"
- exit 1
- fi
- if /bin/ls $dir/hdlist.* >/dev/null 2>/dev/null; then
- parsehdlist ${options:---files --quiet} $dir/hdlist.* | grep -E "$1"
- exit $?
- else
- $ECHO "no full media list was found"
- exit 1
- fi
- ;;
- esac
-done
+#!/usr/bin/perl
+
+#- Copyright (C) 2002 MandrakeSoft (fpons@mandrakesoft.com)
+#-
+#- 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.
+
+#use strict qw(subs vars refs);
+use urpm;
+
+#- get I18N translation method.
+import urpm _;
+
+sub usage {
+ print STDERR _("urpmf version %s
+Copyright (C) 2002 MandrakeSoft.
+This is free software and may be redistributed under the terms of the GNU GPL.
+
+usage:
+", $urpm::VERSION) . _(" --help - print this help message.
+") . _(" --update - use only update media.
+") . _(" --media - use only the media listed by comma.
+") . _(" --synthesis - use the synthesis given instead of urpmi db.
+") . _(" --verbose - verbose mode.
+") . _(" --quiet - do not print tag name (default if no tag given on command
+ line, incompatible with interactive mode).
+") . _(" --all - print all tags.
+") . _(" --name - print tag name: rpm filename (assumed if no tag given on
+ command line but without package name).
+") . _(" --group - print tag group: group.
+") . _(" --size - print tag size: size.
+") . _(" --epoch - print tag epoch: epoch.
+") . _(" --summary - print tag summary: summary.
+") . _(" --description - print tag description: description.
+") . _(" --provides - print tag provides: all provides (multiple lines).
+") . _(" --requires - print tag requires: all requires (multiple lines).
+") . _(" --files - print tag files: all files (multiple lines).
+") . _(" --conflicts - print tag conflicts: all conflicts (multiple lines).
+") . _(" --obsoletes - print tag obsoletes: all obsoletes (multiple lines).
+") . _(" --prereqs - print tag prereqs: all prereqs (multiple lines).
+") . _(" -e - include perl code directly as perl -e.
+") . _(" -a - binary AND operator, true if both expression are true.
+") . _(" -o - binary OR operator, true if one expression is true.
+") . _(" ! - unary NOT, true if expression is false.
+") . _(" ( - left parenthesis to open group expression.
+") . _(" ) - right parenthesis to close group expression.
+");
+ exit(0);
+}
+
+#- default options.
+my $update = 0;
+my $media = '';
+my $synthesis = '';
+my $verbose = 0;
+my $quiet = undef;
+my %params;
+
+#- parse arguments list.
+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 };
+ /^--update$/ and do { $update = 1; next };
+ /^--media$/ and do { push @nextargv, \$media; next };
+ /^--mediums$/ and do { push @nextargv, \$media; next };
+ /^--synthesis$/ and do { push @nextargv, \$synthesis; next };
+ /^--verbose$/ and do { $verbose = 1; next };
+ /^--quiet$/ and do { $quiet = 1; next };
+ /^--all$/ and do { $params{$_} = 1
+ foreach qw(group size summary description provides requires files conflicts obsoletes prereqs); next };
+ /^--(group|size|epoch|summary|description|provides|requires|files|conflicts|obsoletes|prereqs)$/ and
+ do { $params{$_} = 1; next };
+ /^-e$/ and do { $expr .= '('.$_.')'; next };
+ /^-a$/ and do { $expr .= ' && '; next };
+ /^-o$/ and do { $expr .= ' || '; next };
+ /^[!\(\)]$/ and do { $expr .= $_; next };
+ #- assume a regex directly
+ $expr .= 'm{'.$_.'}';
+}
+
+my $urpm = new urpm;
+$verbose or $urpm->{log} = sub {};
+
+for (scalar(keys %params)) {
+ $_ eq 0 and do { defined $quiet or $quiet = 1; $params{files} = 1 };
+ $_ eq 1 and do { defined $quiet or $quiet = 1 };
+ $_ > 1 and do { defined $quiet or $quiet = 0 };
+}
+
+#- build callback according expression.
+my $callback = 'sub { my ($urpm, $pkg) = @_; '; #- it is a good start for a sub, no ;-)
+foreach (qw(group size epoch summary description provides requires files conflicts obsoletes prereqs)) {
+ $params{$_} and $callback .= 'foreach my $e ($pkg->'.$_.') { local $_ = $pkg->name."'.(!$quiet && ":$_").':$e"; '.$expr.' or next; print "$_\n" }';
+}
+$callback .= ' 1; }';
+$callback = eval $callback;
+$@ and die;
+
+$urpm->configure(nocheck_access => 1,
+ media => $media,
+ synthesis => $synthesis,
+ update => $update,
+ callback => $callback,
+ );
+
+#- that'all! all has been done by callback above.
diff --git a/urpmi.addmedia b/urpmi.addmedia
index dcc030e2..7569c745 100755
--- a/urpmi.addmedia
+++ b/urpmi.addmedia
@@ -119,6 +119,7 @@ and [options] are from
if (exists $options{distrib}) {
if (defined $options{distrib}) {
+ $name or die $usage;
#- extended distribution support, code is directly inlined here.
#- -h always set, updates should allow setting update flag.
$options{probe_with_hdlist} = 1;
diff --git a/urpmi.spec b/urpmi.spec
index 0cfca845..3e71e689 100644
--- a/urpmi.spec
+++ b/urpmi.spec
@@ -2,14 +2,14 @@
Name: urpmi
Version: 4.1
-Release: 8mdk
+Release: 9mdk
License: GPL
Source0: %{name}.tar.bz2
Source1: %{name}.logrotate
Summary: User mode rpm install
URL: http://cvs.mandrakesoft.com/cgi-bin/cvsweb.cgi/soft/urpmi
Requires: eject webfetch perl-DateManip >= 5.40
-PreReq: perl-Locale-gettext rpmtools >= 4.3-6mdk perl-URPM >= 0.71-1mdk
+PreReq: perl-Locale-gettext rpmtools >= 4.3-6mdk perl-URPM >= 0.80
BuildRequires: bzip2-devel gettext rpm-devel >= 4.0.3
BuildRoot: %{_tmppath}/%{name}-buildroot
BuildArch: noarch
@@ -204,6 +204,16 @@ fi
%changelog
+* Fri Dec 6 2002 François Pons <fpons@mandrakesoft.com> 4.1-9mdk
+- improved urpmf from sh to perl, now a lot of options and
+ support of synthesis only media.
+- make medium name mandatory when adding a source with
+ --distrib-XXX using urpmi.addmedia.
+- fix parallel installation when one node is already up-to-date.
+- improved callback usage of urpm::configure to use newer
+ perl-URPM interface (much faster and smart with memory, but
+ unstable).
+
* Tue Dec 3 2002 François Pons <fpons@mandrakesoft.com> 4.1-8mdk
- added --excludepath option (fix bug 577).
- fixed missing options given to parallel plugins.