blob: 354adca3492d1ce3f8acbf3df8242b1a842ecb9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
package Build::Zypp;
use strict;
our $root = '';
sub parsecfg($)
{
my $file = shift;
my $repocfg = "$root/etc/zypp/repos.d/$file.repo";
local *REPO;
open(REPO, '<', $repocfg) or return undef;
my $name;
my $repo = {};
while (<REPO>) {
chomp;
if (/^\[(.+)\]/) {
$name = $1;
} else {
my ($key, $value) = split(/=/,$_,2);
$repo->{$key} = $value if defined $key;
}
}
close(REPO);
return undef unless $name;
$repo->{'description'} = $repo->{'name'} if exists $repo->{'name'};
$repo->{'name'} = $name;
return $repo;
}
1;
# vim: sw=2
|