pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/pkgtools/createbuildlink Update createbuildlink to 3.6...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/56ec8ca61125
branches:  trunk
changeset: 481153:56ec8ca61125
user:      rh <rh%pkgsrc.org@localhost>
date:      Sun Sep 26 23:48:09 2004 +0000

description:
Update createbuildlink to 3.6.  This adds a '-p' option to automatically
create PLIST awk substitution patterns for directories created by the
current package.  This is particularly useful for base packages that
create a directory structure that is then used by subsequent (dependent)
packages.

diffstat:

 pkgtools/createbuildlink/Makefile                 |  11 +-
 pkgtools/createbuildlink/PLIST                    |   3 +-
 pkgtools/createbuildlink/files/createbuildlink    |  18 +++-
 pkgtools/createbuildlink/files/createbuildlink.8  |  13 ++-
 pkgtools/createbuildlink/files/substplistbasedirs |  90 +++++++++++++++++++++++
 5 files changed, 120 insertions(+), 15 deletions(-)

diffs (240 lines):

diff -r 2eefc797d6f4 -r 56ec8ca61125 pkgtools/createbuildlink/Makefile
--- a/pkgtools/createbuildlink/Makefile Sun Sep 26 23:35:38 2004 +0000
+++ b/pkgtools/createbuildlink/Makefile Sun Sep 26 23:48:09 2004 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: Makefile,v 1.30 2004/07/06 23:18:04 wiz Exp $
+# $NetBSD: Makefile,v 1.31 2004/09/26 23:48:09 rh Exp $
 
-DISTNAME=      createbuildlink-3.5
+DISTNAME=      createbuildlink-3.6
 CATEGORIES=    pkgtools sysutils
 MASTER_SITES=  # Nothing
 DISTFILES=     # Nothing
 
 MAINTAINER=    rh%NetBSD.org@localhost
-COMMENT=       shell script to help creating buildlink[23].mk files
+COMMENT=       shell script to help creating buildlink3.mk files
 
 PKG_INSTALLATION_TYPES=        overwrite pkgviews
 
@@ -19,18 +19,19 @@
 EXTRACT_CMD=   ${ECHO}
 
 SCRIPT=                ${DISTNAME:C/-.*$//}
+SCRIPTS=       ${SCRIPT} substplistbasedirs
 
 INSTALLATION_DIRS=     bin man/man8
 
 do-configure:
-.for scr in ${SCRIPT}
+.for scr in ${SCRIPTS}
        ${SED}  -e 's|@PKGVERSION@|${PKGVERSION}|'              \
                -e 's|@MAKE@|${MAKE}|'                          \
                < ${FILESDIR}/${scr} > ${WRKSRC}/${scr}
 .endfor
 
 do-install:
-.for scr in ${SCRIPT}
+.for scr in ${SCRIPTS}
        ${INSTALL_SCRIPT} ${WRKSRC}/${scr} ${PREFIX}/bin/${scr}
 .endfor
        ${INSTALL_MAN} ${FILESDIR}/${SCRIPT}.8 ${PREFIX}/man/man8
diff -r 2eefc797d6f4 -r 56ec8ca61125 pkgtools/createbuildlink/PLIST
--- a/pkgtools/createbuildlink/PLIST    Sun Sep 26 23:35:38 2004 +0000
+++ b/pkgtools/createbuildlink/PLIST    Sun Sep 26 23:48:09 2004 +0000
@@ -1,3 +1,4 @@
-@comment $NetBSD: PLIST,v 1.3 2002/12/23 14:03:34 wiz Exp $
+@comment $NetBSD: PLIST,v 1.4 2004/09/26 23:48:09 rh Exp $
 bin/createbuildlink
+bin/substplistbasedirs
 man/man8/createbuildlink.8
diff -r 2eefc797d6f4 -r 56ec8ca61125 pkgtools/createbuildlink/files/createbuildlink
--- a/pkgtools/createbuildlink/files/createbuildlink    Sun Sep 26 23:35:38 2004 +0000
+++ b/pkgtools/createbuildlink/files/createbuildlink    Sun Sep 26 23:48:09 2004 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#      $NetBSD: createbuildlink,v 1.25 2004/07/21 22:27:35 jmmv Exp $
+#      $NetBSD: createbuildlink,v 1.26 2004/09/26 23:48:09 rh Exp $
 #
 # Copyright (c) 2002 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -39,16 +39,17 @@
 # Create an initial buildlink3.mk from a package's Makefile and PLIST
 #
 
-REV=`echo '$Revision: 1.25 $' | sed 's/\\$//g'`
+REV=`echo '$Revision: 1.26 $' | sed 's/\\$//g'`
 tmpdir=/tmp
 spacesintab=8
 makefile=Makefile
 sedrules=$tmpdir/sedrules.buildlink.$$
 PLIST=PLIST
+CREATEPLSUBST=false
 
-args=`getopt 3 $*`
+args=`getopt 3p $*`
 if [ $? != 0 ]; then
-       echo "Usage: $0 > buildlink3.mk"
+       echo "Usage: $0 [-p] > buildlink3.mk"
        exit 2
 fi
 set -- $args
@@ -56,6 +57,9 @@
        case "$1" in
        -3)
                shift;;
