summaryrefslogtreecommitdiff
path: root/ports-mgmt/porteasy
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2001-03-11 01:14:27 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2001-03-11 01:14:27 +0000
commit5dde6f413fed5f14ea7bfd3bce7635df4ddddd04 (patch)
tree8ea2b2b71dce6d72f5577a1fa45772b717dc7a9c /ports-mgmt/porteasy
parentAdd locale file forgotten in the last update (diff)
Porteasy 2.3: cvspass magic for anoncvs.freebsd.org; new -w option for
displaying a port's web site URL; don't build by default (sometimes you just want to update a port and all its dependencies); code cleanup.
Notes
Notes: svn path=/head/; revision=39502
Diffstat (limited to 'ports-mgmt/porteasy')
-rw-r--r--ports-mgmt/porteasy/Makefile8
-rw-r--r--ports-mgmt/porteasy/pkg-plist2
-rw-r--r--ports-mgmt/porteasy/src/porteasy.815
-rw-r--r--ports-mgmt/porteasy/src/porteasy.pl86
4 files changed, 85 insertions, 26 deletions
diff --git a/ports-mgmt/porteasy/Makefile b/ports-mgmt/porteasy/Makefile
index 6595cfaa2665..d2dd0f9a1c64 100644
--- a/ports-mgmt/porteasy/Makefile
+++ b/ports-mgmt/porteasy/Makefile
@@ -8,7 +8,7 @@
#
PORTNAME= porteasy
-PORTVERSION= 2.2
+PORTVERSION= 2.3
CATEGORIES= misc
MASTER_SITES= # none
DISTFILES= # none
@@ -26,8 +26,12 @@ MAN8= porteasy.8
do-fetch:
@${DO_NADA}
+do-configure:
+ @${SED} "s,%%PREFIX%%,${PREFIX}," ${SRC}/porteasy.pl >${WRKDIR}/porteasy
do-install:
- @${INSTALL_SCRIPT} ${SRC}/porteasy.pl ${PREFIX}/bin/porteasy
+ @${INSTALL_SCRIPT} ${WRKDIR}/porteasy ${PREFIX}/bin/porteasy
@${INSTALL_MAN} ${SRC}/porteasy.8 ${PREFIX}/man/man8
+ @${MKDIR} ${PREFIX}/share/porteasy
+ @${INSTALL_DATA} ${SRC}/cvspass ${PREFIX}/share/porteasy/cvspass
.include <bsd.port.mk>
diff --git a/ports-mgmt/porteasy/pkg-plist b/ports-mgmt/porteasy/pkg-plist
index 6b52c1b30876..c79cbe496094 100644
--- a/ports-mgmt/porteasy/pkg-plist
+++ b/ports-mgmt/porteasy/pkg-plist
@@ -1 +1,3 @@
bin/porteasy
+share/porteasy/cvspass
+@dirrm share/porteasy
diff --git a/ports-mgmt/porteasy/src/porteasy.8 b/ports-mgmt/porteasy/src/porteasy.8
index ad5a504e9c0d..2442454b43fa 100644
--- a/ports-mgmt/porteasy/src/porteasy.8
+++ b/ports-mgmt/porteasy/src/porteasy.8
@@ -35,7 +35,7 @@
.Nd fetch and build ports
.Sh SYNOPSIS
.Nm porteasy
-.Op Fl abCceFfhikLluVv
+.Op Fl abCceFfhikLluVvw
.Op Fl D Ar date
.Op Fl d Ar dir
.Op Fl p Ar dir
@@ -99,10 +99,10 @@ Show the
version number and exit.
.It Fl v
Verbose mode: show more information about what is being done.
+.It Fl w
+Show the URL of the port's web site if there is one listed in the port
+description.
.El
-.Pp
-If no options are specified, the default is to build the specified
-ports.
.Ss Port names
The port names listed on the command line may be either unqualified or
fully qualified.
@@ -179,6 +179,13 @@ If no ports were specified,
instead prints a list of all installed ports, with unknown ports (i.e.
ports that are not in the index file, or are out of date) indicated
with a question mark.
+.It Show the URLs of the selected ports' web sites
+If the
+.Fl w
+option was specified,
+.Nm
+prints the URL of the web site of each port that was specified on the
+command line, if a URL is listed in that port's description.
.It Clean the tree
If the
.Fl c
diff --git a/ports-mgmt/porteasy/src/porteasy.pl b/ports-mgmt/porteasy/src/porteasy.pl
index 2331e2c4441f..d09226bcadad 100644
--- a/ports-mgmt/porteasy/src/porteasy.pl
+++ b/ports-mgmt/porteasy/src/porteasy.pl
@@ -42,6 +42,8 @@ sub REQ_EXPLICIT { 1 }
sub REQ_IMPLICIT { 2 }
sub REQ_MASTER { 4 }
+sub CVS_PASSFILE { "%%PREFIX%%/share/porteasy/cvspass" }
+
sub PATH_CVS { "/usr/bin/cvs" }
sub PATH_LDCONFIG { "/sbin/ldconfig" }
sub PATH_MAKE { "/usr/bin/make" }
@@ -68,6 +70,7 @@ my $plist = 0; # Print packing list
my $build = 0; # Build ports
my $update = 0; # Update ports tree from CVS
my $verbose = 0; # Verbose mode
+my $website = 0; # Show website URL
# Global variables
my %ports; # Maps ports to their directory.
@@ -605,6 +608,24 @@ sub update_ports_tree(@) {
}
#
+# Find a specific file belonging to a specific port
+#
+sub find_port_file($$) {
+ my $port = shift; # Port
+ my $file = shift; # File to look for
+
+ my $master; # Master port
+
+ $master = $port;
+ while (!-f "$portsdir/$master/$file") {
+ if (!($master = $masterport{$master})) {
+ bsd:errx(1, "$port has no $file");
+ }
+ }
+ return "$portsdir/$master/$file";
+}
+
+#
# Show port info
#
sub show_port_info($) {
@@ -613,7 +634,7 @@ sub show_port_info($) {
local *FILE; # File handle
my $info; # Port info
- sysopen(FILE, "$portsdir/$port/pkg-descr", O_RDONLY)
+ sysopen(FILE, find_port_file($port, "pkg-descr"), O_RDONLY)
or bsd::err(1, "can't read description for $port");
$info = join("| ", <FILE>);
close(FILE);
@@ -621,6 +642,30 @@ sub show_port_info($) {
}
#
+# Show port's website URL
+#
+sub show_port_website($) {
+ my $port = shift; # Port to show info for
+
+ local *FILE; # File handle
+ my $website; # Port's website
+
+ sysopen(FILE, find_port_file($port, "pkg-descr"), O_RDONLY)
+ or bsd::err(1, "can't read description for $port");
+ while (<FILE>) {
+ if (m/^WWW:\s*(\S+)\s*$/) {
+ $website = $1;
+ }
+ }
+ close(FILE);
+ if (!defined($website)) {
+ bsd::warnx("No website for $port");
+ } else {
+ print("$website\n");
+ }
+}
+
+#
# Show port plist
#
sub show_port_plist($) {
@@ -634,13 +679,7 @@ sub show_port_plist($) {
$prefix = suppress(\&make, ($port, "-VPREFIX"));
chomp($prefix);
- $master = $port;
- while (!-f "$portsdir/$master/pkg-plist") {
- if (!($master = $masterport{$master})) {
- bsd:errx(1, "$port has no packing list");
- }
- }
- sysopen(FILE, "$portsdir/$master/pkg-plist", O_RDONLY)
+ sysopen(FILE, find_port_file($port, "pkg-plist"), O_RDONLY)
or bsd::err(1, "can't read packing list for $port");
while (<FILE>) {
chomp();
@@ -851,15 +890,13 @@ MAIN:{
"u|update" => \$update,
"V|version" => \&version,
"v|verbose" => \$verbose,
+ "w|website" => \$website,
"x|ecks" => \&ecks,
)
or usage();
- if (!($clean || $fetch || $info || $list || $packages || $plist)) {
- $build = 1;
- }
-
- if (!@ARGV && ($build || $fetch || $list || $packages || $plist)) {
+ if (!@ARGV &&
+ ($build || $fetch || $list || $packages || $plist || $website)) {
usage();
}
@@ -882,6 +919,9 @@ MAIN:{
# Set and check CVS root
if ($anoncvs && !$cvsroot) {
$cvsroot = &ANONCVS_ROOT;
+ if (-f &CVS_PASSFILE) {
+ $ENV{'CVS_PASSFILE'} = &CVS_PASSFILE;
+ }
}
if (!$cvsroot) {
$cvsroot = $ENV{'CVSROOT'};
@@ -901,8 +941,8 @@ MAIN:{
}
# Step 1: read the ports index
+ update_index();
if ($need_index) {
- update_index();
read_index();
}
@@ -915,9 +955,6 @@ MAIN:{
}
# Step 3: update port directories and discover dependencies
- if (!($build || $fetch || ($info && @ARGV) || $list)) {
- $update = 0;
- }
update_ports_tree(keys(%reqd));
# Step 4: deselect ports which are already installed
@@ -961,8 +998,17 @@ MAIN:{
}
}
}
+
+ # Step 8: show website URL
+ if ($website) {
+ foreach $port (keys(%reqd)) {
+ if ($reqd{$port} & &REQ_EXPLICIT) {
+ show_port_website($port);
+ }
+ }
+ }
- # Step 8: clean the ports directories (or the entire tree)
+ # Step 9: clean the ports directories (or the entire tree)
if ($clean) {
if (!@ARGV) {
clean_tree();
@@ -975,7 +1021,7 @@ MAIN:{
}
}
- # Step 9: fetch distfiles
+ # Step A: fetch distfiles
if ($fetch) {
foreach $port (keys(%reqd)) {
if ($reqd{$port} != &REQ_MASTER) {
@@ -984,7 +1030,7 @@ MAIN:{
}
}
- # Step A: build ports - only the explicitly required ones, since
+ # Step B: build ports - only the explicitly required ones, since
# some dependencies (most commonly XFree86) may be bogus.
if ($build || $packages) {
foreach $port (keys(%reqd)) {