Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Feb 2008 13:46:26 -0500
From:      Wesley Shields <wxs@FreeBSD.org>
To:        ports@FreeBSD.org
Subject:   Collecting pkg-message files?
Message-ID:  <20080211184626.GH90004@atarininja.org>

next in thread | raw e-mail | index | archive | help

--yudcn1FV7Hsu/q59
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

One of the things that often trips up new users is the fact that
pkg-message files scroll past their buffers when installing something
via ports.  As such, they sometimes miss important post-installation
steps which need to be taken in order to finish the install.  I've
attached a patch I've come up with to collect all the pkg-message files
during an install and display them at the end.

In order to not be in violation of POLA I only collect the messages and
display them if SHOW_ALL_PKG_MSGS is defined.  This way it won't get in
the way of any automated tools, and in some cases it may reduce the
complexity of those tools if they provide native support for this.

I've barely tested this, but I'm due to get a new laptop in a few weeks
and plan to run this patch while I'm building and installing everything
I normally use.  I'm curious if there is anyone else out there willing
to test this out before I submit a PR for it once it proves stable
during my new laptop install.  Please let me know what you think and if
you run into any problems with it.

-- WXS

PS: I'm hoping to have time in a week or two to hack out similar
functionality for pkg_add(1).

--yudcn1FV7Hsu/q59
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="show-all-pkg-messages.diff"

Index: bsd.commands.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.commands.mk,v
retrieving revision 1.1
diff -u -u -r1.1 bsd.commands.mk
--- bsd.commands.mk	4 Aug 2007 11:37:23 -0000	1.1
+++ bsd.commands.mk	9 Feb 2008 00:08:31 -0000
@@ -64,6 +64,7 @@
 MV?=		/bin/mv
 OBJCOPY?=	/usr/bin/objcopy
 OBJDUMP?=	/usr/bin/objdump
+PAGER?=		/usr/bin/less
 PASTE?=		/usr/bin/paste
 PAX?=		/bin/pax
 PRINTF?=	/usr/bin/printf
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.589
diff -u -u -r1.589 bsd.port.mk
--- bsd.port.mk	17 Oct 2007 10:12:24 -0000	1.589
+++ bsd.port.mk	9 Feb 2008 00:08:32 -0000
@@ -2313,6 +2313,7 @@
 PKGMESSAGE?=	${PKGDIR}/pkg-message
 
 TMPPLIST?=	${WRKDIR}/.PLIST.mktmp
+ALLPKGMSGS?=	${WRKDIR}/all-pkg-messages
 
 .for _CATEGORY in ${CATEGORIES}
 PKGCATEGORY?=	${_CATEGORY}
@@ -3933,6 +3934,19 @@
 .endif
 .endif
 
+.if !target(collect-pkg-message)
+collect-pkg-message:
+.if defined(SHOW_ALL_PKG_MSGS)
+.if exists(${PKGMESSAGE})
+	@${ECHO_MSG} "===>   Collecting pkg-message for later display."
+	@${ECHO_CMD} "pkg-message for ${PKGNAME}:" >> ${ALLPKGMSGS}
+	@${CAT} ${PKGMESSAGE} >> ${ALLPKGMSGS}
+.endif
+.else
+	@${DO_NADA}
+.endif
+.endif
+
 .if !target(security-check)
 .if !defined(OLD_SECURITY_CHECK)
 
@@ -4109,7 +4123,8 @@
 _INSTALL_DEP=	build
 _INSTALL_SEQ=	install-message check-conflicts \
 				run-depends lib-depends apply-slist pre-install \
-				pre-install-script generate-plist check-already-installed
+				pre-install-script generate-plist check-already-installed \
+				collect-pkg-message
 _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \
 				pre-su-install-script do-install install-desktop-entries \
 				post-install post-install-script add-plist-info \
@@ -4817,15 +4832,15 @@
 			dir=`${ECHO_CMD} $$dir | ${SED} -e 's/:.*//'`; \
 			if [ X${DEPENDS_PRECLEAN} != "X" ]; then \
 				target="clean $$target"; \
-				depends_args="$$depends_args NOCLEANDEPENDS=yes"; \
+				depends_args="$$depends_args NOCLEANDEPENDS=yes ALLPKGMSGS=${ALLPKGMSGS}"; \
 			fi; \
 			if [ X${DEPENDS_CLEAN} != "X" ]; then \
 				target="$$target clean"; \
-				depends_args="$$depends_args NOCLEANDEPENDS=yes"; \
+				depends_args="$$depends_args NOCLEANDEPENDS=yes ALLPKGMSGS=${ALLPKGMSGS}"; \
 			fi; \
 		else \
 			target="${DEPENDS_TARGET}"; \
-			depends_args="${DEPENDS_ARGS}"; \
+			depends_args="${DEPENDS_ARGS} ALLPKGMSGS=${ALLPKGMSGS}"; \
 		fi; \
 		if ${EXPR} "$$prog" : \\/ >/dev/null; then \
 			if [ -e "$$prog" ]; then \
@@ -5750,6 +5765,11 @@
 .else
 	@${DO_NADA}
 .endif
+.if defined(SHOW_ALL_PKG_MSGS)
+	@if [ ${WRKDIR} = `dirname ${ALLPKGMSGS}` ]; then \
+		${PAGER} ${ALLPKGMSGS}; \
+	fi;
+.endif
 .endif
 
 # Depend is generally meaningless for arbitrary ports, but if someone wants

--yudcn1FV7Hsu/q59--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080211184626.GH90004>