#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
#
# build-watch.pl - a simple utility to watch a process and it's children under
# dtrace and process the results for dependency information.
#
# Ex:
# $ cd $(WS_TOP)/components/{component}
# $ $(WS_TOP)/tools/build-watch.pl -c "gmake install"
#
my $verbose = 0;
my @ignore = (
'^[^/\.].*', # ignore paths that don't begin with / or .
'^/dev/', # ignore devices
'^/etc/', # ignore config files
'^/proc/', # ignore /proc
'^/tmp/', # ignore temp files
'/SUNWspro/', # ignore compiler bits
'/sunstudio12.1/', # ignore more compiler bits
'^/ws/', # nothing in /ws can be interesting
'^\.[/\.]{0,1}$' # ignore ., .., and ./
);
sub match
{
local($string, @expressions) = @_;
foreach (@expressions) {
($string =~ m{$_}) && return (1);
}
return (0);
}
{
local ($filename) = @_;
while (<$fh>) {
if (/^TOOL:\s+(\S+) = (\S+)$/) {
(-e $1)) {
}
}
close($fh);
}
{
# create a set of search strings to query the package DB
defined($search_string) && \
push(@search_strings, $search_string);
$search_string = $_;
} else {
$search_string .= " OR $_";
}
}
push(@search_strings, $search_string);
# walk through the search strings and query the package DB
foreach (@search_strings) {
my $IFH;
open($IFH, "pkg search -l -H -o path,pkg.name '$_'|");
while (<$IFH>) {
}
close($IFH);
}
return (\%pkgs);
}
#
# Main execution begins here
#
if (defined($cmd)) {
if (!defined($ENV{'WS_TOP'})) {
print("WS_TOP must be set in the calling environment\n");
exit(1);
}
}
if (defined($pkg_flag)) {
}
if (defined($tools)) {
print "\n";
print "REQUIRED_TOOL +=\t$_\n" for (sort keys %$tools);
}
if (defined($files)) {
print "\n";
print "REQUIRED_FILE +=\t$_\n" for (sort keys %$files);
}
if (defined($pkgs)) {
print "\n";
print "REQUIRED_PKG +=\t$_\n" for (sort keys %unique);
}
exit(0);