summaryrefslogtreecommitdiff
path: root/pkgtools/createbuildlink
diff options
context:
space:
mode:
authorrh <rh@pkgsrc.org>2004-09-26 23:48:09 +0000
committerrh <rh@pkgsrc.org>2004-09-26 23:48:09 +0000
commit07e104452da74f8826a72dcaea721751b0874830 (patch)
tree8e66750228cd5634bc76829c97b7e863873130cc /pkgtools/createbuildlink
parentb0910887b514c30606b1a2e57933b02bfdcad9c1 (diff)
downloadpkgsrc-07e104452da74f8826a72dcaea721751b0874830.tar.gz
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 (limited to 'pkgtools/createbuildlink')
-rw-r--r--pkgtools/createbuildlink/Makefile11
-rw-r--r--pkgtools/createbuildlink/PLIST3
-rwxr-xr-xpkgtools/createbuildlink/files/createbuildlink18
-rw-r--r--pkgtools/createbuildlink/files/createbuildlink.813
-rwxr-xr-xpkgtools/createbuildlink/files/substplistbasedirs90
5 files changed, 120 insertions, 15 deletions
diff --git a/pkgtools/createbuildlink/Makefile b/pkgtools/createbuildlink/Makefile
index 175b4d44841..d0ed1ec6ba3 100644
--- a/pkgtools/createbuildlink/Makefile
+++ b/pkgtools/createbuildlink/Makefile
@@ -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
-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 @@ NO_BUILD= yes
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 --git a/pkgtools/createbuildlink/PLIST b/pkgtools/createbuildlink/PLIST
index c41abc4ad5b..a834cdf995a 100644
--- a/pkgtools/createbuildlink/PLIST
+++ b/pkgtools/createbuildlink/PLIST
@@ -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 --git a/pkgtools/createbuildlink/files/createbuildlink b/pkgtools/createbuildlink/files/createbuildlink
index 7a9f41ca006..022bbf8cf01 100755
--- a/pkgtools/createbuildlink/files/createbuildlink
+++ b/pkgtools/createbuildlink/files/createbuildlink
@@ -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 @@ while [ $# -gt 0 ]; do
case "$1" in
-3)
shift;;
+ -p)
+ CREATEPLSUBST=true
+ shift;;
--)
shift; break
;;
@@ -158,6 +162,12 @@ sed -f $sedrules <<EOF
BUILDLINK_PKGSRCDIR.$PKGNOVER?= ../../$CURDIR
EOF
+if [ $CREATEPLSUBST = "true" ]; then
+ echo ""
+ substplistbasedirs
+ echo ""
+fi
+
sed -f $sedrules <<EOF
.endif # ${PKGUPPER}_BUILDLINK3_MK
EOF
diff --git a/pkgtools/createbuildlink/files/createbuildlink.8 b/pkgtools/createbuildlink/files/createbuildlink.8
index b076d1bc158..9ab386f351a 100644
--- a/pkgtools/createbuildlink/files/createbuildlink.8
+++ b/pkgtools/createbuildlink/files/createbuildlink.8
@@ -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 @@ file on stdout.
.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 --git a/pkgtools/createbuildlink/files/substplistbasedirs b/pkgtools/createbuildlink/files/substplistbasedirs
new file mode 100755
index 00000000000..a3478eb7c7f
--- /dev/null
+++ b/pkgtools/createbuildlink/files/substplistbasedirs
@@ -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; }|"