| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! @PERL@ | | 1 | #! @PERL@ |
2 | # $NetBSD: pkglint.pl,v 1.757 2008/01/25 17:59:24 rillig Exp $ | | 2 | # $NetBSD: pkglint.pl,v 1.758 2008/01/28 00:53:21 rillig Exp $ |
3 | # | | 3 | # |
4 | | | 4 | |
5 | # pkglint - static analyzer and checker for pkgsrc packages | | 5 | # pkglint - static analyzer and checker for pkgsrc packages |
6 | # | | 6 | # |
7 | # Written by: | | 7 | # Written by: |
8 | # Roland Illig <rillig@NetBSD.org> | | 8 | # Roland Illig <rillig@NetBSD.org> |
9 | # | | 9 | # |
10 | # Based on work by: | | 10 | # Based on work by: |
11 | # Hubert Feyrer <hubertf@NetBSD.org> | | 11 | # Hubert Feyrer <hubertf@NetBSD.org> |
12 | # Thorsten Frueauf <frueauf@NetBSD.org> | | 12 | # Thorsten Frueauf <frueauf@NetBSD.org> |
13 | # Thomas Klausner <wiz@NetBSD.org> | | 13 | # Thomas Klausner <wiz@NetBSD.org> |
14 | # and others. | | 14 | # and others. |
15 | # | | 15 | # |
| @@ -1746,27 +1746,27 @@ my (@options) = ( | | | @@ -1746,27 +1746,27 @@ my (@options) = ( |
1746 | | | 1746 | |
1747 | # | | 1747 | # |
1748 | # Commonly used regular expressions. | | 1748 | # Commonly used regular expressions. |
1749 | # | | 1749 | # |
1750 | | | 1750 | |
1751 | use constant regex_dependency_gt => qr"^((?:\$\{[\w_]+\}|[\w_]|-[^\d])+)>=(.*)$"; | | 1751 | use constant regex_dependency_gt => qr"^((?:\$\{[\w_]+\}|[\w_]|-[^\d])+)>=(.*)$"; |
1752 | use constant regex_dependency_wildcard | | 1752 | use constant regex_dependency_wildcard |
1753 | => qr"^((?:\$\{[\w_]+\}|[\w_]|-[^\d\[])+)-(?:\[0-9\]|\d.*)$"; | | 1753 | => qr"^((?:\$\{[\w_]+\}|[\w_]|-[^\d\[])+)-(?:\[0-9\]|\d.*)$"; |
1754 | use constant regex_gnu_configure_volatile_vars | | 1754 | use constant regex_gnu_configure_volatile_vars |
1755 | => qr"^(?:.*_)?(?:CFLAGS||CPPFLAGS|CXXFLAGS|FFLAGS|LDFLAGS|LIBS)$"; | | 1755 | => qr"^(?:.*_)?(?:CFLAGS||CPPFLAGS|CXXFLAGS|FFLAGS|LDFLAGS|LIBS)$"; |
1756 | use constant regex_mk_comment => qr"^ *\s*#(.*)$"; | | 1756 | use constant regex_mk_comment => qr"^ *\s*#(.*)$"; |
1757 | use constant regex_mk_cond => qr"^\.(\s*)(if|ifdef|ifndef|else|elif|endif|for|endfor|undef)(?:\s+([^\s#][^#]*?))?\s*(?:#.*)?$"; | | 1757 | use constant regex_mk_cond => qr"^\.(\s*)(if|ifdef|ifndef|else|elif|endif|for|endfor|undef)(?:\s+([^\s#][^#]*?))?\s*(?:#.*)?$"; |
1758 | use constant regex_mk_dependency=> qr"^([^\s:]+(?:\s*[^\s:]+)*):\s*([^#]*?)(?:\s*#.*)?$"; | | 1758 | use constant regex_mk_dependency=> qr"^([^\s:]+(?:\s*[^\s:]+)*):\s*([^#]*?)(?:\s*#.*)?$"; |
1759 | use constant regex_mk_include => qr"^\.\s*s?include\s+\"([^\"]+)\"\s*(?:#.*)?$"; | | 1759 | use constant regex_mk_include => qr"^\.\s*(s?include)\s+\"([^\"]+)\"\s*(?:#.*)?$"; |
1760 | use constant regex_mk_sysinclude=> qr"^\.\s*s?include\s+<([^>]+)>\s*(?:#.*)?$"; | | 1760 | use constant regex_mk_sysinclude=> qr"^\.\s*s?include\s+<([^>]+)>\s*(?:#.*)?$"; |
1761 | use constant regex_mk_shellvaruse => qr"(?:^|[^\$])\$\$\{?(\w+)\}?"; # XXX: not perfect | | 1761 | use constant regex_mk_shellvaruse => qr"(?:^|[^\$])\$\$\{?(\w+)\}?"; # XXX: not perfect |
1762 | use constant regex_pkgname => qr"^((?:[\w.+]|-[^\d])+)-(\d(?:\w|\.\d)*)$"; | | 1762 | use constant regex_pkgname => qr"^((?:[\w.+]|-[^\d])+)-(\d(?:\w|\.\d)*)$"; |
1763 | use constant regex_mk_shellcmd => qr"^\t(.*)$"; | | 1763 | use constant regex_mk_shellcmd => qr"^\t(.*)$"; |
1764 | use constant regex_rcs_conflict => qr"^(<<<<<<<|=======|>>>>>>>)"; | | 1764 | use constant regex_rcs_conflict => qr"^(<<<<<<<|=======|>>>>>>>)"; |
1765 | use constant regex_unresolved => qr"\$\{"; | | 1765 | use constant regex_unresolved => qr"\$\{"; |
1766 | use constant regex_validchars => qr"[\011\040-\176]"; | | 1766 | use constant regex_validchars => qr"[\011\040-\176]"; |
1767 | # Note: the following regular expression looks more complicated than | | 1767 | # Note: the following regular expression looks more complicated than |
1768 | # necessary to avoid a stack overflow in the Perl interpreter. | | 1768 | # necessary to avoid a stack overflow in the Perl interpreter. |
1769 | # The leading white-space may only consist of \040 characters, otherwise | | 1769 | # The leading white-space may only consist of \040 characters, otherwise |
1770 | # the order of regex_varassign and regex_mk_shellcmd becomes important. | | 1770 | # the order of regex_varassign and regex_mk_shellcmd becomes important. |
1771 | use constant regex_varassign => qr"^ *([-*+A-Z_a-z0-9.\${}\[]+?)\s*(=|\?=|\+=|:=|!=)\s*((?:[^\\#\s]+|\s+?|(?:\\#)+|\\)*?)(?:\s*(#.*))?$"; | | 1771 | use constant regex_varassign => qr"^ *([-*+A-Z_a-z0-9.\${}\[]+?)\s*(=|\?=|\+=|:=|!=)\s*((?:[^\\#\s]+|\s+?|(?:\\#)+|\\)*?)(?:\s*(#.*))?$"; |
1772 | use constant regex_sh_varassign => qr"^([A-Z_a-z][0-9A-Z_a-z]*)="; | | 1772 | use constant regex_sh_varassign => qr"^([A-Z_a-z][0-9A-Z_a-z]*)="; |
| @@ -2317,27 +2317,27 @@ sub load_tool_names() { | | | @@ -2317,27 +2317,27 @@ sub load_tool_names() { |
2317 | # Get the list of files that define the tools from bsd.tools.mk. | | 2317 | # Get the list of files that define the tools from bsd.tools.mk. |
2318 | # | | 2318 | # |
2319 | | | 2319 | |
2320 | @tool_files = ("defaults.mk"); | | 2320 | @tool_files = ("defaults.mk"); |
2321 | { | | 2321 | { |
2322 | my $fname = "${cwd_pkgsrcdir}/mk/tools/bsd.tools.mk"; | | 2322 | my $fname = "${cwd_pkgsrcdir}/mk/tools/bsd.tools.mk"; |
2323 | my $lines = load_lines($fname, true); | | 2323 | my $lines = load_lines($fname, true); |
2324 | if (!$lines) { | | 2324 | if (!$lines) { |
2325 | log_fatal($fname, NO_LINE_NUMBER, "Cannot be read."); | | 2325 | log_fatal($fname, NO_LINE_NUMBER, "Cannot be read."); |
2326 | } | | 2326 | } |
2327 | | | 2327 | |
2328 | foreach my $line (@{$lines}) { | | 2328 | foreach my $line (@{$lines}) { |
2329 | if ($line->text =~ regex_mk_include) { | | 2329 | if ($line->text =~ regex_mk_include) { |
2330 | my ($includefile) = ($1); | | 2330 | my (undef, $includefile) = ($1, $2); |
2331 | if ($includefile =~ qr"^(?:\$\{PKGSRCDIR\}/mk/tools/)?([^/]+)$") { | | 2331 | if ($includefile =~ qr"^(?:\$\{PKGSRCDIR\}/mk/tools/)?([^/]+)$") { |
2332 | push(@tool_files, $1); | | 2332 | push(@tool_files, $1); |
2333 | } | | 2333 | } |
2334 | } | | 2334 | } |
2335 | } | | 2335 | } |
2336 | } | | 2336 | } |
2337 | assert(scalar(@tool_files) > 1, "Too few tool files. Maybe the files have been renamed again?"); | | 2337 | assert(scalar(@tool_files) > 1, "Too few tool files. Maybe the files have been renamed again?"); |
2338 | | | 2338 | |
2339 | # | | 2339 | # |
2340 | # Scan the tool files for the actual definitions of the tools. | | 2340 | # Scan the tool files for the actual definitions of the tools. |
2341 | # | | 2341 | # |
2342 | | | 2342 | |
2343 | $tools = {}; | | 2343 | $tools = {}; |
| @@ -3490,27 +3490,27 @@ sub parseline_mk($) { | | | @@ -3490,27 +3490,27 @@ sub parseline_mk($) { |
3490 | | | 3490 | |
3491 | $line->set("is_empty", true); | | 3491 | $line->set("is_empty", true); |
3492 | | | 3492 | |
3493 | } elsif ($text =~ regex_mk_cond) { | | 3493 | } elsif ($text =~ regex_mk_cond) { |
3494 | my ($indent, $directive, $args, $comment) = ($1, $2, $3, $4); | | 3494 | my ($indent, $directive, $args, $comment) = ($1, $2, $3, $4); |
3495 | | | 3495 | |
3496 | $line->set("is_cond", true); | | 3496 | $line->set("is_cond", true); |
3497 | $line->set("indent", $indent); | | 3497 | $line->set("indent", $indent); |
3498 | $line->set("directive", $directive); | | 3498 | $line->set("directive", $directive); |
3499 | defined($args) and $line->set("args", $args); | | 3499 | defined($args) and $line->set("args", $args); |
3500 | defined($comment) and $line->set("comment", $comment); | | 3500 | defined($comment) and $line->set("comment", $comment); |
3501 | | | 3501 | |
3502 | } elsif ($text =~ regex_mk_include) { | | 3502 | } elsif ($text =~ regex_mk_include) { |
3503 | my ($includefile, $comment) = ($1, $2); | | 3503 | my (undef, $includefile, $comment) = ($1, $2, $3); |
3504 | | | 3504 | |
3505 | $line->set("is_include", true); | | 3505 | $line->set("is_include", true); |
3506 | $line->set("includefile", $includefile); | | 3506 | $line->set("includefile", $includefile); |
3507 | defined($comment) and $line->set("comment", $comment); | | 3507 | defined($comment) and $line->set("comment", $comment); |
3508 | | | 3508 | |
3509 | } elsif ($text =~ regex_mk_sysinclude) { | | 3509 | } elsif ($text =~ regex_mk_sysinclude) { |
3510 | my ($includefile, $comment) = ($1, $2); | | 3510 | my ($includefile, $comment) = ($1, $2); |
3511 | | | 3511 | |
3512 | $line->set("is_sysinclude", true); | | 3512 | $line->set("is_sysinclude", true); |
3513 | $line->set("includefile", $includefile); | | 3513 | $line->set("includefile", $includefile); |
3514 | defined($comment) and $line->set("comment", $comment); | | 3514 | defined($comment) and $line->set("comment", $comment); |
3515 | | | 3515 | |
3516 | } elsif ($text =~ regex_mk_dependency) { | | 3516 | } elsif ($text =~ regex_mk_dependency) { |
| @@ -3924,53 +3924,53 @@ sub checkline_other_absolute_pathname($$ | | | @@ -3924,53 +3924,53 @@ sub checkline_other_absolute_pathname($$ |
3924 | } elsif ($before =~ qr"\w$") { | | 3924 | } elsif ($before =~ qr"\w$") { |
3925 | # Something like $dir/lib | | 3925 | # Something like $dir/lib |
3926 | | | 3926 | |
3927 | } elsif ($before =~ qr"\.$") { | | 3927 | } elsif ($before =~ qr"\.$") { |
3928 | # ../foo is not an absolute pathname. | | 3928 | # ../foo is not an absolute pathname. |
3929 | | | 3929 | |
3930 | } else { | | 3930 | } else { |
3931 | $opt_debug_misc and $line->log_debug("before=${before}"); | | 3931 | $opt_debug_misc and $line->log_debug("before=${before}"); |
3932 | checkword_absolute_pathname($line, $path); | | 3932 | checkword_absolute_pathname($line, $path); |
3933 | } | | 3933 | } |
3934 | } | | 3934 | } |
3935 | } | | 3935 | } |
3936 | | | 3936 | |
3937 | sub checkline_relative_path($$) { | | 3937 | sub checkline_relative_path($$$) { |
3938 | my ($line, $path) = @_; | | 3938 | my ($line, $path, $must_exist) = @_; |
3939 | my ($res_path); | | 3939 | my ($res_path); |
3940 | | | 3940 | |
3941 | if (!$is_wip && $path =~ qr"/wip/") { | | 3941 | if (!$is_wip && $path =~ qr"/wip/") { |
3942 | $line->log_error("A pkgsrc package must not depend on any outside package."); | | 3942 | $line->log_error("A pkgsrc package must not depend on any outside package."); |
3943 | } | | 3943 | } |
3944 | $res_path = resolve_relative_path($path, true); | | 3944 | $res_path = resolve_relative_path($path, true); |
3945 | if ($res_path =~ regex_unresolved) { | | 3945 | if ($res_path =~ regex_unresolved) { |
3946 | $opt_debug_unchecked and $line->log_debug("Unchecked path: \"${path}\"."); | | 3946 | $opt_debug_unchecked and $line->log_debug("Unchecked path: \"${path}\"."); |
3947 | } elsif (!-e ((($res_path =~ qr"^/") ? "" : "${current_dir}/") . $res_path)) { | | 3947 | } elsif (!-e ((($res_path =~ qr"^/") ? "" : "${current_dir}/") . $res_path)) { |
3948 | $line->log_error("\"${res_path}\" does not exist."); | | 3948 | $must_exist and $line->log_error("\"${res_path}\" does not exist."); |
3949 | } elsif ($path =~ qr"^\.\./\.\./([^/]+)/([^/]+)(.*)") { | | 3949 | } elsif ($path =~ qr"^\.\./\.\./([^/]+)/([^/]+)(.*)") { |
3950 | my ($cat, $pkg, $rest) = ($1, $2, $3); | | 3950 | my ($cat, $pkg, $rest) = ($1, $2, $3); |
3951 | } elsif ($path =~ qr"^\.\./\.\./mk/") { | | 3951 | } elsif ($path =~ qr"^\.\./\.\./mk/") { |
3952 | # There need not be two directory levels for mk/ files. | | 3952 | # There need not be two directory levels for mk/ files. |
3953 | } elsif ($path =~ qr"^\.\./mk/" && $cur_pkgsrcdir eq "..") { | | 3953 | } elsif ($path =~ qr"^\.\./mk/" && $cur_pkgsrcdir eq "..") { |
3954 | # That's fine for category Makefiles. | | 3954 | # That's fine for category Makefiles. |
3955 | } elsif ($path =~ qr"^\.\.") { | | 3955 | } elsif ($path =~ qr"^\.\.") { |
3956 | $line->log_warning("Invalid relative path \"${path}\"."); | | 3956 | $line->log_warning("Invalid relative path \"${path}\"."); |
3957 | } | | 3957 | } |
3958 | } | | 3958 | } |
3959 | | | 3959 | |
3960 | sub checkline_relative_pkgdir($$) { | | 3960 | sub checkline_relative_pkgdir($$) { |
3961 | my ($line, $path) = @_; | | 3961 | my ($line, $path) = @_; |
3962 | | | 3962 | |
3963 | checkline_relative_path($line, $path); | | 3963 | checkline_relative_path($line, $path, true); |
3964 | $path = resolve_relative_path($path, false); | | 3964 | $path = resolve_relative_path($path, false); |
3965 | | | 3965 | |
3966 | if ($path !~ qr"^(?:\./)?\.\./\.\./[^/]+/[^/]+$") { | | 3966 | if ($path !~ qr"^(?:\./)?\.\./\.\./[^/]+/[^/]+$") { |
3967 | $line->log_warning("\"${path}\" is not a valid relative package directory."); | | 3967 | $line->log_warning("\"${path}\" is not a valid relative package directory."); |
3968 | $line->explain_warning( | | 3968 | $line->explain_warning( |
3969 | "A relative pathname always starts with \"../../\", followed", | | 3969 | "A relative pathname always starts with \"../../\", followed", |
3970 | "by a category, a slash and a the directory name of the package.", | | 3970 | "by a category, a slash and a the directory name of the package.", |
3971 | "For example, \"../../misc/screen\" is a valid relative pathname."); | | 3971 | "For example, \"../../misc/screen\" is a valid relative pathname."); |
3972 | } | | 3972 | } |
3973 | } | | 3973 | } |
3974 | | | 3974 | |
3975 | sub checkline_spellcheck($) { | | 3975 | sub checkline_spellcheck($) { |
3976 | my ($line) = @_; | | 3976 | my ($line) = @_; |
| @@ -5418,27 +5418,27 @@ sub checkline_mk_vartype_basic($$$$$$$$) | | | @@ -5418,27 +5418,27 @@ sub checkline_mk_vartype_basic($$$$$$$$) |
5418 | } | | 5418 | } |
5419 | | | 5419 | |
5420 | } elsif ($type eq "PrefixPathname") { | | 5420 | } elsif ($type eq "PrefixPathname") { |
5421 | if ($value =~ qr"^man/(.*)") { | | 5421 | if ($value =~ qr"^man/(.*)") { |
5422 | my ($mansubdir) = ($1); | | 5422 | my ($mansubdir) = ($1); |
5423 | | | 5423 | |
5424 | $line->log_warning("Please use \"\${PKGMANDIR}/${mansubdir}\" instead of \"${value}\"."); | | 5424 | $line->log_warning("Please use \"\${PKGMANDIR}/${mansubdir}\" instead of \"${value}\"."); |
5425 | } | | 5425 | } |
5426 | | | 5426 | |
5427 | } elsif ($type eq "RelativePkgDir") { | | 5427 | } elsif ($type eq "RelativePkgDir") { |
5428 | checkline_relative_pkgdir($line, $value); | | 5428 | checkline_relative_pkgdir($line, $value); |
5429 | | | 5429 | |
5430 | } elsif ($type eq "RelativePkgPath") { | | 5430 | } elsif ($type eq "RelativePkgPath") { |
5431 | checkline_relative_path($line, $value); | | 5431 | checkline_relative_path($line, $value, true); |
5432 | | | 5432 | |
5433 | } elsif ($type eq "Restricted") { | | 5433 | } elsif ($type eq "Restricted") { |
5434 | if ($value ne "\${RESTRICTED}") { | | 5434 | if ($value ne "\${RESTRICTED}") { |
5435 | $line->log_warning("The only valid value for ${varname} is \${RESTRICTED}."); | | 5435 | $line->log_warning("The only valid value for ${varname} is \${RESTRICTED}."); |
5436 | $line->explain_warning( | | 5436 | $line->explain_warning( |
5437 | | | 5437 | |
5438 | "These variables are used to control which files may be mirrored on FTP", | | 5438 | "These variables are used to control which files may be mirrored on FTP", |
5439 | "servers or CD-ROM collections. They are not intended to mark packages", | | 5439 | "servers or CD-ROM collections. They are not intended to mark packages", |
5440 | "whose only MASTER_SITES are on ftp.NetBSD.org."); | | 5440 | "whose only MASTER_SITES are on ftp.NetBSD.org."); |
5441 | } | | 5441 | } |
5442 | | | 5442 | |
5443 | } elsif ($type eq "SVR4PkgName") { | | 5443 | } elsif ($type eq "SVR4PkgName") { |
5444 | if ($value =~ regex_unresolved) { | | 5444 | if ($value =~ regex_unresolved) { |
| @@ -6230,30 +6230,30 @@ sub checklines_mk($) { | | | @@ -6230,30 +6230,30 @@ sub checklines_mk($) { |
6230 | if ($aligned_len % 8 == 0) { | | 6230 | if ($aligned_len % 8 == 0) { |
6231 | my $tabalign = ("\t" x (($aligned_len - tablen($prefix) + 7) / 8)); | | 6231 | my $tabalign = ("\t" x (($aligned_len - tablen($prefix) + 7) / 8)); |
6232 | $line->replace("${prefix}${align}", "${prefix}${tabalign}"); | | 6232 | $line->replace("${prefix}${align}", "${prefix}${tabalign}"); |
6233 | } | | 6233 | } |
6234 | } | | 6234 | } |
6235 | checkline_mk_varassign($line, $varname, $op, $value, $comment); | | 6235 | checkline_mk_varassign($line, $varname, $op, $value, $comment); |
6236 | $substcontext->check_varassign($line, $varname, $op, $value); | | 6236 | $substcontext->check_varassign($line, $varname, $op, $value); |
6237 | | | 6237 | |
6238 | } elsif ($text =~ regex_mk_shellcmd) { | | 6238 | } elsif ($text =~ regex_mk_shellcmd) { |
6239 | my ($shellcmd) = ($1); | | 6239 | my ($shellcmd) = ($1); |
6240 | checkline_mk_shellcmd($line, $shellcmd); | | 6240 | checkline_mk_shellcmd($line, $shellcmd); |
6241 | | | 6241 | |
6242 | } elsif ($text =~ regex_mk_include) { | | 6242 | } elsif ($text =~ regex_mk_include) { |
6243 | my ($includefile) = ($1); | | 6243 | my ($include, $includefile) = ($1, $2); |
6244 | | | 6244 | |
6245 | $opt_debug_include and $line->log_debug("includefile=${includefile}"); | | 6245 | $opt_debug_include and $line->log_debug("includefile=${includefile}"); |
6246 | checkline_relative_path($line, $includefile); | | 6246 | checkline_relative_path($line, $includefile, $include eq "include"); |
6247 | | | 6247 | |
6248 | if ($includefile =~ qr"../Makefile$") { | | 6248 | if ($includefile =~ qr"../Makefile$") { |
6249 | $line->log_error("Other Makefiles must not be included directly."); | | 6249 | $line->log_error("Other Makefiles must not be included directly."); |
6250 | $line->explain_warning( | | 6250 | $line->explain_warning( |
6251 | "If you want to include portions of another Makefile, extract", | | 6251 | "If you want to include portions of another Makefile, extract", |
6252 | "the common parts and put them into a Makefile.common. After", | | 6252 | "the common parts and put them into a Makefile.common. After", |
6253 | "that, both this one and the other package should include the", | | 6253 | "that, both this one and the other package should include the", |
6254 | "Makefile.common."); | | 6254 | "Makefile.common."); |
6255 | } | | 6255 | } |
6256 | | | 6256 | |
6257 | if ($includefile eq "../../mk/bsd.prefs.mk") { | | 6257 | if ($includefile eq "../../mk/bsd.prefs.mk") { |
6258 | if ($line->fname =~ qr"buildlink3\.mk$") { | | 6258 | if ($line->fname =~ qr"buildlink3\.mk$") { |
6259 | $line->log_note("For efficiency reasons, please include bsd.fast.prefs.mk instead of bsd.prefs.mk."); | | 6259 | $line->log_note("For efficiency reasons, please include bsd.fast.prefs.mk instead of bsd.prefs.mk."); |
| @@ -6456,27 +6456,27 @@ sub checklines_buildlink3_inclusion($) { | | | @@ -6456,27 +6456,27 @@ sub checklines_buildlink3_inclusion($) { |
6456 | my ($included_files); | | 6456 | my ($included_files); |
6457 | | | 6457 | |
6458 | assert(@{$lines} != 0, "The lines array must be non-empty."); | | 6458 | assert(@{$lines} != 0, "The lines array must be non-empty."); |
6459 | $opt_debug_trace and log_debug($lines->[0]->fname, NO_LINES, "checklines_buildlink3_inclusion()"); | | 6459 | $opt_debug_trace and log_debug($lines->[0]->fname, NO_LINES, "checklines_buildlink3_inclusion()"); |
6460 | | | 6460 | |
6461 | if (!defined($pkgctx_bl3)) { | | 6461 | if (!defined($pkgctx_bl3)) { |
6462 | return; | | 6462 | return; |
6463 | } | | 6463 | } |
6464 | | | 6464 | |
6465 | # Collect all the included buildlink3.mk files from the file. | | 6465 | # Collect all the included buildlink3.mk files from the file. |
6466 | $included_files = {}; | | 6466 | $included_files = {}; |
6467 | foreach my $line (@{$lines}) { | | 6467 | foreach my $line (@{$lines}) { |
6468 | if ($line->text =~ regex_mk_include) { | | 6468 | if ($line->text =~ regex_mk_include) { |
6469 | my ($file, $comment) = ($1, $2); | | 6469 | my (undef, $file, $comment) = ($1, $2, $3); |
6470 | | | 6470 | |
6471 | if ($file =~ qr"^\.\./\.\./(.*)/buildlink3\.mk") { | | 6471 | if ($file =~ qr"^\.\./\.\./(.*)/buildlink3\.mk") { |
6472 | my ($bl3) = ($1); | | 6472 | my ($bl3) = ($1); |
6473 | | | 6473 | |
6474 | $included_files->{$bl3} = $line; | | 6474 | $included_files->{$bl3} = $line; |
6475 | if (!exists($pkgctx_bl3->{$bl3})) { | | 6475 | if (!exists($pkgctx_bl3->{$bl3})) { |
6476 | $line->log_warning("${bl3}/buildlink3.mk is included by this file but not by the package."); | | 6476 | $line->log_warning("${bl3}/buildlink3.mk is included by this file but not by the package."); |
6477 | } | | 6477 | } |
6478 | } | | 6478 | } |
6479 | } | | 6479 | } |
6480 | } | | 6480 | } |
6481 | | | 6481 | |
6482 | # Print debugging messages for all buildlink3.mk files that are | | 6482 | # Print debugging messages for all buildlink3.mk files that are |