Navigation Menu

Skip to content

Commit

Permalink
Orphans: Use check-orphans now *
Browse files Browse the repository at this point in the history
* This may be hooked into stage-qa later, for now call it separately

MFH
  • Loading branch information
bdrewery committed Apr 19, 2014
1 parent 714670e commit 7546799
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/share/poudriere/awk/processonelog2.awk
@@ -1,7 +1,7 @@
# Read a single errorlogfile and output a phase
/Filesystem touched during build/ { res[0]="build_fs_violation" }
/Filesystem touched during stage/ { res[1]="stage_fs_violation" }
/Files or directories orphaned/ { res[2]="stage_orphans" }
/check\-orphans failures/ { res[2]="stage_orphans" }
/stage\-qa failures/ { res[3]="stage-qa" }
/Files or directories (left over|removed|modified)/ { res[4]="leftovers" }

Expand Down
48 changes: 5 additions & 43 deletions src/share/poudriere/common.sh
Expand Up @@ -596,7 +596,6 @@ markfs() {
;;
prebuild|prestage) domtree=1 ;;
preinst) domtree=1 ;;
poststage) domtree=1 ;;
esac

if [ $dozfs -eq 1 ]; then
Expand All @@ -613,7 +612,7 @@ markfs() {
mkdir -p ${mnt}/poudriere/

case "${name}" in
prepkg|poststage)
prepkg)
cat > ${mnt}/poudriere/mtree.${name}exclude << EOF
.${HOME}/.ccache/*
./compat/linux/proc
Expand Down Expand Up @@ -1305,9 +1304,6 @@ check_leftovers() {
mtree -X ${mnt}/poudriere/mtree.preinstexclude \
-f ${mnt}/poudriere/mtree.preinst \
-p ${mnt}
else
injail mtree -f /poudriere/mtree.poststage \
-e -L -p /
fi
} | while read l ; do
local changed read_again
Expand Down Expand Up @@ -1542,54 +1538,20 @@ _real_build_port() {
plistsub_sed=$(injail env ${PORT_FLAGS} make -C ${portdir} -V'PLIST_SUB:C/"//g:NLIB32*:NPERL_*:NPREFIX*:N*="":N*="@comment*:C/(.*)=(.*)/-es!\2!%%\1%%!g/')
PREFIX=$(injail env ${PORT_FLAGS} make -C ${portdir} -VPREFIX)
if [ -z "${no_stage}" ]; then
msg "Checking for orphaned files and directories in stage directory (missing from plist)"
bset ${MY_JOBID} status "stage_orphans:${port}"
local orphans=$(mktemp ${mnt}/tmp/orphans.XXXXXX)
local die=0

markfs poststage ${mnt} ${stagedir}
check_leftovers ${mnt} ${stagedir} | \
while read modtype path extra; do
local ppath

# If this is a directory, use @dirrm in output
if [ -d "${path}" ]; then
ppath="@dirrm "`echo $path | sed \
-e "s,^${mnt},," \
-e "s,^${PREFIX}/,," \
${plistsub_sed} \
`
else
ppath=`echo "$path" | sed \
-e "s,^${mnt},," \
-e "s,^${PREFIX}/,," \
${plistsub_sed} \
`
fi

[ "${modtype}" = "M" ] && continue

# Ignore PREFIX as orphan, which
# happens via stage-dir if
# NO_MTREE is set
[ "${path#${mnt}}" != "${PREFIX}" ] &&
[ "${path#${mnt}}" != "/usr" ] &&
[ "${path#${mnt}}" != "/." ] &&
echo "${ppath}" >> ${orphans}
done

if [ -s "${orphans}" ]; then
msg "Error: Files or directories orphaned:"
if ! injail env DEVELOPER=1 \
make -C ${portdir} check-orphans; then
msg "Error: check-orphans failures detected"
die=1
grep -v "^@dirrm" ${orphans}
grep "^@dirrm" ${orphans} | sort -r
fi

[ ${die} -eq 1 -a "${0##*/}" = "testport.sh" -a \
"${PREFIX}" != "${LOCALBASE}" ] && msg \
"This test was done with PREFIX!=LOCALBASE which \
may show failures if the port does not respect PREFIX. \
Try testport with -n to use PREFIX=LOCALBASE"
rm -f ${orphans}
[ $die -eq 0 ] || if [ "${PORTTESTING_FATAL}" != "no" ]; then
return 1
else
Expand Down

0 comments on commit 7546799

Please sign in to comment.