summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Saratxaga <pablo@mandriva.com>2007-02-21 11:12:47 +0000
committerPablo Saratxaga <pablo@mandriva.com>2007-02-21 11:12:47 +0000
commit1da4d3d0f59f23c26e24c5e282c7cb869675a6fe (patch)
tree1e649605d64152836106e23fdf0ba888b936cfa5
parent5593db89b498f57ecef817e5eeb66e002a7d6aba (diff)
downloadurpmi-1da4d3d0f59f23c26e24c5e282c7cb869675a6fe.tar
urpmi-1da4d3d0f59f23c26e24c5e282c7cb869675a6fe.tar.gz
urpmi-1da4d3d0f59f23c26e24c5e282c7cb869675a6fe.tar.bz2
urpmi-1da4d3d0f59f23c26e24c5e282c7cb869675a6fe.tar.xz
urpmi-1da4d3d0f59f23c26e24c5e282c7cb869675a6fe.zip
fixed some ngettext use
-rwxr-xr-xgurpmi210
-rw-r--r--urpm/ldap.pm7
-rwxr-xr-xurpmi60
3 files changed, 45 insertions, 32 deletions
diff --git a/gurpmi2 b/gurpmi2
index 4bb0d4da..6ca2cf31 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -211,10 +211,12 @@ sub do_install_2 () {
}
$urpm->{nb_install} = @to_install;
@to_install > 1 && !$gurpmi::options{auto}
- ? ask_continue(P("To satisfy dependencies, the following package is going to be installed:",
- "To satisfy dependencies, the following packages are going to be installed:",
- scalar(@to_install),
- ) . join("\n", '', @to_install, '') . N("(%d packages, %d MB)", scalar(@to_install), toMb($sum)),
+ ? ask_continue(
+ ( (scalar(@to_install) == 1) ?
+ N("To satisfy dependencies, the following package is going to be installed:")
+ : N("To satisfy dependencies, the following packages are going to be installed:") )
+ . join("\n", '', @to_install, '')
+ . P("(%d package, %d MB)", "(%d packages, %d MB)", scalar(@to_install), toMb($sum)),
, \&do_install_3)
: goto \&do_install_3;
}
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index 66fcc8db..5489948a 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -144,6 +144,7 @@ my %ldap_changed_attributes = (
'with-hdlist' => 'with_hdlist',
'http-proxy' => 'http_proxy',
'ftp-proxy' => 'ftp_proxy',
+ 'media-info-dir' => 'media_info_dir',
);
sub load_ldap_media {
@@ -166,13 +167,12 @@ sub load_ldap_media {
$config->{host} . ($config->{port} ? ":" . $config->{port} : "") . "/";
}
- my $priority = 100; #- too add ldap media at the end
eval {
my $ldap = Net::LDAP->new($config->{uri})
- or die N("Cannot connect to ldap uri :"), $config->{uri};
+ or die N("Cannot connect to ldap uri:"), $config->{uri};
$ldap->bind($config->{binddn}, $config->{password})
- or die N("Cannot connect to ldap uri :"), $config->{uri};
+ or die N("Cannot connect to ldap uri:"), $config->{uri};
#- base is mandatory
my $result = $ldap->search(
base => $config->{base},
@@ -203,7 +203,6 @@ sub load_ldap_media {
#- TODO check if name already defined ?
$medium->{name} = "ldap_" . $medium->{name};
$medium->{ldap} = 1;
- $medium->{priority} = $priority++;
next if !check_ldap_medium($medium);
urpm::media::add_existing_medium($urpm, $medium);
write_ldap_cache($urpm,$medium);
diff --git a/urpmi b/urpmi
index d118044d..a883b858 100755
--- a/urpmi
+++ b/urpmi
@@ -287,6 +287,7 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
unless ($pid_out = open STDOUT, "|-") {
select $SAVEOUT; $| = 1;
$/ = \1;
+ binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
while (my $s = <STDIN>) {
open my $fh, ">>$logfile";
print $SAVEOUT $s;
@@ -297,6 +298,7 @@ if ($logfile && !$INC{"Devel/Trace.pm"}) {
unless ($pid_err = open STDERR, "|-") {
select $SAVEERR; $| = 1;
$/ = \1;
+ binmode STDIN, ':raw'; #- since we read character by character, perl must not try to recognise utf8 strings since it really can't
while (my $s = <STDIN>) {
open my $fh, ">>$logfile";
print $SAVEERR $s;
@@ -475,10 +477,11 @@ my $restart_itself = urpm::select::resolve_dependencies($urpm,
my @unselected_uninstalled = @{$state->{unselected_uninstalled} || []};
if (@unselected_uninstalled) {
my $list = join "\n", map { $_->name . '-' . $_->version . '-' . $_->release } @unselected_uninstalled;
- my $msg = P("The following package cannot be installed because it depends on packages
-that are older than the installed ones:\n%s",
- "The following packages can't be installed because they depend on packages
-that are older than the installed ones:\n%s", $#unselected_uninstalled, $list);
+ my $msg = ($#unselected_uninstalled == 1) ?
+ N("The following package cannot be installed because it depends on packages
+that are older than the installed ones:\n%s",$list)
+ : N("The following packages can't be installed because they depend on packages
+that are older than the installed ones:\n%s", $list);
if ($urpm->{options}{auto}) {
print "$msg\n";
} else {
@@ -496,8 +499,9 @@ that are older than the installed ones:\n%s", $#unselected_uninstalled, $list);
my @ask_unselect = urpm::select::unselected_packages($urpm, $state);
if (@ask_unselect) {
my $list = urpm::select::translate_why_unselected($urpm, $state, @ask_unselect);
- my $msg = P("A requested package cannot be installed:\n%s",
- "Some requested packages cannot be installed:\n%s", $#ask_unselect, $list);
+ my $msg = ($#ask_unselect == 1) ?
+ N("A requested package cannot be installed:\n%s",$list)
+ : N("Some requested packages cannot be installed:\n%s", $list);
if ($urpm->{options}{auto}) {
print "$msg\n";
} else {
@@ -527,15 +531,18 @@ if (@ask_remove) {
my $list = urpm::select::translate_why_removed($urpm, $state, @ask_remove);
if ($no_remove && !$force) {
- print P("The installation cannot continue because the following package
-has to be removed for others to be upgraded:\n%s\n",
- "The installation cannot continue because the following packages
-have to be removed for others to be upgraded:\n%s\n", $#ask_remove, $list), "\n";
+ my $msg = ($#ask_remove == 1) ?
+ N("The installation cannot continue because the following package
+has to be removed for others to be upgraded:\n%s\n", $list)
+ : N("The installation cannot continue because the following packages
+have to be removed for others to be upgraded:\n%s\n", $list);
+ print $msg . "\n";
exit 0;
}
- my $msg = P("The following package has to be removed for others to be upgraded:\n%s",
- "The following packages have to be removed for others to be upgraded:\n%s", $#ask_remove, $list);
+ my $msg = ($#ask_remove == 1) ?
+ N("The following package has to be removed for others to be upgraded:\n%s", $list)
+ : N("The following packages have to be removed for others to be upgraded:\n%s", $list);
if ($test) {
$msg = "$msg\n" . N("(test only, removal will not be actually done)");
}
@@ -571,9 +578,9 @@ foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$sta
}
$urpm->{nb_install} = @to_install;
if ($env) {
- my $msg = P("To satisfy dependencies, the following package is going to be installed:",
- "To satisfy dependencies, the following packages are going to be installed:", $#to_install);
- my $msg2 = N("(%d packages, %d MB)", $urpm->{nb_install}, toMb($sum));
+ my $msg = ($#to_install == 1) ? N("To satisfy dependencies, the following package is going to be installed:")
+ : N("To satisfy dependencies, the following packages are going to be installed:");
+ my $msg2 = P("(%d package, %d MB)", "(%d packages, %d MB)", $urpm->{nb_install}, toMb($sum));
my $p = join "\n", @to_install;
print "$msg\n$p\n$msg2\n";
exit 0; #- exit now for specific environment.
@@ -582,12 +589,14 @@ if (@root_only) {
print N("You need to be root to install the following dependencies:\n%s\n", join ' ', @root_only);
exit 1;
} elsif (!$urpm->{options}{auto} && $ask_user && @to_install) {
- my $msg = P("To satisfy dependencies, the following package is going to be installed:",
- "To satisfy dependencies, the following packages are going to be installed:", $#to_install);
+ my $msg = ($#to_install == 1) ? N("To satisfy dependencies, the following package is going to be installed:")
+ : N("To satisfy dependencies, the following packages are going to be installed:");
if ($test) {
$msg = "$msg\n" . N("(test only, installation will not be actually done)");
}
- my $msg2 = P("Proceed with the installation of 1 package? (%2\$d MB)",
+ my $msg2 = ($urpm->{nb_install} == 1) ?
+ N("Proceed with the installation of 1 package? (%2\$d MB)",toMb($sum))
+ : P("Proceed with the installation of the %d package? (%d MB)",
"Proceed with the installation of the %d packages? (%d MB)", $urpm->{nb_install}, $urpm->{nb_install}, toMb($sum));
my $p = join "\n", @to_install;
my $noexpr = N("Nn");
@@ -659,8 +668,9 @@ foreach my $set (@{$state->{transaction} || []}) {
my @bad_signatures = urpm::signature::check($urpm, \%transaction_sources_install, \%transaction_sources);
if (@bad_signatures) {
- my $msg = P("The following package has bad signature",
- "The following packages have bad signatures", $#bad_signatures);
+ my $msg = ($#bad_signatures == 1) ?
+ N("The following package has bad signature")
+ : N("The following packages have bad signatures");
my $msg2 = N("Do you want to continue installation ?");
my $p = join "\n", @bad_signatures;
#- rurpmi always abort here
@@ -833,11 +843,13 @@ if ($nok) {
my @installed = map { scalar $_->fullname } @$installed;
my @error = map { scalar $_->fullname } @$error;
my @msg1 = @installed == 0 ? () :
- P("Package %s is already installed",
- "Packages %s are already installed", @installed > 1, join(', ', @installed));
+ (@installed == 1) ?
+ N("Package %s is already installed",join(', ', @installed))
+ : N("Packages %s are already installed", join(', ', @installed));
my @msg2 = @error == 0 ? () :
- P("Package %s can not be installed",
- "Packages %s can not be installed", @errors > 1, join(', ', @error));
+ (@errors == 1) ?
+ N("Package %s can not be installed", join(', ', @error))
+ : N("Packages %s can not be installed", join(', ', @error));
print join("\n", @msg1, @msg2, '');
}
}