Commit bfc517c0 authored by Dietmar Maurer's avatar Dietmar Maurer

APLInfo: split out code into read_aplinfo_from_fh

So that we can call the parser for any $fh. Add new type 'lxc'.
parent 2b2502c0
......@@ -48,15 +48,11 @@ sub logmsg {
}
}
sub read_aplinfo {
my ($filename, $list, $source, $update) = @_;
my $fh = IO::File->new("<$filename") ||
die "unable to open file '$filename' - $!\n";
sub read_aplinfo_from_fh {
my ($fh, $list, $source, $update) = @_;
local $/ = "";
eval {
while (my $rec = <$fh>) {
chomp $rec;
......@@ -81,7 +77,7 @@ sub read_aplinfo {
}
} elsif ($rec =~ s/^Type:\s*(.*\S)\s*\n//i) {
my $type = $1;
if ($type =~ m/^(openvz)$/) {
if ($type =~ m/^(openvz|lxc)$/) {
$res->{type} = $type;
} else {
my $msg = "unable to parse appliance record: unknown type '$type'\n";
......@@ -123,7 +119,15 @@ sub read_aplinfo {
$update ? die $msg : warn $msg;
}
}
};
}
sub read_aplinfo {
my ($filename, $list, $source, $update) = @_;
my $fh = IO::File->new("<$filename") ||
die "unable to open file '$filename' - $!\n";
eval { read_aplinfo_from_fh($fh, $list, $source, $update); };
my $err = $@;
close($fh);
......
......@@ -27,7 +27,7 @@ Package, Section, Version, Maintainer, Description
Additionally we define the following fields:
Type: openvz | qemu
Type: openvz | qemu | lxc
OS: Operating system type
Location: download url
Infopage: url to additional info
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment