pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/pkgtools/revbump Initial import of revbump-0.1:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/385eb71584bc
branches:  trunk
changeset: 486897:385eb71584bc
user:      wiz <wiz%pkgsrc.org@localhost>
date:      Wed Jan 05 00:31:38 2005 +0000

description:
Initial import of revbump-0.1:

Tools for bumping PKGREVISIONs and adapting BUILDLINK_RECOMMENDED
versions to the latest version automatically.

This tool is mostly intended for pkgsrc developers with commit
access.

Originally written by Julio M. Merino Vidal with some improvements
by me. Comments for the package from Jeremy C. Reed -- thanks!

diffstat:

 pkgtools/revbump/DESCR           |    5 +
 pkgtools/revbump/Makefile        |   34 ++++++++
 pkgtools/revbump/PLIST           |    3 +
 pkgtools/revbump/files/blbump    |  146 ++++++++++++++++++++++++++++++++++
 pkgtools/revbump/files/blbump.1  |   65 +++++++++++++++
 pkgtools/revbump/files/revbump   |  165 +++++++++++++++++++++++++++++++++++++++
 pkgtools/revbump/files/revbump.1 |  100 +++++++++++++++++++++++
 7 files changed, 518 insertions(+), 0 deletions(-)

diffs (truncated from 546 to 300 lines):

diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/DESCR    Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,5 @@
+Tools for bumping PKGREVISIONs and adapting BUILDLINK_RECOMMENDED
+versions to the latest version automatically.
+
+This tool is mostly intended for pkgsrc developers with commit
+access.
diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/Makefile Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,34 @@
+# $NetBSD: Makefile,v 1.1.1.1 2005/01/05 00:31:38 wiz Exp $
+#
+
+DISTNAME=              revbump-1.0
+CATEGORIES=            pkgtools
+MASTER_SITES=          # empty
+DISTFILES=             # empty
+
+MAINTAINER=            wiz%NetBSD.org@localhost
+HOMEPAGE=              http://www.pkgsrc.org/
+COMMENT=               Tools for bumping PKGREVISIONs (for pkgsrc developers)
+
+PKG_INSTALLATION_TYPES=        overwrite pkgviews
+
+WRKSRC=                ${WRKDIR}
+NO_BUILDLINK=  yes
+NO_CHECKSUM=   yes
+NO_CONFIGURE=  yes
+USE_PERL5=     run
+USE_LANGUAGES= # empty
+
+INSTALLATION_DIRS=     bin man/man8
+
+do-build:
+       ${SED} -e "s!@PERL@!${PERL5}!g" ${FILESDIR}/revbump \
+               > ${WRKDIR}/revbump
+       ${SED} -e "s!@PERL@!${PERL5}!g" ${FILESDIR}/blbump \
+               > ${WRKDIR}/blbump
+
+do-install:
+       ${INSTALL_SCRIPT} ${WRKDIR}/blbump ${PREFIX}/bin
+       ${INSTALL_SCRIPT} ${WRKDIR}/revbump ${PREFIX}/bin
+
+.include "../../mk/bsd.pkg.mk"
diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/PLIST    Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2005/01/05 00:31:38 wiz Exp $
+bin/blbump
+bin/revbump
diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/files/blbump
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/blbump     Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,146 @@
+#!@PERL@ -w
+#
+# $NetBSD: blbump,v 1.1.1.1 2005/01/05 00:31:39 wiz Exp $
+#
+# Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
+#
+# This code was originally contributed to the NetBSD Foundation, Inc.
+# by Julio Merino <jmmv%NetBSD.org@localhost> and Thomas Klausner <wiz%NetBSD.org@localhost>.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+# 3. Neither the name of author nor the names of its contributors may
+#    be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+$PKGSRCDIR = $ENV{PKGSRCDIR};
+if (! $PKGSRCDIR) {
+    $PKGSRCDIR = "/usr/pkgsrc";
+}
+
+sub usage {
+    print STDERR "usage: blbump [-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";
+    exit 0;
+}
+
+sub blbump {
+    my $pkgdir = shift;
+    my ($oldpkgver, $pkgver, $done, $rev, $oldbl, $newbl, $backupbl);
+    local (*MAKE);
+
+    open(MAKE, '-|', "cd $PKGSRCDIR/$pkgdir ; make show-var VARNAME=PKGNAME");
+    $pkgver = <MAKE>;
+    close(MAKE);
+    chop $pkgver;
+    $pkgver =~ s/-([^-]*)$/>=$1/;
+
+    if (-f "$PKGSRCDIR/$pkgdir/buildlink3.mk") {
+       $ret = bumpbl("$PKGSRCDIR/$pkgdir/buildlink3.mk", $pkgver);
+       if ($ret == 0) {
+           return 0;
+       }
+    }
+
+    return 1;
+}
+
+sub bumpbl {
+    $oldbl = shift;
+    $pkgver = shift;
+    my ($done, $rev, $newbl, $backupbl);
+    local (*OLDBL);
+
+    open(OLDBL, $oldbl) or return 0;
+    $newbl = "$oldbl.new";
+    open(NEWBL, ">$newbl");
+
+    $done = 0;
+    while (<OLDBL>) {
+        if ($done == 0 && /^(BUILDLINK_RECOMMENDED.+=[ \t]+)(.+)$/) {
+            print NEWBL "$1$pkgver\n";
+           $done = 1;
+        } elsif ($done == 0 && /^BUILDLINK_PKGSRCDIR(.*=[ \t]+)/) {
+            print NEWBL "BUILDLINK_RECOMMENDED${1}$pkgver\n";
+            print NEWBL $_;
+            $done = 1;
+        } else {
+            print NEWBL $_;
+        }
+    }
+
+    # no suitable place found
+    if ($done == 0) {
+        close(NEWBL);
+        close(OLDBL);
+        unlink "$newbl";
+        return 0;
+    }
+
+    close(NEWBL);
+    close(OLDBL);
+    rename("$newbl", "$oldbl");
+
+    return 1;
+}
+
+@PACKAGES = ();
+
+while (@ARGV) {
+    $arg = shift;
+    if ($arg eq '-h') {
+        usage();
+    } elsif ($arg eq '-p') {
+        $PKGSRCDIR = shift;
+    } else {
+        push @PACKAGES, $arg;
+    }
+}
+
+if (! -d $PKGSRCDIR || ! -d "$PKGSRCDIR/doc" || ! -d "$PKGSRCDIR/mk") {
+    print STDERR "Invalid pkgsrc directory $PKGSRCDIR\n";
+    exit 1;
+}
+
+if (! @PACKAGES) {
+    while (<STDIN>) {
+        chop;
+        push @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;
+    }
+}
+
+exit 0;
diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/files/blbump.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/blbump.1   Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,65 @@
+.\"    $NetBSD: blbump.1,v 1.1.1.1 2005/01/05 00:31:39 wiz Exp $
+.\"
+.\" Copyright (c) 2003, 2004, 2005 The NetBSD Foundation, Inc.
+.\"
+.\" This code was originally contributed to the NetBSD Foundation, Inc.
+.\" by Julio Merino <jmmv%NetBSD.org@localhost> and Thomas Klausner <wiz%NetBSD.org@localhost>.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in
+.\"    the documentation and/or other materials provided with the
+.\"    distribution.
+.\" 3. Neither the name of author nor the names of its contributors may
+.\"    be used to endorse or promote products derived from this software
+.\"    without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
+.\" CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
+.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+.\" GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+.\" IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+.\" IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd January 4, 2005
+.Dt BLBUMP 1
+.Os
+.Sh NAME
+.Nm blbump
+.Nd tool to help bumping dependencies in buildlink3 files automatically
+.Sh SYNOPSIS
+.Nm
+.Op Fl p Ar pkgsrcdir
+.Op cat1/pkg1 ... catN/pkgN
+.Sh DESCRIPTION
+.Nm
+is a perl script for pkgsrc developers that simplifies bumping
+buildlink3 file dependencies automatically.
+Given a package (in
+.Ar category/package
+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.
+If
+.Fl p
+is given,
+.Ar pkgsrcdir
+is used instead of the default
+.Pa /usr/pkgsrc .
+.Nm
+reports successful updates on stdout, and prints the package name
+(in
+.Ar category/package
+form) on stdout for each package where it failed.
+.Sh SEE ALSO
+.Xr revbump 1
diff -r d7df7e2fb76c -r 385eb71584bc pkgtools/revbump/files/revbump
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/revbump    Wed Jan 05 00:31:38 2005 +0000
@@ -0,0 +1,165 @@
+#!@PERL@ -w
+#
+# $NetBSD: revbump,v 1.1.1.1 2005/01/05 00:31:38 wiz Exp $
+#
+# Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
+#
+# This code was originally contributed to the NetBSD Foundation, Inc.
+# by Julio Merino <jmmv%NetBSD.org@localhost> and Thomas Klausner <wiz%NetBSD.org@localhost>.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in
+#    the documentation and/or other materials provided with the
+#    distribution.
+# 3. Neither the name of author nor the names of its contributors may
+#    be used to endorse or promote products derived from this software
+#    without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND



Home | Main Index | Thread Index | Old Index