build: remove by pkg glob alone, mixed port and plugins origin is tricky

This commit is contained in:
Franco Fichtner 2017-09-05 06:22:39 +02:00
parent 3f85f895e3
commit 350fab299c
2 changed files with 3 additions and 18 deletions

View File

@ -36,7 +36,7 @@ all:
@cat ${.CURDIR}/README.md | ${PAGER}
lint-steps:
.for STEP in ${STEPS}
.for STEP in common ${STEPS}
@sh -n ${.CURDIR}/build/${STEP}.sh
.endfor

View File

@ -586,24 +586,9 @@ remove_packages()
echo ">>> Removing packages in ${BASEDIR}: ${PKGLIST}"
for PKG in ${PKGLIST}; do
# match using globbing
for PKGGLOB in $(cd ${BASEDIR}${PACKAGESDIR}; \
find All -name "${PKG}" -type f); do
rm ${BASEDIR}${PACKAGESDIR}/${PKGGLOB}
done
# exact matching according to package name or origin
for PKGFILE in $(cd ${BASEDIR}${PACKAGESDIR}; \
find All -type f); do
PKGINFO=$(pkg -c ${BASEDIR} info -F ${PACKAGESDIR}/${PKGFILE} | grep ^Name | awk '{ print $3; }')
if [ ${PKG} = ${PKGINFO} ]; then
rm ${BASEDIR}${PACKAGESDIR}/${PKGFILE}
break
fi
PKGORIGIN=$(pkg -c ${BASEDIR} info -F ${PACKAGESDIR}/${PKGFILE} | grep ^Origin | awk '{ print $3; }')
if [ ${PKG} = ${PKGORIGIN} ]; then
rm ${BASEDIR}${PACKAGESDIR}/${PKGFILE}
break
fi
find All -name "${PKG}-[0-9]*.txz" -type f); do
rm ${BASEDIR}${PACKAGESDIR}/${PKGFILE}
done
done
}