in parse_dependency_file() make sure, we really read port specs and

not some gibberish like error messages or so
This commit is contained in:
sturm 2004-12-26 07:48:46 +00:00
parent 38c6838f15
commit 6e890a965a

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# $OpenBSD: dpb,v 1.9 2004/11/14 11:46:15 sturm Exp $
# $OpenBSD: dpb,v 1.10 2004/12/26 07:48:46 sturm Exp $
# Copyright (c) 2004 Nikolay Sturm <sturm@openbsd.org>.
#
# Redistribution and use in source and binary forms, with or without
@ -413,6 +413,22 @@ sub parse_dependency_file()
chomp;
my ($a, $b) = split /\s+/;
# ensure $a and $b are really port specs and not gibberish
# category/{subcategory/}*port{\,flavor}*{\,-subpackage}
my $borked = 0;
foreach my $p ($a, $b) {
if (not defined $p or $p eq "") {
warn "*** empty port spec in deplist\n";
$borked = 1;
last;
}
if (not $p =~ /(\w*\/)+[-.\w]+(,\w+)*(,-[\w]+)*/) {
warn "*** broken deplist entry: $p\n";
$borked = 1;
}
}
next if $borked == 1;
# ensure every port depends on itself, needed by build logic
# ports depending on the key
$depend_on{$a} = [$a] unless defined $depend_on{$a};