diff options
author | des <des@FreeBSD.org> | 2003-04-07 13:23:50 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-04-07 13:23:50 +0000 |
commit | 5ffd4c4bf35caf9f25e7b3afae06f3b19e216e18 (patch) | |
tree | 571852eff971a312586a2da52bc1443dbd7d08eb /misc/porteasy/src | |
parent | 33d7b6405897935d46f6de7eabcbdcbf0b2566d7 (diff) | |
download | FreeBSD-ports-5ffd4c4bf35caf9f25e7b3afae06f3b19e216e18.zip FreeBSD-ports-5ffd4c4bf35caf9f25e7b3afae06f3b19e216e18.tar.gz |
Allow the user to specify environment variables on the command line.
Use DEPENDS_CLEAN instead of hacking DEPENDS_TARGET.
Change the process title to reflect the current phase / task.
Diffstat (limited to 'misc/porteasy/src')
-rw-r--r-- | misc/porteasy/src/porteasy.8 | 12 | ||||
-rw-r--r-- | misc/porteasy/src/porteasy.pl | 44 |
2 files changed, 46 insertions, 10 deletions
diff --git a/misc/porteasy/src/porteasy.8 b/misc/porteasy/src/porteasy.8 index df99dfe..1fd24d0 100644 --- a/misc/porteasy/src/porteasy.8 +++ b/misc/porteasy/src/porteasy.8 @@ -41,7 +41,7 @@ .Op Fl p Ar dir .Op Fl r Ar dir .Op Fl t Ar tag -.Op Ar port ... +.Op Ar port | VAR=VAL ... .Sh DESCRIPTION .Nm maintains an updated ports tree, and fetches and builds ports @@ -84,7 +84,7 @@ List the packing lists for the selected ports. .It Fl l List the selected ports. .It Fl p Ar dir -Specify the ports directory (normally +Specify the ports directory (normally .Pa /usr/ports ) . .It Fl r Ar dir Specify the CVS root directory. @@ -107,6 +107,14 @@ Verbose mode: show more information about what is being done. Show the URL of the port's web site if there is one listed in the port description. .El +.Ss Environment settings +Any command line argument of the form +.Ar VAR=VAL +is interpreted as a variable assignment which will be exported into +subprocesses' environments. +Thus compile-time configuration options can be specified on the +.Nm +command line. .Ss Port names The port names listed on the command line may be either unqualified or fully qualified. diff --git a/misc/porteasy/src/porteasy.pl b/misc/porteasy/src/porteasy.pl index b29c7cd..0c947df 100644 --- a/misc/porteasy/src/porteasy.pl +++ b/misc/porteasy/src/porteasy.pl @@ -33,7 +33,7 @@ use strict; use Fcntl; use Getopt::Long; -my $VERSION = "2.7.5"; +my $VERSION = "2.7.6"; my $COPYRIGHT = "Copyright (c) 2000-2003 Dag-Erling Smørgrav. " . "All rights reserved."; @@ -89,6 +89,17 @@ my %installed; # Installed ports my $capture; # Capture output # +# Set process title +# +sub setproctitle(;$) { + my $title = shift; + + $0 = "porteasy $VERSION"; + $0 .= ": $title" + if defined($title); +} + +# # Shortcut for 'print STDERR' # sub stderr(@) { @@ -635,6 +646,8 @@ sub update_ports_tree(@) { my $master; # Master port my $dependency; # Dependency + setproctitle("updating"); + # Determine which ports need updating foreach $item (@additional) { next if $processed{$item}; @@ -674,6 +687,8 @@ sub update_ports_tree(@) { # Process all unprocessed ports we know of so far foreach $port (@update_now) { + setproctitle("updating $port"); + # See if the port has an unprocessed master port if (($master = find_master($port)) && !$processed{$master}) { add_port($master, &REQ_MASTER); @@ -709,6 +724,7 @@ sub update_ports_tree(@) { $processed{$port} = 1; } } + setproctitle(); } # @@ -898,8 +914,10 @@ sub list_installed() { sub clean_port($) { my $port = shift; # Port to clean + setproctitle("cleaning $port"); make($port, "clean") or bsd::warnx("failed to clean %s", $port); + setproctitle(); } # @@ -925,8 +943,10 @@ sub clean_tree() { sub fetch_port($) { my $port = shift; # Port to fetch + setproctitle("fetching $port"); make($port, "fetch") or bsd::errx(1, "failed to fetch %s", $port); + setproctitle(); } # @@ -939,21 +959,21 @@ sub build_port($) { if ($packages) { push(@makeargs, "package"); - push(@makeargs, "DEPENDS_TARGET=package clean", "-DNOCLEANDEPENDS") - unless ($dontclean); + push(@makeargs, "DEPENDS_TARGET=package"); } else { push(@makeargs, "install"); - push(@makeargs, "DEPENDS_TARGET=install clean", "-DNOCLEANDEPENDS") - unless ($dontclean); } if ($force) { push(@makeargs, "-DFORCE_PKG_REGISTER"); } if (!$dontclean) { push(@makeargs, "clean"); + push(@makeargs, "DEPENDS_CLEAN=YES"); } + setproctitle("building $port"); make($port, @makeargs) or bsd::errx(1, "failed to %s %s", $packages ? "package" : "build", $port); + setproctitle(); } # @@ -1020,6 +1040,9 @@ Report bugs to <des\@freebsd.org>. MAIN:{ my $port; # Port name my $err = 0; # Error count + my $requested = 0; # Number of ports on command line + + setproctitle(); # Show usage if no arguments were specified on the command line if (!@ARGV) { @@ -1106,8 +1129,13 @@ MAIN:{ update_index(); # Step 2: build list of explicitly required ports - foreach $port (@ARGV) { - $err += add_port($port, &REQ_EXPLICIT); + foreach my $arg (@ARGV) { + if ($arg =~ m/^([A-Z0-9_]+)=(.*)$/) { + $ENV{$1} = $2; + } else { + $err += add_port($arg, &REQ_EXPLICIT); + ++$requested; + } } if ($err) { bsd::errx(1, "some required ports were not found."); @@ -1174,7 +1202,7 @@ MAIN:{ # Step A: clean the ports directories (or the entire tree) if ($clean) { - if (!@ARGV) { + if (!$requested) { clean_tree(); } else { foreach $port (keys(%reqd)) { |