Put intermediate lists on the top of ${DESTDIR} (${DESTDIR}/SETS.*) and leave
them. Teach list generators to ignore them. Always generate metalog missing/extra lists too, but don't check it (for now). I'll change "flist" to be generated only when set lists have changed. No functional changes.
This commit is contained in:
parent
c3217052b6
commit
f22a6fb255
@ -1,6 +1,6 @@
|
||||
#! /bin/sh --
|
||||
#
|
||||
# $NetBSD: checkflist,v 1.41 2009/12/10 17:18:33 uebayasi Exp $
|
||||
# $NetBSD: checkflist,v 1.42 2009/12/11 11:48:41 uebayasi Exp $
|
||||
#
|
||||
# Verify output of makeflist against contents of ${DESTDIR} and ${metalog}.
|
||||
|
||||
@ -13,12 +13,29 @@ prog="${0##*/}"
|
||||
rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
|
||||
. "${rundir}/sets.subr"
|
||||
|
||||
SDIR="$(${MKTEMP} -d "/tmp/${prog}.XXXXXX")"
|
||||
#
|
||||
# * ${SETS_DLIST}: files present in DESTDIR.
|
||||
# * ${SETS_FLIST}: files mentioned in flist;
|
||||
# * ${SETS_MLIST}: files mentioned in metalog;
|
||||
#
|
||||
SETS_DLIST="${DESTDIR}/SETS.dlist"
|
||||
SETS_FLIST="${DESTDIR}/SETS.flist"
|
||||
SETS_MLIST="${DESTDIR}/SETS.mlist"
|
||||
|
||||
#
|
||||
# * ${SETS_METALOG_EXTRA}: Files in METALOG but missing from DESTDIR."
|
||||
# * ${SETS_METALOG_MISSING}: Files in DESTDIR but missing from METALOG."
|
||||
# * ${SETS_DESTDIR_EXTRA}: Files in DESTDIR but missing from setlist."
|
||||
# * ${SETS_DESTDIR_MISSING}: Files in setlist but missing from DESTDIR."
|
||||
#
|
||||
SETS_METALOG_EXTRA="${DESTDIR}/SETS.metalog.extra"
|
||||
SETS_METALOG_MISSING="${DESTDIR}/SETS.metalog.missing"
|
||||
SETS_DESTDIR_EXTRA="${DESTDIR}/SETS.destdir.extra"
|
||||
SETS_DESTDIR_MISSING="${DESTDIR}/SETS.destdir.missing"
|
||||
|
||||
es=0
|
||||
cleanup()
|
||||
{
|
||||
/bin/rm -rf "${SDIR}"
|
||||
if [ ${es} -gt 255 ]; then
|
||||
es=255
|
||||
fi
|
||||
@ -88,11 +105,13 @@ ignore_exceptions()
|
||||
{
|
||||
IGNORE_REGEXP_SYSPKG="^\./var/db/syspkg(\$|/)"
|
||||
IGNORE_REGEXP_METALOG="^\./METALOG(\..*)?\$"
|
||||
IGNORE_REGEXP_SETS="^\./SETS\..*\$"
|
||||
IGNORE_REGEXP_MTREE="^\./etc/mtree/set\.[a-z]*\$"
|
||||
|
||||
${EGREP} -v \
|
||||
-e "${IGNORE_REGEXP_SYSPKG}" \
|
||||
-e "${IGNORE_REGEXP_METALOG}" \
|
||||
-e "${IGNORE_REGEXP_SETS}" \
|
||||
-e "${IGNORE_REGEXP_MTREE}"
|
||||
}
|
||||
|
||||
@ -102,52 +121,49 @@ IGNORE_REGEXP_MTREE="^\./etc/mtree/set\.[a-z]*\$"
|
||||
|
||||
#
|
||||
# Make three lists:
|
||||
# * ${SDIR}/files: files present in DESTDIR.
|
||||
# * ${SDIR}/flist: files mentioned in flist;
|
||||
# * ${SDIR}/mlist: files mentioned in metalog;
|
||||
#
|
||||
# All three lists are filtered against ${IGNORE_REGEXP}.
|
||||
#
|
||||
|
||||
generate_files()
|
||||
generate_dlist()
|
||||
{
|
||||
( cd "${DESTDIR}" && ${FIND} ${origin} \
|
||||
\( -type d -o -type f -o -type l \) -print ) \
|
||||
| ${SORT} -u | ignore_exceptions >"${SDIR}/files"
|
||||
| ${SORT} -u | ignore_exceptions >"${SETS_DLIST}"
|
||||
}
|
||||
|
||||
generate_flist()
|
||||
{
|
||||
${HOST_SH} "${rundir}/makeflist" ${xargs} ${dargs} \
|
||||
| ${SORT} -u | ignore_exceptions >"${SDIR}/flist"
|
||||
| ${SORT} -u | ignore_exceptions >"${SETS_FLIST}"
|
||||
}
|
||||
|
||||
generate_mlist()
|
||||
{
|
||||
if [ -n "${metalog}" ]; then
|
||||
${AWK} '{print $1}' <"${metalog}" \
|
||||
| ${SORT} -u | ignore_exceptions >"${SDIR}/mlist"
|
||||
| ${SORT} -u | ignore_exceptions >"${SETS_MLIST}"
|
||||
fi
|
||||
}
|
||||
|
||||
generate_mlist_missing()
|
||||
{
|
||||
${COMM} -23 "${SDIR}/files" "${SDIR}/mlist" > "${SDIR}/missing"
|
||||
${COMM} -23 "${SETS_DLIST}" "${SETS_MLIST}" > "${SETS_METALOG_MISSING}"
|
||||
}
|
||||
|
||||
generate_mlist_extra()
|
||||
{
|
||||
${COMM} -13 "${SDIR}/files" "${SDIR}/mlist" > "${SDIR}/extra"
|
||||
${COMM} -13 "${SETS_DLIST}" "${SETS_MLIST}" > "${SETS_METALOG_EXTRA}"
|
||||
}
|
||||
|
||||
generate_files_missing()
|
||||
generate_dlist_missing()
|
||||
{
|
||||
${COMM} -23 "${SDIR}/flist" "${SDIR}/files" > "${SDIR}/missing"
|
||||
${COMM} -23 "${SETS_FLIST}" "${SETS_DLIST}" > "${SETS_DESTDIR_MISSING}"
|
||||
}
|
||||
|
||||
generate_files_extra()
|
||||
generate_dlist_extra()
|
||||
{
|
||||
${COMM} -13 "${SDIR}/flist" "${SDIR}/files" > "${SDIR}/extra"
|
||||
${COMM} -13 "${SETS_FLIST}" "${SETS_DLIST}" > "${SETS_DESTDIR_EXTRA}"
|
||||
}
|
||||
|
||||
exist_case_insensitive()
|
||||
@ -166,8 +182,9 @@ exist_case_insensitive()
|
||||
compare_metalog()
|
||||
{
|
||||
# Handle case insensitive filesystems
|
||||
mv -f "${SDIR}/extra" "${SDIR}/extra.all"
|
||||
exist_case_insensitive < "${SDIR}/extra.all" > "${SDIR}/extra"
|
||||
mv -f "${SETS_METALOG_EXTRA}" "${SETS_METALOG_EXTRA}.all"
|
||||
exist_case_insensitive < "${SETS_METALOG_EXTRA}.all" > "${SETS_METALOG_EXTRA}"
|
||||
rm -f "${SETS_METALOG_EXTRA}.all"
|
||||
|
||||
check_metalog_extra
|
||||
check_metalog_missing
|
||||
@ -175,14 +192,14 @@ compare_metalog()
|
||||
|
||||
check_metalog_extra()
|
||||
{
|
||||
if [ -s "${SDIR}/extra" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SDIR}/extra")"
|
||||
if [ -s "${SETS_METALOG_EXTRA}" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SETS_METALOG_EXTRA}")"
|
||||
echo ""
|
||||
echo "======= ${count} extra files in METALOG ========="
|
||||
echo "Files in METALOG but missing from DESTDIR."
|
||||
echo "File was deleted after installation ?"
|
||||
echo "------------------------------------------"
|
||||
cat "${SDIR}/extra"
|
||||
cat "${SETS_METALOG_EXTRA}"
|
||||
echo "========= end of ${count} extra files ==========="
|
||||
echo ""
|
||||
es=1 # this is fatal even if ${allowextra} is true
|
||||
@ -191,14 +208,14 @@ check_metalog_extra()
|
||||
|
||||
check_metalog_missing()
|
||||
{
|
||||
if [ -s "${SDIR}/missing" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SDIR}/missing")"
|
||||
if [ -s "${SETS_METALOG_MISSING}" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SETS_METALOG_MISSING}")"
|
||||
echo ""
|
||||
echo "====== ${count} missing files in METALOG ========"
|
||||
echo "Files in DESTDIR but missing from METALOG."
|
||||
echo "File installed but not registered in METALOG ?"
|
||||
echo "------------------------------------------"
|
||||
cat "${SDIR}/missing"
|
||||
cat "${SETS_METALOG_MISSING}"
|
||||
echo "======== end of ${count} missing files =========="
|
||||
echo ""
|
||||
es=1 # this is fatal even if ${allowmissing} is true
|
||||
@ -211,8 +228,9 @@ check_metalog_missing()
|
||||
compare_destdir()
|
||||
{
|
||||
# Handle case insensitive filesystems
|
||||
mv -f "${SDIR}/missing" "${SDIR}/missing.all"
|
||||
exist_case_insensitive < "${SDIR}/missing.all" > "${SDIR}/missing"
|
||||
mv -f "${SETS_DESTDIR_MISSING}" "${SETS_DESTDIR_MISSING}.all"
|
||||
exist_case_insensitive < "${SETS_DESTDIR_MISSING}.all" > "${SETS_DESTDIR_MISSING}"
|
||||
rm -f "${SETS_DESTDIR_MISSING}.all"
|
||||
|
||||
check_destdir_extra
|
||||
check_destdir_missing
|
||||
@ -220,8 +238,8 @@ check_destdir_missing
|
||||
|
||||
check_destdir_extra()
|
||||
{
|
||||
if [ -s "${SDIR}/extra" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SDIR}/extra")"
|
||||
if [ -s "${SETS_DESTDIR_EXTRA}" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SETS_DESTDIR_EXTRA}")"
|
||||
echo ""
|
||||
echo "======= ${count} extra files in DESTDIR ========="
|
||||
echo "Files in DESTDIR but missing from flist."
|
||||
@ -232,7 +250,7 @@ if [ -s "${SDIR}/extra" ]; then
|
||||
es=1
|
||||
fi
|
||||
echo "------------------------------------------"
|
||||
cat "${SDIR}/extra"
|
||||
cat "${SETS_DESTDIR_EXTRA}"
|
||||
echo "========= end of ${count} extra files ==========="
|
||||
echo ""
|
||||
fi
|
||||
@ -240,8 +258,8 @@ fi
|
||||
|
||||
check_destdir_missing()
|
||||
{
|
||||
if [ -s "${SDIR}/missing" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SDIR}/missing")"
|
||||
if [ -s "${SETS_DESTDIR_MISSING}" ]; then
|
||||
count="$(${AWK} 'END {print NR}' "${SETS_DESTDIR_MISSING}")"
|
||||
echo ""
|
||||
echo "====== ${count} missing files in DESTDIR ========"
|
||||
echo "Files in flist but missing from DESTDIR."
|
||||
@ -252,24 +270,26 @@ if [ -s "${SDIR}/missing" ]; then
|
||||
es=1
|
||||
fi
|
||||
echo "------------------------------------------"
|
||||
cat "${SDIR}/missing"
|
||||
cat "${SETS_DESTDIR_MISSING}"
|
||||
echo "======== end of ${count} missing files =========="
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
generate_files
|
||||
generate_dlist
|
||||
generate_flist
|
||||
generate_mlist
|
||||
|
||||
generate_mlist_missing
|
||||
generate_mlist_extra
|
||||
|
||||
generate_dlist_missing
|
||||
generate_dlist_extra
|
||||
|
||||
if false && [ -n "${metalog}" ]; then
|
||||
# XXX: Temporarily disabled due to problems with obsolete files in metalog
|
||||
generate_mlist_missing
|
||||
generate_mlist_extra
|
||||
compare_metalog
|
||||
else
|
||||
generate_files_missing
|
||||
generate_files_extra
|
||||
compare_destdir
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user