Subject: Re: pkgselect
To: iMil <imil@home.imil.net>
From: Greg A. Woods <woods@weird.com>
List: tech-pkg
Date: 01/28/2005 18:34:50
[ On Friday, January 28, 2005 at 16:31:36 (+0100), iMil wrote: ]
> Subject: pkgselect
>
> as promised some days ago, here comes a first shot for my ncurses pkgsrc
> browser / manager.
> For now, it is capable of browsing the pkgsrc tree, interactively install
> / deinstall / upgrade packages and give some useful infos about it.
From what everyone else is saying, this sounds pretty cool.
FYI when I build my binary packakes I install the DESCR file into the
/var/packages/ hierarchy too so that my users can browse from the
available binary packages too (e.g. with a web browser via my FTP
site). Does your browser need anything more than the DESCR file?
How about the HOMEPAGE and COMMENT strings? I was thinking of
inserting them in the installed *-DESCR.txt files, and if that were done
in a predictable fashion then a package browser could extract that
information for use in summaries, etc.
Here are, I think, all the fragments of bsd.pkg.mk that set it up currently:
@@ -2492,11 +2702,13 @@
fi; \
fi; \
if ${PKG_CREATE} ${PKG_ARGS_BINPKG} ${PKGFILE}; then \
- ${MAKE} ${MAKEFLAGS} package-links; \
+ :; \
else \
${MAKE} ${MAKEFLAGS} delete-package; \
exit 1; \
fi
+ ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} package-links
+ ${INSTALL_DATA} ${DESCR} ${PKGREPOSITORY}/${PKGNAME}-DESCR.txt
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${PACKAGE_COOKIE}
. if defined(NO_BIN_ON_CDROM)
@${ECHO_MSG} "${_PKGSRC_IN}> Warning: ${PKGNAME} may not be put on a CD-ROM:"
@@ -2518,8 +2730,9 @@
.PHONY: package-links
.if !target(package-links)
package-links:
- ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} delete-package-links
- ${_PKG_SILENT}${_PKG_DEBUG}for cat in ${CATEGORIES}; do \
+ @${ECHO_MSG} "${_PKGSRC_IN}> Building binary links for package ${PKGNAME}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ for cat in ${CATEGORIES}; do \
if [ ! -d ${PACKAGES}/$$cat ]; then \
${MKDIR} ${PACKAGES}/$$cat; \
if [ $$? -ne 0 ]; then \
@@ -2535,17 +2748,31 @@
.PHONY: delete-package-links
.if !target(delete-package-links)
delete-package-links:
- ${_PKG_SILENT}${_PKG_DEBUG}\
- ${FIND} ${PACKAGES} -type l -name ${PKGNAME}${PKG_SUFX} -print | ${XARGS} ${RM} -f
+ @${ECHO_MSG} "${_PKGSRC_IN}> Deleting binary links for package ${PKGNAME}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${FIND} ${PACKAGES} -type l \( -name ${PKGNAME}${PKG_SUFX} -o \
+ -name ${PKGNAME}-DESCR.txt \
+ \) -print0 | ${XARGS} -0 ${RM} -f ""
+.endif
+
+.PHONY: delete-dead-package-links
+.if !target(delete-dead-package-links)
+delete-dead-package-links:
+ @${ECHO_MSG} "${_PKGSRC_IN}> Deleting old dead binary links for all packages in ${PACKAGES}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${FIND} ${PACKAGES} -type l -a ! \( -follow -type f \) -print0 | ${XARGS} -0 ${RM} -f ""
.endif
.PHONY: delete-package
.if !target(delete-package)
-delete-package:
- ${_PKG_SILENT}${_PKG_DEBUG}${MAKE} ${MAKEFLAGS} delete-package-links
- ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PKGFILE}
+delete-package: delete-package-links
+ @${ECHO_MSG} "${_PKGSRC_IN}> Deleting binary package for ${PKGNAME}"
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${RM} -f ${PKGFILE} ${PKGREPOSITORY}/${PKGNAME}-DESCR.txt
.endif
+# XXX conflicts should be tested _before_ doing the su!!!
+#
.PHONY: real-su-install
real-su-install: ${MESSAGE}
.if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) && \
@@ -5135,7 +5552,7 @@
@\
${ECHO} >>${DESCR} ; \
${ECHO} "Homepage:" >>${DESCR} ; \
- ${ECHO} '${HOMEPAGE}' >>${DESCR}
+ ${ECHO} '${HOMEPAGE}' >>${DESCR}
.endif
.include "../../mk/subst.mk"
(that last hunk just gets rid of unnecessary trailing whitespace)
--
Greg A. Woods
H:+1 416 218-0098 W:+1 416 489-5852 x122 VE3TCP RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com> Secrets of the Weird <woods@weird.com>