The ObsoleteFiles removal/test targets
	  - check-old
	  - delete-old
	  - delete-old-libs
	and the corresponding docs.

Note:	Someone may want to have a look at the man-page and perhaps MFC
	some other parts (unrelated to ObsoleteFiles).

Tested by:	bz
This commit is contained in:
netchild 2006-01-07 19:40:08 +00:00
parent f62c4a36d2
commit ace655aecb
5 changed files with 156 additions and 24 deletions

View File

@ -16,6 +16,9 @@
# reinstallkernel.debug
# kernel - buildkernel + installkernel.
# update - Convenient way to update your source tree (cvs).
# check-old - Print a list of old files/directories in the system.
# delete-old - Delete obsolete files and directories interactively.
# delete-old-libs - Delete obsolete libraries interactively.
#
# This makefile is simple by design. The FreeBSD make automatically reads
# the /usr/share/mk/sys.mk unless the -m argument is specified on the
@ -38,15 +41,17 @@
# For individuals wanting to upgrade their sources (even if only a
# delta of a few days):
#
# 1. `cd /usr/src' (or to the directory containing your source tree).
# 2. `make buildworld'
# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
# 6. `mergemaster -p'
# 7. `make installworld'
# 8. `mergemaster'
# 9. `reboot'
# 1. `cd /usr/src' (or to the directory containing your source tree).
# 2. `make buildworld'
# 3. `make buildkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 4. `make installkernel KERNCONF=YOUR_KERNEL_HERE' (default is GENERIC).
# 5. `reboot' (in single user mode: boot -s from the loader prompt).
# 6. `mergemaster -p'
# 7. `make installworld'
# 8. `make delete-old'
# 9. `mergemaster'
# 10. `reboot'
# 11. `make delete-old-libs' (in case no 3rd party program uses them anymore)
#
# See src/UPDATING `COMMON ITEMS' for more complete information.
#
@ -62,9 +67,9 @@
# developer convenience only. They are intentionally not documented and
# completely subject to change without notice.
#
TGTS= all all-man buildenv buildkernel buildworld checkdpadd clean \
cleandepend cleandir depend distribute distributeworld \
distrib-dirs distribution everything \
TGTS= all all-man buildenv buildkernel buildworld check-old checkdpadd \
clean cleandepend cleandir delete-old delete-old-libs depend \
distribute distributeworld distrib-dirs distribution everything \
hierarchy install installcheck installkernel installkernel.debug\
reinstallkernel reinstallkernel.debug installworld \
kernel-toolchain libraries lint maninstall \

View File

@ -1059,3 +1059,102 @@ par-${__target}: ${SUBDIR:S/$/.${__target}__D/}
.endfor
.include <bsd.subdir.mk>
.if make(delete-old) || make(delete-old-libs) || make(check-old)
#
# check for / delete old files section
#
.include "ObsoleteFiles.inc"
OLD_LIBS_MESSAGE="Please be sure no application still uses those libraries, \
else you can not start such an application. Consult UPDATING for more \
information regarding how to cope with the removal/revision bump of a \
specific library."
.if !defined(BATCH_DELETE_OLD_FILES)
RM_I=-i
.else
RM_I=-v
.endif
delete-old-files:
@echo ">>> Removing old files (only deletes safe to delete libs)"
.for file in ${OLD_FILES}
# Ask for every old file if the user really wants to remove it.
# It's annoying, but better safe than sorry.
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
|| ([ -f "${DESTDIR}/${file}" ] \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \
&& chflags noschg "${DESTDIR}/${file}" \
&& rm ${RM_I} "${DESTDIR}/${file}"))
.endfor
# Remove catpages without corresponding manpages.
@3<&0; \
find ${DESTDIR}/usr/share/man/cat* ! -type d | \
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
while read catpage; do \
read manpage; \
if [ ! -e "$${manpage}" ]; then \
rm ${RM_I} $${catpage} <&3 ; \
fi; \
done
@echo ">>> Old files removed"
check-old-files:
@echo ">>> Checking for old files"
.for file in ${OLD_FILES}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
.endfor
# Check for catpages without corresponding manpages.
@find ${DESTDIR}/usr/share/man/cat* ! -type d | \
sed -ep -e's:${DESTDIR}/usr/share/man/cat:${DESTDIR}/usr/share/man/man:' | \
while read catpage; do \
read manpage; \
if [ ! -e "$${manpage}" ]; then \
echo $${catpage} ; \
fi; \
done
delete-old-libs:
@echo ">>> Removing old libraries"
@echo "${OLD_LIBS_MESSAGE}" | fmt
.for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || (rm ${RM_I} "${DESTDIR}/${file}" \
|| ([ -f "${DESTDIR}/${file}" ] \
&& echo "Removing schg flag on ${DESTDIR}/${file}" \
&& chflags noschg "${DESTDIR}/${file}" \
&& rm ${RM_I} "${DESTDIR}/${file}"))
.endfor
@echo ">>> Old libraries removed"
check-old-libs:
@echo ">>> Checking for old libraries"
.for file in ${OLD_LIBS}
@[ ! -f "${DESTDIR}/${file}" ] || echo "${DESTDIR}/${file}"
.endfor
delete-old-dirs:
@echo ">>> Removing old directories"
.for dir in ${OLD_DIRS}
# Don't fail if an old directory isn't empty.
@[ ! -d "${DESTDIR}/${dir}" ] || (rmdir -v "${DESTDIR}/${dir}" || true)
.endfor
@echo ">>> Old directories removed"
check-old-dirs:
@echo ">>> Checking for old directories"
.for dir in ${OLD_DIRS}
@[ ! -d "${DESTDIR}/${dir}" ] || echo "${DESTDIR}/${dir}"
.endfor
delete-old: delete-old-files delete-old-dirs
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
check-old: check-old-files check-old-libs check-old-dirs
@echo "To remove old files and directories run '${MAKE} delete-old'."
@echo "To remove old libraries run '${MAKE} delete-old-libs'."
.endif

