Make @dirrmtry handling in pkg_install closer to what pkg does

Original patch:	bapt
Phabric:	D215
Exp-run:	self, less orphans/leftovers with pkg_install with patch than without
		and no new failures with pkg
With hat:	portmgr
This commit is contained in:
Antoine Brodin 2014-06-20 21:03:02 +00:00
parent 5ed5af8e8c
commit 7c7b6b6ef1
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=358636
3 changed files with 20 additions and 7 deletions

View File

@ -84,6 +84,18 @@ $1 == "@fontsdir" {
next
}
$1 == "@dirrmtry" {
directory=substr($0, 11, length($0) - 10)
print "@comment begin " $0
if ($2 ~ /^\//) {
print "@unexec rmdir \"" directory "\" 2>/dev/null || true"
} else {
print "@unexec rmdir \"%D/" directory "\" 2>/dev/null || true"
}
print "@comment end " $0
next
}
# Print everything else as-is
{
print $0

View File

@ -1586,8 +1586,7 @@ SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} \
PLIST_SUB_SED_MIN?= 2
PLIST_SUB_SED?= ${PLIST_SUB:C/.*=.{1,${PLIST_SUB_SED_MIN}}$//g:NEXTRACT_SUFX=*:NOSREL=*:NLIB32DIR=*:NPREFIX=*:NLOCALBASE=*:N*="":N*="@comment*:C/([^=]*)="?([^"]*)"?/s!\2!%%\1%%!g;/g:C/\./\\./g}
PLIST_REINPLACE+= dirrmtry stopdaemon rmtry
PLIST_REINPLACE_DIRRMTRY=s!^@dirrmtry \(.*\)!@unexec rmdir "%D/\1" 2>/dev/null || true!
PLIST_REINPLACE+= stopdaemon rmtry
PLIST_REINPLACE_RMTRY=s!^@rmtry \(.*\)!@unexec rm -f %D/\1 2>/dev/null || true!
PLIST_REINPLACE_STOPDAEMON=s!^@stopdaemon \(.*\)!@unexec %D/etc/rc.d/\1 forcestop 2>/dev/null || true!
@ -5742,7 +5741,7 @@ add-plist-info:
.if (${PREFIX} != "/usr")
@${ECHO_CMD} "@unexec if [ -f %D/${INFO_PATH}/dir ]; then if sed -e '1,/Menu:/d' %D/${INFO_PATH}/dir | grep -q '^[*] '; then true; else rm %D/${INFO_PATH}/dir; fi; fi" >> ${TMPPLIST}
.if (${PREFIX} != ${LOCALBASE} && ${PREFIX} != ${LINUXBASE})
@${ECHO_CMD} "@unexec rmdir %D/${INFO_PATH} 2>/dev/null || true" >> ${TMPPLIST}
@${ECHO_CMD} "@dirrmtry ${INFO_PATH}" >> ${TMPPLIST}
.endif
.endif
.endif

View File

@ -580,7 +580,7 @@ add-plist-egginfo:
${LS} ${PYDISTUTILS_EGGINFODIR}/${egginfo} | while read f; do \
${ECHO_CMD} ${PYDISTUTILS_EGGINFODIR:S;^${STAGEDIR}${PYTHONBASE}/;;}/${egginfo}/$${f} >> ${TMPPLIST}; \
done; \
${ECHO_CMD} "@unexec rmdir \"%D/${PYDISTUTILS_EGGINFODIR:S;${STAGEDIR}${PYTHONBASE}/;;}/${egginfo}\" 2>/dev/null || true" >> ${TMPPLIST}; \
${ECHO_CMD} "@dirrmtry ${PYDISTUTILS_EGGINFODIR:S;${STAGEDIR}${PYTHONBASE}/;;}/${egginfo}" >> ${TMPPLIST}; \
fi;
. endfor
.else
@ -613,11 +613,13 @@ add-plist-pymod:
while read line; do \
${GREP} -qw "^$${line}$$" ${WRKDIR}/.localmtree || { \
[ -n "$${line}" ] && \
${ECHO_CMD} "@unexec rmdir \"%D/$${line}\" 2>/dev/null || true"; \
${ECHO_CMD} "@dirrmtry $${line}"; \
}; \
done | ${SORT} | uniq | ${SORT} -r >> ${TMPPLIST}
@${ECHO_CMD} "@unexec rmdir \"%D/${PYTHON_SITELIBDIR:S;${PYTHONBASE}/;;}\" 2>/dev/null || true" >> ${TMPPLIST}
@${ECHO_CMD} "@unexec rmdir \"%D/${PYTHON_LIBDIR:S;${PYTHONBASE}/;;}\" 2>/dev/null || true" >> ${TMPPLIST}
.if ${PREFIX} != ${LOCALBASE}
@${ECHO_CMD} "@dirrmtry ${PYTHON_SITELIBDIR:S;${PYTHONBASE}/;;}" >> ${TMPPLIST}
@${ECHO_CMD} "@dirrmtry ${PYTHON_LIBDIR:S;${PYTHONBASE}/;;}" >> ${TMPPLIST}
.endif
.else
.if ${PYTHON_REL} >= 320 && defined(PYTHON_PY3K_PLIST_HACK)