summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_rolling-replace
diff options
context:
space:
mode:
Diffstat (limited to 'pkgtools/pkg_rolling-replace')
-rw-r--r--pkgtools/pkg_rolling-replace/Makefile15
-rw-r--r--pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.824
-rwxr-xr-xpkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh29
3 files changed, 52 insertions, 16 deletions
diff --git a/pkgtools/pkg_rolling-replace/Makefile b/pkgtools/pkg_rolling-replace/Makefile
index ac94a3e5651..2366d15d2ae 100644
--- a/pkgtools/pkg_rolling-replace/Makefile
+++ b/pkgtools/pkg_rolling-replace/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.18 2008/03/31 11:41:09 gdt Exp $
+# $NetBSD: Makefile,v 1.19 2008/05/02 19:04:03 apb Exp $
-DISTNAME= pkg_rolling-replace-0.15
+DISTNAME= pkg_rolling-replace-0.16
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
@@ -30,10 +30,16 @@ SUBST_MESSAGE.tools= Substituting tool locations.
SUBST_FILES.tools= pkg_rolling-replace.sh
SUBST_VARS.tools= PKG_INFO_CMD MAKE PKG_CHK AWK
+SUBST_CLASSES+= prefix
+SUBST_STAGE.prefix= pre-configure
+SUBST_MESSAGE.prefix= Substituting PREFIX location.
+SUBST_FILES.prefix= pkg_rolling-replace.8
+SUBST_VARS.prefix= PREFIX
+
SUBST_CLASSES+= makeconf
SUBST_STAGE.makeconf= pre-configure
SUBST_MESSAGE.makeconf= Recording default path of mk.conf.
-SUBST_FILES.makeconf= pkg_rolling-replace.sh
+SUBST_FILES.makeconf= pkg_rolling-replace.sh pkg_rolling-replace.8
SUBST_SED.makeconf= -e 's,@MAKECONF@,${MAKE:T:Mbmake:S/bmake/${PREFIX}/g}/etc/mk.conf,g'
REPLACE_SH+= pkg_rolling-replace.sh
@@ -43,11 +49,12 @@ REPLACE_SH+= pkg_rolling-replace.sh
# target exists only to force check-pkgsrc-patch prior to install
do-extract: check-pkgsrc-patch
cp ${FILESDIR}/pkg_rolling-replace.sh ${WRKSRC}
+ cp ${FILESDIR}/pkg_rolling-replace.8 ${WRKSRC}
do-install: check-pkgsrc-patch
${INSTALL_SCRIPT} ${WRKSRC}/pkg_rolling-replace.sh \
${PREFIX}/sbin/pkg_rolling-replace
- ${INSTALL_MAN} ${FILESDIR}/pkg_rolling-replace.8 \
+ ${INSTALL_MAN} ${WRKSRC}/pkg_rolling-replace.8 \
${PREFIX}/${PKGMANDIR}/man8/pkg_rolling-replace.8
check-pkgsrc-patch:
diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8 b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
index b2cdab04a08..0b817ce4821 100644
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.8
@@ -1,5 +1,5 @@
-.\" $NetBSD: pkg_rolling-replace.8,v 1.10 2008/03/11 01:53:05 tnn Exp $
-.Dd March 11, 2008
+.\" $NetBSD: pkg_rolling-replace.8,v 1.11 2008/05/02 19:04:03 apb Exp $
+.Dd May 2, 2008
.Dt PKG_ROLLING-REPLACE 8
.Os
.Sh NAME
@@ -113,12 +113,14 @@ from being rebuilt for any reason.
.El
.Sh EXAMPLES
.Pp
-To update all packages on the system and ensure correct shared library dependencies:
+To update all packages on the system and ensure correct shared library
+dependencies:
.Bd -literal -offset indent
pkg_rolling-replace -rsuv
.Ed
.Pp
-To update all packages on the system, do as little rebuilding as possible, and also produce binary packages:
+To update all packages on the system, do as little rebuilding as possible,
+and also produce binary packages:
.Bd -literal -offset indent
pkg_rolling-replace -uv
.Ed
@@ -136,15 +138,19 @@ uses the following environment variables.
Path to
.Pa mk.conf .
Defaults to
-.Pa /etc/mk.conf
+.Pa @MAKECONF@ , @PREFIX@/etc/mk.conf ,
or
-.Pa ${PREFIX}/etc/mk.conf
-(if using bmake).
+.Pa /etc/mk.conf .
.It Ev PKGSRCDIR
Base of pkgsrc tree.
-Defaults to value configured in MAKECONF or
+If not set in the environment, then this variable is read from
+.Pa ${MAKECONF} .
+If it is still not set, and if the current working directory
+appears to be inside a pkgsrc tree, then this variable
+is set to the base of that pkgsrc tree.
+Finally, if
.Pa /usr/pkgsrc
-if unset.
+appears to contain a pkgsrc tree, then that is used as a last resort.
.It Ev PKG_DBDIR
pkgsrc database directory.
If not set in environment then defaults to
diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
index 8b1bb070541..9eb6fce5530 100755
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# $NetBSD: pkg_rolling-replace.sh,v 1.18 2008/03/31 11:41:09 gdt Exp $
+# $NetBSD: pkg_rolling-replace.sh,v 1.19 2008/05/02 19:04:03 apb Exp $
#<license>
# Copyright (c) 2006 BBN Technologies Corp. All rights reserved.
#
@@ -65,14 +65,37 @@
MAKE="@MAKE@"
AWK="@AWK@"
-test -z "$MAKECONF" && MAKECONF="@MAKECONF@"
+if [ -z "$MAKECONF" ] ; then
+ for mkconf in "@MAKECONF@" "@PREFIX@/etc/mk.conf" /etc/mk.conf ; do
+ if [ -f "$mkconf" ] ; then
+ MAKECONF="$mkconf"
+ break
+ fi
+ done
+fi
+if [ -z "$MAKECONF" -o ! -f "$MAKECONF" ] ; then
+ MAKECONF=/dev/null
+fi
test -f "$MAKECONF" && test -z "$PKGSRCDIR" && PKGSRCDIR="` \
printf '.include "%s"\n_print_pkgsrcdir:\n\t@echo "${PKGSRCDIR}"\n' \
"$MAKECONF" | "$MAKE" -f - BSD_PKG_MK=1 _print_pkgsrcdir`"
-test -z "$PKGSRCDIR" && PKGSRCDIR=/usr/pkgsrc
+if [ -z "$PKGSRCDIR" ] ; then
+ for dir in . .. ../.. /usr/pkgsrc ; do
+ if [ -f "${dir}/mk/bsd.pkg.mk" ]; then
+ case "${dir}" in
+ /*) PKGSRCDIR="${dir}" ;;
+ *) PKGSRCDIR="$( cd "${dir}" >/dev/null 2>&1 && pwd )" ;;
+ esac
+ break
+ fi
+ done
+fi
+test -z "$PKGSRCDIR" && echo >&2 "Please set PKGSRCDIR" && exit 1
test -z "$PKG_CHK" && PKG_CHK="@PKG_CHK@"
test -z "$PKG_INFO" && PKG_INFO="@PKG_INFO_CMD@"
+export PKGSRCDIR
+
unset PKG_PATH || true #or pkgsrc makefiles will complain
usage()