From 4dfe2a99829154b9b1d8a315c2d5350abef74f88 Mon Sep 17 00:00:00 2001 From: "Philip M. Gollucci" Date: Wed, 29 Apr 2009 21:08:53 +0000 Subject: - Start some docs - Add --ports -p to specify a list on the cli --- Tools/scripts/mark_safe.pl | 104 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 11 deletions(-) (limited to 'Tools') diff --git a/Tools/scripts/mark_safe.pl b/Tools/scripts/mark_safe.pl index de94daba615b..b9623a5c8039 100755 --- a/Tools/scripts/mark_safe.pl +++ b/Tools/scripts/mark_safe.pl @@ -38,6 +38,7 @@ my $NoExec = 0; # cmdline options (custom) with defaults my $Maintainer = "$ENV{USER}\@FreeBSD.org"; +my $Ports = 0; my $Safe = 1; my $Index = 'INDEX-8'; @@ -75,6 +76,8 @@ sub getopts_wrapper { "noexec|n" => \$NoExec, "maintainer|m=s" => \$Maintainer, + "ports|p" => \$Ports, + "safe|s=i" => \$Safe, "index|i=s" => \$Index, ); @@ -151,20 +154,26 @@ sub mark { sub ports_get { - my $index = "$PORTSDIR/$Index"; - print "Index: $index\n"; - my @ports = (); - open my $fh, '<', $index or die "Can't open [$index] b/c [$!]"; - while (<$fh>) { - my @parts = split /\|/; - my $port_dir = $parts[$PARTS{dir}]; - $port_dir =~ s!/usr/ports!$PORTSDIR!; - my $maintainer = $parts[$PARTS{maintainer}]; + + if ($Ports) { + @ports = @ARGV; + } + else { + my $index = "$PORTSDIR/$Index"; + print "Index: $index\n"; + + open my $fh, '<', $index or die "Can't open [$index] b/c [$!]"; + while (<$fh>) { + my @parts = split /\|/; + my $port_dir = $parts[$PARTS{dir}]; + $port_dir =~ s!/usr/ports!$PORTSDIR!; + my $maintainer = $parts[$PARTS{maintainer}]; - push @ports, $port_dir if $maintainer =~ /^$Maintainer$/io; + push @ports, $port_dir if $maintainer =~ /^$Maintainer$/io; + } + close $fh or die "Can't close [$index] b/c [$!]"; } - close $fh or die "Can't close [$index] b/c [$!]"; return \@ports; } @@ -189,3 +198,76 @@ sub main { MAIN: { exit main(); } + +__END__ + +=pod + +=head1 NAME + +mark_safe.pl - Mark a port or ports as MAKE_JOBS_(UN)SAFE=yes + +=head1 SYNOPSIS + + mark_safe.pl + +=head1 STD OPTIONS + +=over 4 + +=item B<--verbose=1,2,3,4,....> + +Display messages while running on STDOUT. Increasing the level +will increase the amount. + +DEFAULT: off/0 + +=item B<--debug|d> + +Copious messages not useful unless you are a developer AND +debuging this script are output to STDERR + +DEFAULT: off/0 + +=item B<--help|h> + +Print this message and exit EXIT_SUCCESS + +DEFAULT: off/0 + +=item B<--version|V> + +Output the version and exit with EXIT_SUCCESS + +DEFAULT: off/0 + +=item B<--noexec|n> + +Any External commands will simply be echo'd and not run +Assume all of them suceed. + +IMPLIES: --verbose=1 + +DEFAULT: off/0 + +=head1 Dependencies + +=head1 EXIT CODES + +Exits 0 on success +Exits > 0 <= 255 on error + + EXIT_SUCCESS => 0 + EXIT_FAILED_INVALID_ARGS_OR_ENV => 1 + +=head1 HISTORY + +20009-04-22 by pgollucci: + Created + +=head1 AUTHOR + +Philip M. Gollucci Epgollucci@FreeBSD.orgE + +=cut + -- cgit v1.2.3