Subject: idea of package update
To: None <tech-pkg@netbsd.org>
From: Kazuki Sakamoto <sakamoto@cec.co.jp>
List: tech-pkg
Date: 06/24/1999 21:11:00
Hi,
I wrote a mechanism of update package for bsd.pkg.mk.
this is trial code, and don't acually do.
For example,
% cd /usr/pkgsrc/graphics/jpeg
% make update
/usr/pkgsrc/x11/gnome-core deinstall
/usr/pkgsrc/x11/gnome-libs deinstall
/usr/pkgsrc/graphics/imlib deinstall
/usr/pkgsrc/graphics/netpbm deinstall
/usr/pkgsrc/x11/kde deinstall
/usr/pkgsrc/misc/kdeutils deinstall
/usr/pkgsrc/net/kdenetwork deinstall
/usr/pkgsrc/graphics/kdegraphics deinstall
/usr/pkgsrc/games/kdegames deinstall
/usr/pkgsrc/x11/kdebase deinstall
/usr/pkgsrc/x11/kdelibs deinstall
/usr/pkgsrc/graphics/gimp deinstall
/usr/pkgsrc/graphics/tiff deinstall
/usr/pkgsrc/graphics/py-imaging deinstall
/usr/pkgsrc/graphics/jpeg deinstall
/usr/pkgsrc/graphics/jpeg install
/usr/pkgsrc/graphics/py-imaging install
/usr/pkgsrc/graphics/tiff install
/usr/pkgsrc/graphics/gimp install
/usr/pkgsrc/x11/kdelibs install
/usr/pkgsrc/x11/kdebase install
/usr/pkgsrc/games/kdegames install
/usr/pkgsrc/graphics/kdegraphics install
/usr/pkgsrc/net/kdenetwork install
/usr/pkgsrc/misc/kdeutils install
/usr/pkgsrc/x11/kde install
/usr/pkgsrc/graphics/netpbm install
/usr/pkgsrc/graphics/imlib install
/usr/pkgsrc/x11/gnome-libs install
/usr/pkgsrc/x11/gnome-core install
Kazuki Sakamoto
--
.if !target(update)
update:
${_PKG_SILENT}${_PKG_DEBUG} \
if [ "${FROM}" = "" ]; then \
${RM} -f /tmp/.pkg_update; \
${TOUCH} /tmp/.pkg_update; \
fi; \
found="`${PKG_INFO} -e \"${PKGNAME:C/-[^-]*$/-[0-9]*/}\" || ${TRUE}`"; \
if [ "$$found" != "" ]; then \
required="`${PKG_INFO} -R \"$$found\"|${AWK} '{if (i > 0){print $1} if(/Required by:/){i++}}'|${TR} '\\n' ' '`"; \
if [ "$$required" != "" ]; then \
for pkg in $$required; do \
dir="`${PKG_INFO} -b \"$$pkg\"|${GREP} Makefile|head -n 1|${AWK} -F/ '{print \"../../\"$$1\"/\"$$2}'`"; \
if [ -d $$dir ] ; then \
(cd $$dir; ${MAKE} update FROM=${.CURDIR}); \
fi; \
done; \
fi; \
fi; \
cleaned="`${GREP} \"${.CURDIR}\" /tmp/.pkg_update || ${TRUE}`"; \
if [ "$$cleaned" = "" ]; then \
${ECHO} "${.CURDIR}" >> /tmp/.pkg_update; \
${ECHO} "${.CURDIR} deinstall"; \
fi; \
if [ "${FROM}" = "" ]; then \
reinstpkg="`${TAIL} -r /tmp/.pkg_update|${TR} '\\n' ' '`"; \
for dir in $$reinstpkg; do \
(cd $$dir; ${ECHO} $$dir install); \
done; \
fi;
.endif