summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-05-17 01:38:58 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-05-17 01:38:58 +0000
commit74d08af970f7b2362c8a6d15770bcdb8739db4f5 (patch)
treebfc80a9808ebfce21a0a7714afad042e82ce05b9
parent26bd7732604a6405fe47ee5c161f8acd5779ed3c (diff)
downloadurpmi-74d08af970f7b2362c8a6d15770bcdb8739db4f5.tar
urpmi-74d08af970f7b2362c8a6d15770bcdb8739db4f5.tar.gz
urpmi-74d08af970f7b2362c8a6d15770bcdb8739db4f5.tar.bz2
urpmi-74d08af970f7b2362c8a6d15770bcdb8739db4f5.tar.xz
urpmi-74d08af970f7b2362c8a6d15770bcdb8739db4f5.zip
Factorize and sort option names
-rw-r--r--urpm.pm42
-rw-r--r--urpm/ldap.pm24
2 files changed, 25 insertions, 41 deletions
diff --git a/urpm.pm b/urpm.pm
index 2571dc04..13f4e1b8 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -119,6 +119,24 @@ sub sync_webfetch {
%files and die N("unable to handle protocol: %s", join ', ', keys %files);
}
+our $PER_MEDIA_OPT = qw(
+ downloader
+ hdlist
+ ignore
+ key-ids
+ list
+ md5sum
+ noreconfigure
+ priority
+ removable
+ static
+ synthesis
+ update
+ verify-rpm
+ virtual
+ with_hdlist
+);
+
#- Loads /etc/urpmi/urpmi.cfg and performs basic checks.
#- Does not handle old format: <name> <url> [with <path_hdlist>]
#- options :
@@ -144,6 +162,8 @@ sub read_config {
keep
key-ids
limit-rate
+ nopubkey
+ norebuild
post-clean
pre-clean
priority-upgrade
@@ -152,10 +172,8 @@ sub read_config {
retry
split-length
split-level
- verify-rpm
- norebuild
strict-arch
- nopubkey
+ verify-rpm
)) {
if (defined $config->{''}{$opt} && !exists $urpm->{options}{$opt}) {
$urpm->{options}{$opt} = $config->{''}{$opt};
@@ -165,23 +183,7 @@ sub read_config {
#- per-media options
foreach my $m (grep { $_ ne '' } keys %$config) {
my $medium = { name => $m, clear_url => $config->{$m}{url} };
- foreach my $opt (qw(
- downloader
- hdlist
- ignore
- key-ids
- list
- md5sum
- noreconfigure
- static
- priority
- removable
- synthesis
- update
- verify-rpm
- virtual
- with_hdlist
- )) {
+ foreach my $opt (@PER_MEDIA_OPT) {
defined $config->{$m}{$opt} and $medium->{$opt} = $config->{$m}{$opt};
}
$urpm->probe_medium($medium, %options) and push @{$urpm->{media}}, $medium;
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index 4faa4653..7be15926 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -2,32 +2,14 @@ package urpm::ldap;
use strict;
use warnings;
+use urpm;
use urpm::msg 'N';
use Net::LDAP;
use MDK::Common;
-my $LDAP_CONFIG_FILE = '/etc/ldap.conf';
-# FIXME duplication
-my @per_media_opt = qw(
- downloader
- ftp-proxy
- hdlist
- http-proxy
- ignore
- key-ids
- list
- md5sum
- noreconfigure
- priority
- priority-upgrade
- removable
- synthesis
- update
- verify-rpm
- virtual
- with_hdlist
-);
+our $LDAP_CONFIG_FILE = '/etc/ldap.conf';
+my @per_media_opt = (@urpm::PER_MEDIA_OPT, qw(ftp-proxy http-proxy));
# TODO
# use srv dns record ?