Commit d2b30a14 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Give clearer errors for bad input in the packages file; suggested by pejo

parent 22cbec8d
...@@ -157,6 +157,7 @@ sub darcsall { ...@@ -157,6 +157,7 @@ sub darcsall {
my $tag; my $tag;
my @repos; my @repos;
my $command = $_[0]; my $command = $_[0];
my $line;
my ($repo_base, $checked_out_tree) = getrepo(); my ($repo_base, $checked_out_tree) = getrepo();
...@@ -164,8 +165,10 @@ sub darcsall { ...@@ -164,8 +165,10 @@ sub darcsall {
@repos = <IN>; @repos = <IN>;
close IN; close IN;
$line = 0;
foreach (@repos) { foreach (@repos) {
chomp; chomp;
$line++;
if (/^([^# ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) { if (/^([^# ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) {
$localpath = $1; $localpath = $1;
$tag = $2; $tag = $2;
...@@ -198,7 +201,7 @@ sub darcsall { ...@@ -198,7 +201,7 @@ sub darcsall {
} }
} }
elsif (! /^(#.*)?$/) { elsif (! /^(#.*)?$/) {
die "Bad line: $_"; die "Bad content on line $line of packages file: $_";
} }
} }
} }
...@@ -210,6 +213,7 @@ sub darcsget { ...@@ -210,6 +213,7 @@ sub darcsget {
my $path; my $path;
my $tag; my $tag;
my @repos; my @repos;
my $line;
my ($repo_base, $checked_out_tree) = getrepo(); my ($repo_base, $checked_out_tree) = getrepo();
...@@ -225,8 +229,10 @@ sub darcsget { ...@@ -225,8 +229,10 @@ sub darcsget {
@repos = <IN>; @repos = <IN>;
close IN; close IN;
$line = 0;
foreach (@repos) { foreach (@repos) {
chomp; chomp;
$line++;
if (/^([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) { if (/^([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+) +([^ ]+)$/) {
$localpath = $1; $localpath = $1;
$tag = $2; $tag = $2;
...@@ -249,7 +255,7 @@ sub darcsget { ...@@ -249,7 +255,7 @@ sub darcsget {
} }
} }
elsif (! /^(#.*)?$/) { elsif (! /^(#.*)?$/) {
die "Bad line: $_"; die "Bad content on line $line of packages file: $_";
} }
} }
} }
......
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