When adding a contentless dependency, the pagespec also needs to be one
that does not look at any page content information.
As a first approximation of that, only allow glob-based pagespecs in
contentless dependencies. While there are probably a few other types of
pagespecs that can match contentless, this will work for most of them.
my $deptype=$DEPEND_CONTENT | $DEPEND_EXISTS;
if (@_) {
my %params=@_;
- if (defined $params{content} && $params{content} == 0) {
+ if (defined $params{content} && $params{content} == 0 &&
+ pagespec_contentless($pagespec)) {
$deptype=$deptype & ~$DEPEND_CONTENT;
}
}
return ! $@;
}
+sub pagespec_contentless ($) {
+ my $spec=shift;
+
+ while ($spec=~m{
+ (\w+)\([^\)]*\) # only match pagespec functions
+ }igx) {
+ # only glob and internal can be matched contentless
+ # (first approximation)
+ return 0 if $1 ne "glob" && $1 ne "internal";
+ }
+
+ return 1;
+}
+
sub glob2re ($) {
my $re=quotemeta(shift);
$re=~s/\\\*/.*/g;