summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorJan Blunck <jblunck@infradead.org>2014-07-10 15:41:07 +0200
committerJan Blunck <jblunck@infradead.org>2014-07-10 15:47:43 +0200
commit33b112e0023876cfee8582d8904987a32d1cbe40 (patch)
tree1e747c21ec351ad8c5b3f7424d0eb82be54b296f /Build
parente22572e719863d26c52725f954a5a3a5ae4cbf58 (diff)
livebuild: Error out if archives are configured
We do not support additional repositories defined in the live-build configuration so we return an error here. Signed-off-by: Jan Blunck <jblunck@infradead.org>
Diffstat (limited to 'Build')
-rw-r--r--Build/LiveBuild.pm30
1 files changed, 13 insertions, 17 deletions
diff --git a/Build/LiveBuild.pm b/Build/LiveBuild.pm
index 2089385..e6bda10 100644
--- a/Build/LiveBuild.pm
+++ b/Build/LiveBuild.pm
@@ -64,39 +64,35 @@ sub unify {
sub parse {
my ($config, $filename, @args) = @_;
-
- # TODO: check that filename exists
+ my $ret = {};
# check that filename is a tar
my $tar = Archive::Tar->new;
- $tar->read($filename) || die "Read failed: $filename\n";
+ unless($tar->read($filename)) {
+ warn("$filename: " . $tar->error . "\n");
+ $ret->{'error'} = "$filename: " . $tar->error;
+ return $ret;
+ }
# check that directory layout matches live-build directory structure
+ for my $file ($tar->list_files('')) {
+ next unless $file =~ /^config\/archives\/.*\.list.*/;
+ warn("$filename: config/archives/*.list* files not allowed!\n");
+ $ret->{'error'} = "$filename: config/archives/*.list* files not allowed!";
+ return $ret;
+ }
# always require the list of packages required by live-boot for
# bootstrapping the target distribution image (e.g. with debootstrap)
- push @packages, ( 'live-build-desc' );
+ my @packages = ( 'live-build-desc' );
for my $file ($tar->list_files('')) {
next unless $file =~ /^config\/package-lists\/.*\.list.*/;
push @packages, parse_package_list($tar->get_content($file));
}
- my @repos;
- for my $file ($tar->list_files('')) {
- next unless $file =~ /^config\/archives\/.*\.list.*/;
- push @repos, parse_archive($tar->get_content($file));
- }
-
- my $ret = {};
($ret->{'name'} = $filename) =~ s/\.[^.]+$//;
$ret->{'deps'} = [ unify(@packages) ];
- $ret->{'path'} = [ unify(@repos) ];
- for (@{$ret->{'path'}}) {
- my @s = split('/', $_, 2);
- $_ = { 'project' => $s[0], 'repository' => $s[1] };
- }
-
return $ret;
}