summaryrefslogtreecommitdiffstats
path: root/urpm/ldap.pm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-03 14:47:09 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-03 14:47:09 +0000
commit2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8 (patch)
tree49a7374c297c3e67b29efb6121b714f3c6f69086 /urpm/ldap.pm
parentb3882cb0b3bb23a164995070212d3bcb8888fe8b (diff)
downloadurpmi-2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8.tar
urpmi-2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8.tar.gz
urpmi-2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8.tar.bz2
urpmi-2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8.tar.xz
urpmi-2e6d60e619c016a2d7cf3a0bfe9c0b82e290f8c8.zip
Remove more MDK::Common vestigia
Diffstat (limited to 'urpm/ldap.pm')
-rw-r--r--urpm/ldap.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/urpm/ldap.pm b/urpm/ldap.pm
index 79710654..510107ea 100644
--- a/urpm/ldap.pm
+++ b/urpm/ldap.pm
@@ -78,11 +78,25 @@ sub check_ldap_medium($) {
return $medium->{name} && $medium->{clear_url};
}
+sub get_vars_from_sh {
+ my $filename = $_[0];
+ my %l;
+ open my $fh, $filename or return ();
+ local $_;
+ while (<$fh>) {
+ s/#.*//; s/^\s*//; s/\s*$//
+ my ($key, $val) = /^(\w+)=(.*)/ or next;
+ $val =~ s/^(["'])(.*)\1$/$2/;
+ $l{$key} = $val;
+ }
+ %l;
+}
+
sub read_ldap_cache($%) {
my ($urpm, %options) = @_;
foreach (glob("$urpm->{cachedir}/ldap/*")) {
! -f $_ and next;
- my %medium = getVarsFromSh($_);
+ my %medium = get_vars_from_sh($_);
next if !check_ldap_medium(\%medium);
$urpm->probe_medium(\%medium, %options) and push @{$urpm->{media}}, \%medium;
}