pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/revbump Update 2.9 to 2.10



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d911724fd2e4
branches:  trunk
changeset: 643384:d911724fd2e4
user:      mef <mef%pkgsrc.org@localhost>
date:      Mon Dec 15 23:25:54 2014 +0000

description:
Update 2.9 to 2.10
This update is proposed as
  http://mail-index.netbsd.org/tech-pkg/2014/12/08/msg013888.html
- (revbump) convert internal to two pass, and reduce fallout
- (replace-commonbump) new command to replace 'commonbump' to
  'commonbump.replaced'
- (check-cvs-diff) new command to check 'cvs diff -u' if py27,py34, ruby200
  and replace it if exists
  Thanks wiz@ and gdt@ for advice.

diffstat:

 pkgtools/revbump/Makefile                   |   22 +-
 pkgtools/revbump/PLIST                      |    6 +-
 pkgtools/revbump/files/check-cvs-diff       |   94 +++++++++++
 pkgtools/revbump/files/check-cvs-diff.1     |   77 +++++++++
 pkgtools/revbump/files/replace-commonbump   |  233 ++++++++++++++++++++++++++++
 pkgtools/revbump/files/replace-commonbump.1 |  106 ++++++++++++
 pkgtools/revbump/files/revbump              |   54 ++++-
 pkgtools/revbump/files/revbump.1            |   38 ++--
 8 files changed, 581 insertions(+), 49 deletions(-)

diffs (truncated from 725 to 300 lines):

diff -r 366fd90de81e -r d911724fd2e4 pkgtools/revbump/Makefile
--- a/pkgtools/revbump/Makefile Mon Dec 15 20:54:16 2014 +0000
+++ b/pkgtools/revbump/Makefile Mon Dec 15 23:25:54 2014 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.31 2014/10/09 14:06:50 wiz Exp $
+# $NetBSD: Makefile,v 1.32 2014/12/15 23:25:54 mef Exp $
 
-PKGNAME=               revbump-2.9
+PKGNAME=               revbump-2.10
 CATEGORIES=            pkgtools
 
 MAINTAINER=            wiz%NetBSD.org@localhost
@@ -16,19 +16,15 @@
 INSTALLATION_DIRS=     bin ${PKGMANDIR}/man1
 
 do-build:
-       ${SED} -e "s!@PERL@!${PERL5}!g" -e "s! make ! ${MAKE} !g" \
-               ${FILESDIR}/blbump > ${WRKDIR}/blbump
+.for  i in  blbump finddepends revbump replace-commonbump check-cvs-diff
        ${SED} -e "s!@PERL@!${PERL5}!g" -e "s! make ! ${MAKE} !g" \
-               ${FILESDIR}/finddepends > ${WRKDIR}/finddepends
-       ${SED} -e "s!@PERL@!${PERL5}!g"  -e "s! make ! ${MAKE} !g" \
-               ${FILESDIR}/revbump > ${WRKDIR}/revbump
+               ${FILESDIR}/${i} > ${WRKDIR}/${i}
+.endfor
 
 do-install:
-       ${INSTALL_SCRIPT} ${WRKDIR}/blbump ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_MAN} ${FILESDIR}/blbump.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
-       ${INSTALL_SCRIPT} ${WRKDIR}/finddepends ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_MAN} ${FILESDIR}/finddepends.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
-       ${INSTALL_SCRIPT} ${WRKDIR}/revbump ${DESTDIR}${PREFIX}/bin
-       ${INSTALL_MAN} ${FILESDIR}/revbump.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+.for  i in  blbump finddepends revbump replace-commonbump check-cvs-diff
+       ${INSTALL_SCRIPT} ${WRKDIR}/${i} ${DESTDIR}${PREFIX}/bin
+       ${INSTALL_MAN} ${FILESDIR}/${i}.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
+.endfor
 
 .include "../../mk/bsd.pkg.mk"
diff -r 366fd90de81e -r d911724fd2e4 pkgtools/revbump/PLIST
--- a/pkgtools/revbump/PLIST    Mon Dec 15 20:54:16 2014 +0000
+++ b/pkgtools/revbump/PLIST    Mon Dec 15 23:25:54 2014 +0000
@@ -1,7 +1,11 @@
-@comment $NetBSD: PLIST,v 1.3 2006/03/05 23:35:49 wiz Exp $
+@comment $NetBSD: PLIST,v 1.4 2014/12/15 23:25:54 mef Exp $
 bin/blbump
+bin/check-cvs-diff
 bin/finddepends
+bin/replace-commonbump
 bin/revbump
 man/man1/blbump.1