+       -p)
+               CREATEPLSUBST=true
+               shift;;
        --)
                shift; break
                ;;
@@ -158,6 +162,12 @@
 BUILDLINK_PKGSRCDIR.$PKGNOVER?=        ../../$CURDIR
 EOF
 
+if [ $CREATEPLSUBST = "true" ]; then
+       echo ""
+       substplistbasedirs
+       echo ""
+fi
+
 sed -f $sedrules <<EOF
 .endif # ${PKGUPPER}_BUILDLINK3_MK
 EOF
diff -r 2eefc797d6f4 -r 56ec8ca61125 pkgtools/createbuildlink/files/createbuildlink.8
--- a/pkgtools/createbuildlink/files/createbuildlink.8  Sun Sep 26 23:35:38 2004 +0000
+++ b/pkgtools/createbuildlink/files/createbuildlink.8  Sun Sep 26 23:48:09 2004 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: createbuildlink.8,v 1.9 2004/07/06 23:40:11 wiz Exp $
+.\"    $NetBSD: createbuildlink.8,v 1.10 2004/09/26 23:48:09 rh Exp $
 .\"
 .\" Copyright (c) 2002,2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -34,7 +34,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 6, 2004
+.Dd September 27, 2004
 .Dt CREATEBUILDLINK 8
 .Os
 .Sh NAME
@@ -42,7 +42,7 @@
 .Nd automatic pkgsrc buildlink3.mk generator
 .Sh SYNOPSIS
 .Nm
-.Op Fl 3
+.Op Fl p
 .Sh DESCRIPTION
 .Nm
 reads in the
@@ -56,8 +56,11 @@
 .Pp
 The following options are available:
 .Bl -tag -width indent
-.It Fl 3
-Create buildlink3.mk style output. (default)
+.It Fl p
+Create PRINT_PLIST_AWK subsitution patterns for directories created
+and removed by this package.
+This is useful for base packages that create a directory structure
+for a number of dependent packages.
 .El
 .Pp
 While
diff -r 2eefc797d6f4 -r 56ec8ca61125 pkgtools/createbuildlink/files/substplistbasedirs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/pkgtools/createbuildlink/files/substplistbasedirs Sun Sep 26 23:48:09 2004 +0000
@@ -0,0 +1,90 @@
+#!/bin/sh
+#
+#      $NetBSD: substplistbasedirs,v 1.1 2004/09/26 23:48:09 rh Exp $
+#
+# Copyright (c) 2002 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Rene Hexel.
+#
+# 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. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation 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.
+#
+# Create substitution patterns for dependent packages for directories listed
+# in a base package
+#
+
+REV=`echo '$Revision: 1.1 $' | sed 's/\\$//g'`
+CURDIR=`pwd | sed 's|^.*/\([^/]*/[^/]*\)$|\1|'`
+PLIST=PLIST
+MDFLAG=true
+
+args=`getopt n $*`
+if [ $? != 0 ]; then
+       echo "Usage: $0 [-n]"
+       exit 2
+fi
+set -- $args
+while [ $# -gt 0 ]; do
+       case "$1" in
+       -n)
+               MDFLAG=no_mkdir_patterns
+               shift;;
+       --)
+               shift; break
+               ;;
+       esac
+       shift
+done
+
+##
+## some simple integrity checking
+##
+if [ ! -f $PLIST ]; then
+       echo "###> Incomplete package! To create a substitution pattern <###"
+       echo "###> a working $PLIST is required!                         <###"
+       exit 1
+fi
+
+##
+## create @dirrm substitution patterns
+## 
+grep '^@dirrm' $PLIST | sort | sed                                     \
+       -e 's|/|\\/|g'                                                  \
+       -e 's|^|PRINT_PLIST_AWK+=       /\^|'                           \
+       -e "s|$|\$\$/ { print \"@comment in ${CURDIR}: \" \$\$0; next; }|"
+
+##
+## create @exec ${MKDIR} removal patterns
+## 
+[ "$MDFLAG" != "true" ] || grep '^@dirrm' $PLIST | sort | sed          \
+       -e 's|/|\\/|g'                                                  \
+       -e 's|^|PRINT_PLIST_AWK+=       /\^|'                           \
+       -e 's|@dirrm |@exec $${MKDIR} %D\\/|'                           \
+       -e "s|$|\$\$/ { next; }|"



Home | Main Index | Thread Index | Old Index