View File

@ -16,17 +16,8 @@
# 20051215: rescue/nextboot.sh renamed to rescue/nextboot
OLD_FILES+=rescue/nextboot.sh
# 20051214: usbd(8) removed
OLD_FILES+=etc/rc.d/usbd
OLD_FILES+=etc/usbd.conf
OLD_FILES+=usr/sbin/usbd
OLD_FILES+=usr/share/man/man8/usbd.8.gz
# 20051029: rc.d/ppp-user renamed to rc.d/ppp for convenience
OLD_FILES+=etc/rc.d/ppp-user
# 20051012: setkey(8) moved to /sbin/
OLD_FILES+=usr/sbin/setkey
# 20050927: bridge(4) replaced by if_bridge(4)
OLD_FILES+=usr/include/net/bridge.h
# 20050831: not implemented
OLD_FILES+=usr/share/man/man3/getino.3.gz
OLD_FILES+=usr/share/man/man3/putino.3.gz
@ -2589,8 +2580,6 @@ OLD_FILES+=usr/share/games/quiz.db/ucc
OLD_FILES+=usr/share/games/cribbage.instr
OLD_FILES+=usr/share/games/fish.instr
OLD_FILES+=usr/share/games/wump.info
OLD_FILES+=usr/share/tmac/mm/locale
OLD_FILES+=usr/share/tmac/mm/se_locale
OLD_FILES+=usr/games/hide/adventure
OLD_FILES+=usr/games/hide/arithmetic
OLD_FILES+=usr/games/hide/atc

View File

@ -302,6 +302,7 @@ COMMON ITEMS:
<reboot in single user> [3]
mergemaster -p [5]
make installworld
make delete-old
mergemaster [4]
<reboot>
@ -339,6 +340,7 @@ COMMON ITEMS:
<reboot in single user> [3]
mergemaster -p [5]
make installworld
make delete-old
mergemaster -i [4]
<reboot>

View File

@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd February 23, 2005
.Dd January 07, 2006
.Dt BUILD 7
.Os
.Sh NAME
@ -97,6 +97,43 @@ followed by
.Cm installkernel
.El
.Pp
Convenience targets for cleaning up the install destination directory
denoted by variable
.Va DESTDIR
include:
.Bl -tag -width ".Cm delete-old-libs"
.It Cm check-old
Print a list of old files and directores in the system.
.It Cm delete-old
Delete obsolete base system files and directories interactively.
When
.Li -DBATCH_DELETE_OLD_FILES
is specified at the command line, the delete operation will be
non-interactive.
The variables
.Va DESTDIR ,
.Va TARGET_ARCH
and
.Va TARGET
should be set as with
.Dq Li "make installworld" .
.It Cm delete-old-libs
Delete obsolete base system libraries interactively.
This target should only be used if no 3rd party software uses these
libraries.
When
.Li -DBATCH_DELETE_OLD_FILES
is specified at the command line, the delete operation will be
non-interactive.
The variables
.Va DESTDIR ,
.Va TARGET_ARCH
and
.Va TARGET
should be set as with
.Dq Li "make installworld" .
.El
.Pp
For more information about the ports build process, see
.Xr ports 7 .
.Sh ENVIRONMENT