Subject: pkgtools diffs
To: None <tech-pkg@netbsd.org>
From: Alistair Crooks <azcb0@amdahl.com>
List: tech-pkg
Date: 08/26/1998 03:48:13
I'd like some feedback on the following diff to bsd.pkg.mk, and the new
pkgtools category, and pkg_install package.

The idea of the pkg_install package is that -current pkg_* tools will
get installed in ${LOCALBASE}/sbin, and will be used in preference to
the existing ones in /usr/sbin, should the /usr/sbin/pkg_* be out of
date.  The diffs to bsd.pkg.mk simply do an automatic check of the
version of the pkg_* tools in /usr/sbin (and those in
${LOCALBASE}/sbin, should they exist), and will install new versions
if necessary.

I've tried it out on this box here, but other people have different
setups, and I'd like feedback from those who are on standalone boxes,
etc.  I'm also a bit concerned about having two pkg_delete (for
example) binaries on one system, and the choice of which one is used
depending on order of directories in your path.

Any comments of the form "but it's not what we do at the moment" will
be ignored.  For those of you trying to define the direction we're
travelling, or for management and admin types out there, these mods
take the pain out of supporting older versions of pkg_* tools.


Take care,
Alistair


# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	bsd.pkg.mk-diff
#	pkgtools/pkg/COMMENT
#	pkgtools/Makefile
#	pkgtools/pkg_install/files/md5
#	pkgtools/pkg_install/pkg/COMMENT
#	pkgtools/pkg_install/pkg/DESCR
#	pkgtools/pkg_install/pkg/PLIST
#	pkgtools/pkg_install/Makefile
#
echo x - bsd.pkg.mk-diff
sed 's/^X//' >bsd.pkg.mk-diff << 'END-of-bsd.pkg.mk-diff'
XIndex: mk/bsd.pkg.mk
X===================================================================
XRCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
Xretrieving revision 1.148
Xdiff -u -r1.148 bsd.pkg.mk
X+++ mk/bsd.pkg.mk	1998/08/26 10:36:40
X@@ -184,6 +184,32 @@
X MAKEFILE?=		Makefile
X MAKE_ENV+=		PATH=${PATH}:${LOCALBASE}/bin:${X11BASE}/bin PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} MOTIFLIB="${MOTIFLIB}" CFLAGS="${CFLAGS}"
X 
X+# Latest version of pkgtools required
X+# (actually time of last update to -current pkg_install tools)
X+_PKGTOOLS_REQD=		19980712
X+
X+_BUILD_NEW_PKGTOOLS=	no
X+
X+PKGNAME?=		${DISTNAME}
X+
X+.if !defined(_PKGTOOLS_VER) && ${PKGNAME} != "pkg_install-1.4"
X+_PKGTOOLS_VER!= /usr/bin/strings /usr/sbin/pkg_* | /usr/bin/grep '\$$NetBSD' | /usr/bin/awk '{ print $$4 }' | /usr/bin/sed -e 's|/||g' | sort | tail -n 1
X+.if ${_PKGTOOLS_VER} >= ${_PKGTOOLS_REQD}
X+_PKGTOOLS_DIR=		/usr/sbin
X+.else
X+_PKGTOOLS_DIR=		${LOCALBASE}/sbin
X+.if exists(${LOCALBASE}/sbin/pkg_info)
X+_PKGTOOLS_VER!= /usr/bin/strings ${LOCALBASE}/sbin/pkg_* | /usr/bin/grep '\$$NetBSD' | /usr/bin/awk '{ print $$4 }' | /usr/bin/sed -e 's|/||g' | sort | tail -n 1
X+.if ${_PKGTOOLS_VER} < ${_PKGTOOLS_REQD}
X+_BUILD_NEW_PKGTOOLS=	yes
X+.endif # ${LOCALBASE}/sbin/pkg_info out of date
X+.else
X+_BUILD_NEW_PKGTOOLS=	yes
X+.endif # exists(${LOCALBASE}/sbin/pkg_info)
X+.endif # /usr/sbin/pkg_info
X+.endif # !defined _PKGTOOLS_VER
X+
X+
X .if exists(/usr/bin/fetch)
X FETCH_CMD?=		/usr/bin/fetch
X .else
X@@ -329,7 +355,7 @@
X DESCR?=		${PKGDIR}/DESCR
X PLIST=		${WRKDIR}/.PLIST
X 
X-PKG_CMD?=		/usr/sbin/pkg_create
X+PKG_CMD?=		${_PKGTOOLS_DIR}/pkg_create
X .if !defined(PKG_ARGS)
X PKG_ARGS=		-v -c ${COMMENT} -d ${DESCR} -f ${PLIST} -p ${PREFIX} -P "`${MAKE} package-depends|sort -u`"
X .if defined(CONFLICTS)
X@@ -467,7 +493,6 @@
X 
X # Derived names so that they're easily overridable.
X DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
X-PKGNAME?=		${DISTNAME}
X 
X MAINTAINER?=		packages@netbsd.org
X 
X@@ -1190,8 +1215,18 @@
X # call the necessary targets/scripts.
X ################################################################
X 
X+.if !target(pkg-tools)
X+pkg-tools:
X+.if ${_BUILD_NEW_PKGTOOLS} == "yes"
X+	@${ECHO} "===> Building new package tools"
X+	@cd ${.CURDIR}/../../pkgtools/pkg_install; ${MAKE} install
X+.else
X+	@${DO_NADA}
X+.endif # _BUILD_NEW_PKGTOOLS
X+.endif # !pkg-tools
X+
X .if !target(fetch)
X+fetch: pkg-tools
X 	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
X .endif
X 
X@@ -1291,9 +1326,9 @@
X deinstall:
X 	@${ECHO_MSG} "===> Deinstalling for ${PKGNAME}"
X .ifdef PKG_VERBOSE
X-	@pkg_delete -v -f ${PKGNAME}
X+	@${_PKGTOOLS_DIR}/pkg_delete -v -f ${PKGNAME}
X .else
X-	@pkg_delete -f ${PKGNAME}
X+	@${_PKGTOOLS_DIR}/pkg_delete -f ${PKGNAME}
X .endif
X 	@${RM} -f ${INSTALL_COOKIE} ${PACKAGE_COOKIE}
X .endif
END-of-bsd.pkg.mk-diff
echo x - pkgtools/pkg/COMMENT
sed 's/^X//' >pkgtools/pkg/COMMENT << 'END-of-pkgtools/pkg/COMMENT'
Xtools used in the packages collection itself.
END-of-pkgtools/pkg/COMMENT
echo x - pkgtools/Makefile
sed 's/^X//' >pkgtools/Makefile << 'END-of-pkgtools/Makefile'
X# $NetBSD$
X#
X
XSUBDIR += pkg_install
X
X.include "../mk/bsd.pkg.subdir.mk"
END-of-pkgtools/Makefile
echo x - pkgtools/pkg_install/files/md5
sed 's/^X//' >pkgtools/pkg_install/files/md5 << 'END-of-pkgtools/pkg_install/files/md5'
X$NetBSD$
X
XMD5 (pkg_install.tar) = 110c240c57c54a2f4340193b9e38c0dd
END-of-pkgtools/pkg_install/files/md5
echo x - pkgtools/pkg_install/pkg/COMMENT
sed 's/^X//' >pkgtools/pkg_install/pkg/COMMENT << 'END-of-pkgtools/pkg_install/pkg/COMMENT'
XNetBSD-current's pkg_* tools
END-of-pkgtools/pkg_install/pkg/COMMENT
echo x - pkgtools/pkg_install/pkg/DESCR
sed 's/^X//' >pkgtools/pkg_install/pkg/DESCR << 'END-of-pkgtools/pkg_install/pkg/DESCR'
XThis is a copy of NetBSD-current's pkg_* tools, taken from the ftp
Xserver, and able to be installed as a package.  They do not replace
Xthe tools in /usr/sbin - however if the tools in /usr/sbin are not
Xcurrent enough, the -current tools can be used by installing this
Xpackage.
END-of-pkgtools/pkg_install/pkg/DESCR
echo x - pkgtools/pkg_install/pkg/PLIST
sed 's/^X//' >pkgtools/pkg_install/pkg/PLIST << 'END-of-pkgtools/pkg_install/pkg/PLIST'
X@comment $NetBSD$
Xsbin/pkg_add
Xsbin/pkg_create
Xsbin/pkg_delete
Xsbin/pkg_info
Xman/cat1/pkg_add.0
Xman/cat1/pkg_create.0
Xman/cat1/pkg_delete.0
Xman/cat1/pkg_info.0
Xman/man1/pkg_add.1
Xman/man1/pkg_create.1
Xman/man1/pkg_delete.1
Xman/man1/pkg_info.1
END-of-pkgtools/pkg_install/pkg/PLIST
echo x - pkgtools/pkg_install/Makefile
sed 's/^X//' >pkgtools/pkg_install/Makefile << 'END-of-pkgtools/pkg_install/Makefile'
X# $NetBSD$
X#
X
XDISTNAME=	pkg_install
XPKGNAME=	pkg_install-1.4
XCATEGORIES=	pkgtools
XMASTER_SITES=	ftp://ftp.netbsd.org/pub/NetBSD-current/src/usr.sbin/
XEXTRACT_SUFX=	.tar
X
XMAINTAINER=	packages@netbsd.org
XHOMEPAGE=	http://www.netbsd.org/
X
XWRKSRC=		${WRKDIR}/pub/NetBSD-current/src/usr.sbin/pkg_install
XEXTRACT_BEFORE_ARGS=	-xf
XMAKE_ENV+=	BINDIR=${PREFIX}/sbin MANDIR=${PREFIX}/man
X
X.include "../../mk/bsd.prefs.mk"
X
X.ifdef MANZ
XMANCOMPRESSED=	yes
X.endif
X
X.include "../../mk/bsd.pkg.mk"
END-of-pkgtools/pkg_install/Makefile
exit