summaryrefslogtreecommitdiff
path: root/pkgtools/revbump
diff options
context:
space:
mode:
authorwiz <wiz@pkgsrc.org>2006-03-07 04:30:54 +0000
committerwiz <wiz@pkgsrc.org>2006-03-07 04:30:54 +0000
commit2c12144688d723a6761598be1645652631b12751 (patch)
treeda9a44c9b8c1e41300e9dc550dd1d1927b683e74 /pkgtools/revbump
parent45dc23c820a6b6ba689412f07026d008250d3176 (diff)
downloadpkgsrc-2c12144688d723a6761598be1645652631b12751.tar.gz
Standardize option handling (use getopts, provide same options for all
three tools). use strict and cleanup problems found this way. Remove some unused variables. Update documentation. Welcome to 1.3!
Diffstat (limited to 'pkgtools/revbump')
-rw-r--r--pkgtools/revbump/Makefile4
-rw-r--r--pkgtools/revbump/files/blbump36
-rw-r--r--pkgtools/revbump/files/blbump.110
-rw-r--r--pkgtools/revbump/files/finddepends18
-rw-r--r--pkgtools/revbump/files/finddepends.116
-rw-r--r--pkgtools/revbump/files/revbump31
-rw-r--r--pkgtools/revbump/files/revbump.110
7 files changed, 81 insertions, 44 deletions
diff --git a/pkgtools/revbump/Makefile b/pkgtools/revbump/Makefile
index d32e40c8622..8eb5d63dfb7 100644
--- a/pkgtools/revbump/Makefile
+++ b/pkgtools/revbump/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.5 2006/03/05 23:35:49 wiz Exp $
+# $NetBSD: Makefile,v 1.6 2006/03/07 04:30:54 wiz Exp $
#
-DISTNAME= revbump-1.2
+DISTNAME= revbump-1.3
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/revbump/files/blbump b/pkgtools/revbump/files/blbump
index cb6249c0286..d712e12c269 100644
--- a/pkgtools/revbump/files/blbump
+++ b/pkgtools/revbump/files/blbump
@@ -1,6 +1,6 @@
#!@PERL@ -w
#
-# $NetBSD: blbump,v 1.1.1.1 2005/01/05 00:31:39 wiz Exp $
+# $NetBSD: blbump,v 1.2 2006/03/07 04:30:54 wiz Exp $
#
# Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
#
@@ -33,6 +33,10 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+use strict;
+use Getopt::Std;
+
+my (@PACKAGES, $PKGSRCDIR, %opt, $pkg);
$PKGSRCDIR = $ENV{PKGSRCDIR};
if (! $PKGSRCDIR) {
@@ -40,7 +44,7 @@ if (! $PKGSRCDIR) {
}
sub usage {
- print STDERR "usage: blbump [-p pkgsrcdir] [cat1/pkg1 ... catN/pkgN]\n\n";
+ print STDERR "usage: blbump [-h] [-p pkgsrcdir] [cat1/pkg1 ... catN/pkgN]\n\n";
print STDERR "If no packages are given as arguments, the list is read from stdin.\n";
print STDERR "Packages whose buildlink files cannot be updated automatically\n";
print STDERR "are written to stdout.\n";
@@ -49,9 +53,13 @@ sub usage {
sub blbump {
my $pkgdir = shift;
- my ($oldpkgver, $pkgver, $done, $rev, $oldbl, $newbl, $backupbl);
+ my ($pkgver, $ret);
local (*MAKE);
+ # ignore packages without buildlink3.mk files
+ if (not -e "$PKGSRCDIR/$pkgdir/buildlink3.mk") {
+ return 1;
+ }
open(MAKE, '-|', "cd $PKGSRCDIR/$pkgdir ; make show-var VARNAME=PKGNAME");
$pkgver = <MAKE>;
close(MAKE);
@@ -69,9 +77,9 @@ sub blbump {
}
sub bumpbl {
+ my ($backupbl, $done, $newbl, $oldbl, $pkgver);
$oldbl = shift;
$pkgver = shift;
- my ($done, $rev, $newbl, $backupbl);
local (*OLDBL);
open(OLDBL, $oldbl) or return 0;
@@ -107,19 +115,15 @@ sub bumpbl {
return 1;
}
-@PACKAGES = ();
-
-while (@ARGV) {
- $arg = shift;
- if ($arg eq '-h') {
- usage();
- } elsif ($arg eq '-p') {
- $PKGSRCDIR = shift;
- } else {
- push @PACKAGES, $arg;
- }
+getopts('hp:', \%opt);
+usage() if $opt{h};
+if ($opt{p}) {
+ $PKGSRCDIR = $opt{p};
}
+@PACKAGES = ();
+push @PACKAGES, @ARGV;
+
if (! -d $PKGSRCDIR || ! -d "$PKGSRCDIR/doc" || ! -d "$PKGSRCDIR/mk") {
print STDERR "Invalid pkgsrc directory $PKGSRCDIR\n";
exit 1;
@@ -132,14 +136,12 @@ if (! @PACKAGES) {
}
}
-@valid = ();
foreach $pkg (@PACKAGES) {
if (! -f "$PKGSRCDIR/$pkg/Makefile") {
print "$pkg\n";
} else {
print "$pkg\n" if blbump("$pkg") == 0;
$pkg =~ /\/(.*)$/;
- push @valid, $1;
}
}
diff --git a/pkgtools/revbump/files/blbump.1 b/pkgtools/revbump/files/blbump.1
index a4708b0f007..25a870e92e4 100644
--- a/pkgtools/revbump/files/blbump.1
+++ b/pkgtools/revbump/files/blbump.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: blbump.1,v 1.2 2006/03/05 23:35:49 wiz Exp $
+.\" $NetBSD: blbump.1,v 1.3 2006/03/07 04:30:54 wiz Exp $
.\"
.\" Copyright (c) 2003, 2004, 2005 The NetBSD Foundation, Inc.
.\"
@@ -31,7 +31,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 6, 2006
+.Dd March 7, 2006
.Dt BLBUMP 1
.Os
.Sh NAME
@@ -39,6 +39,7 @@
.Nd tool to help bumping dependencies in buildlink3 files automatically
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl p Ar pkgsrcdir
.Op cat1/pkg1 ... catN/pkgN
.Sh DESCRIPTION
@@ -50,12 +51,17 @@ Given a package (in
format) on the command line or stdin, it will try to adjust the
.Dv BUILDLINK_RECOMMENDED
line for that package to the current version automatically.
+.Pp
+.Nm Fl h
+displays a short usage.
+.Pp
If
.Fl p
is given,
.Ar pkgsrcdir
is used instead of the default
.Pa /usr/pkgsrc .
+.Pp
.Nm
reports successful updates on stdout, and prints the package name
(in
diff --git a/pkgtools/revbump/files/finddepends b/pkgtools/revbump/files/finddepends
index bae857ffda5..7167a8bb7df 100644
--- a/pkgtools/revbump/files/finddepends
+++ b/pkgtools/revbump/files/finddepends
@@ -1,6 +1,6 @@
#!@PERL@ -w
#
-# $NetBSD: finddepends,v 1.1 2006/03/05 23:35:49 wiz Exp $
+# $NetBSD: finddepends,v 1.2 2006/03/07 04:30:54 wiz Exp $
#
# Copyright (c) 2006 The NetBSD Foundation, Inc.
#
@@ -34,19 +34,31 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+use strict;
+use Getopt::Std;
+
+my ($PKGSRCDIR, $arg, $bl3, %bl3content, @bl3files, @bl3result,
+ $content, $found, $key, $makefile, @makefiles, %opt,
+ $pattern, @searchlist);
+
$PKGSRCDIR = $ENV{PKGSRCDIR};
if (! $PKGSRCDIR) {
$PKGSRCDIR = "/usr/pkgsrc";
}
sub usage {
- print STDERR "usage: finddepends package\n\n";
+ print STDERR "usage: finddepends [-h] [-p pkgsrcdir] package\n\n";
print STDERR "Find all packages that depend on the argument package.\n";
exit 0;
}
-usage if (1 ne @ARGV);
+getopts('hp:', \%opt);
+usage() if $opt{h};
+if ($opt{p}) {
+ $PKGSRCDIR = $opt{p};
+}
+usage if (1 ne @ARGV);
$arg = shift;
@searchlist = ();
diff --git a/pkgtools/revbump/files/finddepends.1 b/pkgtools/revbump/files/finddepends.1
index a173fa1569f..4a80c69b097 100644
--- a/pkgtools/revbump/files/finddepends.1
+++ b/pkgtools/revbump/files/finddepends.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: finddepends.1,v 1.1 2006/03/05 23:35:49 wiz Exp $
+.\" $NetBSD: finddepends.1,v 1.2 2006/03/07 04:30:54 wiz Exp $
.\"
.\" Copyright (c) 2006 The NetBSD Foundation, Inc.
.\"
@@ -31,7 +31,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 6, 2006
+.Dd March 7, 2006
.Dt FINDDEPENDS 1
.Os
.Sh NAME
@@ -39,6 +39,8 @@
.Nd tool for finding packages including a particular file
.Sh SYNOPSIS
.Nm
+.Op Fl h
+.Op Fl p Ar pkgsrcdir
.Ar pattern
.Sh DESCRIPTION
.Nm
@@ -50,6 +52,16 @@ on the command line, it will recursively find all buildlink3.mk files
that include it, and then find all Makefiles that include any of the
buildlink3.mk files.
.Pp
+.Nm Fl h
+displays a short usage.
+.Pp
+If
+.Fl p
+is given,
+.Ar pkgsrcdir
+is used instead of the default
+.Pa /usr/pkgsrc .
+.Pp
See
.Xr revbump 1
for an example of a complete recursive PKGREVISION bump.
diff --git a/pkgtools/revbump/files/revbump b/pkgtools/revbump/files/revbump
index 81c2ba26bc3..f4e80df5402 100644
--- a/pkgtools/revbump/files/revbump
+++ b/pkgtools/revbump/files/revbump
@@ -1,6 +1,6 @@
#!@PERL@ -w
#
-# $NetBSD: revbump,v 1.1.1.1 2005/01/05 00:31:38 wiz Exp $
+# $NetBSD: revbump,v 1.2 2006/03/07 04:30:54 wiz Exp $
#
# Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
#
@@ -34,13 +34,18 @@
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+use strict;
+use Getopt::Std;
+
+my (@PACKAGES, $PKGSRCDIR, %opt, $pkg);
+
$PKGSRCDIR = $ENV{PKGSRCDIR};
if (! $PKGSRCDIR) {
$PKGSRCDIR = "/usr/pkgsrc";
}
sub usage {
- print STDERR "usage: revbump [-p pkgsrcdir] [cat1/pkg1 ... catN/pkgN]\n\n";
+ print STDERR "usage: revbump [-h] [-p pkgsrcdir] [cat1/pkg1 ... catN/pkgN]\n\n";
print STDERR "If no packages are given as arguments, the list is read from stdin.\n";
print STDERR "Packages for which revision cannot be bumped are written to stdout.\n";
exit 0;
@@ -48,7 +53,7 @@ sub usage {
sub revbump {
my $pkgdir = shift;
- my ($pkg, $oldpkgver, $pkgver, $done, $rev, $oldmk, $newmk, $backupmk);
+ my ($pkg, $oldpkgver, $pkgver, $done, $oldmk, $newmk, $backupmk);
local (*OLDMK, *MAKE);
$pkgdir =~ /\/(.*)$/;
@@ -126,19 +131,15 @@ sub revbump {
return 1;
}
-@PACKAGES = ();
-
-while (@ARGV) {
- $arg = shift;
- if ($arg eq '-h') {
- usage();
- } elsif ($arg eq '-p') {
- $PKGSRCDIR = shift;
- } else {
- push @PACKAGES, $arg;
- }
+getopts('hp:', \%opt);
+usage() if $opt{h};
+if ($opt{p}) {
+ $PKGSRCDIR = $opt{p};
}
+@PACKAGES = ();
+push @PACKAGES, @ARGV;
+
if (! -d $PKGSRCDIR || ! -d "$PKGSRCDIR/doc" || ! -d "$PKGSRCDIR/mk") {
print STDERR "Invalid pkgsrc directory $PKGSRCDIR\n";
exit 1;
@@ -151,14 +152,12 @@ if (! @PACKAGES) {
}
}
-@valid = ();
foreach $pkg (@PACKAGES) {
if (! -f "$PKGSRCDIR/$pkg/Makefile") {
print "$pkg\n";
} else {
print "$pkg\n" if revbump("$pkg") == 0;
$pkg =~ /\/(.*)$/;
- push @valid, $1;
}
}
diff --git a/pkgtools/revbump/files/revbump.1 b/pkgtools/revbump/files/revbump.1
index a0d23bd23b4..a2565ac83f2 100644
--- a/pkgtools/revbump/files/revbump.1
+++ b/pkgtools/revbump/files/revbump.1
@@ -1,4 +1,4 @@
-.\" $NetBSD: revbump.1,v 1.3 2006/03/06 18:24:11 wiz Exp $
+.\" $NetBSD: revbump.1,v 1.4 2006/03/07 04:30:54 wiz Exp $
.\"
.\" Copyright (c) 2003, 2004, 2005, 2006 The NetBSD Foundation, Inc.
.\"
@@ -31,7 +31,7 @@
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd March 6, 2006
+.Dd March 7, 2006
.Dt REVBUMP 1
.Os
.Sh NAME
@@ -39,6 +39,7 @@
.Nd tool to help bump PKGREVISIONs automatically
.Sh SYNOPSIS
.Nm
+.Op Fl h
.Op Fl p Ar pkgsrcdir
.Op cat1/pkg1 ... catN/pkgN
.Sh DESCRIPTION
@@ -49,12 +50,17 @@ Given a package (in
.Ar category/package
format) on the command line or stdin, it will try to increase
the PKGREVISION for that package automatically.
+.Pp
+.Nm Fl h
+displays a short usage.
+.Pp
If
.Fl p
is given,
.Ar pkgsrcdir
is used instead of the default
.Pa /usr/pkgsrc .
+.Pp
.Nm
reports successful updates on stdout, and prints the package name
(in