+man/man1/check-cvs-diff.1
 man/man1/finddepends.1
+man/man1/replace-commonbump.1
 man/man1/revbump.1
diff -r 366fd90de81e -r d911724fd2e4 pkgtools/revbump/files/check-cvs-diff
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/check-cvs-diff     Mon Dec 15 23:25:54 2014 +0000
@@ -0,0 +1,94 @@
+#!@PERL@ -w
+# -*- perl -*-
+#
+# read output of (cd /usr/pkgsrc; cvs diff -u ) and check if
+# py{27,34} and ruby200 string are left in buildlink3.mk.
+# They are then modified to Variable representation.
+#"
+use strict;
+use Getopt::Std;
+our(@ARGV);
+my (%opts);
+
+my($my_name) = $0;
+$my_name =~ s#(.*)/##;
+
+sub usage(){
+    print <<HELP;
+$my_name: 
+    Read cvs diff -u output (of named file) and substitute
+    if the string py27, py34 or ruby200 is found in the corresponding
+    changes in diff.
+Synopsys:
+    $my_name  [-h] [-p pkgsrc_dir] [-v] [cvs-diff-u_output-file]
+Where:
+    -h  Show this help
+    -p  pkgsrc directory other than /usr/pkgsrc
+    -v  verbose (not actually implemented yet)
+    cvs-diff-u_output_file:
+        The name of input. Usually the file including 'cvs diff -u' 
+        output (default cvs-diff) 
+See Also:
+    revbump(1) for how to use it.
+HELP
+}    
+
+sub main() {
+    my ($PKGSRCDIR) =  '/usr/pkgsrc';
+    my ($CVS_DIFF)  = 'cvs-diff';
+    my ($file_to_edit);
+    my ($stay, $mod) = (0,0);
+    my ($Makefile, $buildlink3, $other) = (0, 0, 0);
+
+    getopts('hvp:',\%opts);
+    if ($ARGV[0])   { $CVS_DIFF = $ARGV[0]}
+    if ($opts{'p'}) { $PKGSRCDIR = $opts{'p'}; }
+    if ($opts{'h'}) { usage() ; exit ;}
+
+   # for using rename, unlink 
+    chdir $PKGSRCDIR;
+    
+    open(CVS_DIFF, $CVS_DIFF) || die "Problem opening file $CVS_DIFF: $!\n";
+    while(<CVS_DIFF>){
+       # Looking for the +++ filename line in cvs diff (supposed to use 'cvs diff -u')
+       $file_to_edit = '';
+       if ( /^\+\+\+ (\S+)/) {
+           $file_to_edit = $1; }
+       if ( $file_to_edit && -f $file_to_edit ) {
+           if    ( $file_to_edit =~ /Makefile$/ )      { $Makefile++;}
+           elsif ( $file_to_edit =~ /buildlink3.mk$/ ) { $buildlink3++;
+               #           print __LINE__, ' ', $file_to_edit,"\n";
+               my ($new_file) = $file_to_edit. '.new';
+               my ($edit) = 0;
+               open(NEW,  "> $new_file" ) || print STDERR "Problem to write $edit: $! \n";
+               open(EDIT, $file_to_edit ) || print STDERR "Problem opening file $file_to_edit: $! \n";
+               while(<EDIT>) {
+                   if ( /^BUILDLINK.*py27/ )    {  $_=~    s/py27/\${PYPKGPREFIX}/   ; $edit++;}
+                   if ( /^BUILDLINK.*py34/ )    {  $_=~    s/py34/\${PYPKGPREFIX}/   ;
+                                                   print STDERR "   py34 found at $file_to_edit\n";
+                                                   ; $edit++;}
+                   if ( /^BUILDLINK.*ruby200/ ) {  $_=~ s/ruby200/\${RUBY_PKGPREFIX}/ ; $edit++;}
+                   print NEW $_;
+               }
+               close(EDIT);
+               close(NEW);
+               if ($edit) { unlink $file_to_edit; 
+                            rename $new_file, $file_to_edit;
+                            $mod++;}
+               else {
+                   $stay++;
+                   unlink $new_file; };
+           } else  { $other++; print STDERR "  (other) ", $file_to_edit,"\n"}
+           }
+        }
+       close(CVS_DIFF);
+    printf STDERR "Makefile:      %4d\n", $Makefile;
+    printf STDERR "buildlink3.mk: %4d\n", $buildlink3;
+    printf STDERR "  Modified:    %4d\n", $mod;
+    printf STDERR "  Untouched:   %4d\n", $stay;
+    printf STDERR "Other:         %4d\n", $other;
+}
+
+main();
+exit;
+
diff -r 366fd90de81e -r d911724fd2e4 pkgtools/revbump/files/check-cvs-diff.1
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/check-cvs-diff.1   Mon Dec 15 23:25:54 2014 +0000
@@ -0,0 +1,77 @@
+.\"    $NetBSD: check-cvs-diff.1,v 1.1 2014/12/15 23:25:54 mef Exp $
+.\"
+.\" Copyright (c) 2003, 2004, 2005 The NetBSD Foundation, Inc.
+.\"
+.\" This code was originally contributed to the NetBSD Foundation, Inc.
+.\" by Makoto Fujiwara <mef%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 December 14, 2014    
+.Dt CHECK-CVS-DIFF 1
+.Os
+.Sh NAME
+.Nm check-cvs-diff
+.Nd tool to check if revbump process described in revbump(1) results including py27, py34 or ruby200
+in the files. And then replaces the strings by the variable notation.
+.Sh SYNOPSIS
+.Nm
+.Op Fl h
+.Op Fl p Ar pkgsrcdir
+.Op Fl v
+cvs-diff-u_output-file
+.Sh DESCRIPTION
+.Nm
+is a perl script for pkgsrc developers that simplifies checking and replacing fixed
+version number in revbump resultant tree, Makefile and buildlink3.mk files.
+It reads `cvs diff -u' output written in named file, and if above mentioned strings found in the diff, replaces it in corresponding file by apropriate variable notation.
+.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
+If
+.Fl v
+is given,
+it outputs some verbose information.
+
+.Nm
+prints the package name
+(in
+.Ar category/package
+form) on stdout for each package where it failed, but usually none.
+
+.Sh SEE ALSO
+.Xr revbump 1 ,
+.Xr finddepends 1 ,
+.Xr replace-commonbump 1
diff -r 366fd90de81e -r d911724fd2e4 pkgtools/revbump/files/replace-commonbump
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/revbump/files/replace-commonbump Mon Dec 15 23:25:54 2014 +0000
@@ -0,0 +1,233 @@
+#!@PERL@ -w
+# -*- perl -*-
+# The process has two steps
+# (1)
+# Travers all the files (with some filtering) over /usr/pkgsrc
+# pick up referenced -> referer relation and store them to %HASH 
+#  (multiple files are concatinated by ';' )
+# (2)
+# read input (usually named 'commonbump'), and expand one line into
+# replacement referer lines, which are referenced  -> referer relation.
+
+use strict;
+use Getopt::Std;
+use File::Find;
+
+my(%HASH);                     # referenced -> referer relation hash, referer is delimitted by ;
+my($PKGSRCDIR) = '/usr/pkgsrc';        # /usr/pkgsrc path, usually /usr/pkgsrc
+
+my($TABLE) = 'commonbump';     # name of file, list-of-files to process
+my(@TABLE);                    # contents of file above
+
+my($debug) = 0;
+my($prefix) ;                  # A part of path, top to pkgsrc, typically /usr/pkgsrc
+
+my($common_bump) = 0;          # count, not used for now (yet)
+my(%opts);
+our(@ARGV);
+
+my ($FILE)     = __FILE__;
+    $FILE      =~ s,.*/([^/]+),$1,;    # pick leafname from __FILE__
+
+my($replaced) = 'commonbump.replaced';
+
+my($my_name) = $0;
+$my_name =~ s#(.*)/##;
+
+sub usage() {
+    print <<HELP;
+$my_name:
+  This command is a part of revbump package and intended for pkgsrc developers.
+  (1) Read entire pkgsrc tree and check referer -> referenced relation,
+      then internally keeps (opposite) referenced -> referer relation table.
+  (2) Read another file, named '$TABLE' or other name with -T, which
+      usually lists Makefile.common or *common.mk files to expand.
+  (3) Now expands those list in '$TABLE' into list of Makefiles by
+      referenced -> refer relation. By default, it outputs to the file
+      '$replaced' (currently the name is fixed).
+
+Synopsys:
+    $my_name [-a ] [-h] [-p pkgsrc_directory] [-T list_file] 
+Where:
+   -a  Check all, disregard to -T option. If "# used by" is 
+       included or not.
+   -h  Show this help
+   -p directory        
+        pkgsrc directory to process (default $PKGSRCDIR)
+   -T  the filename containing list of files (default commonbump)
+See Also:
+    revbump(1) for how to use it.
+HELP
+}
+



Home | Main Index | Thread Index | Old Index