r2pm: Allow package script to declare cleaning is done (#17411) ##tools

This commit is contained in:
Khairul Azhar Kasmiran 2020-08-08 18:37:41 +08:00 committed by GitHub
parent a94718304c
commit 7ed581d2de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 9 deletions

View File

@ -570,6 +570,7 @@ case "$1" in
while [ -n "$2" ]; do
echo "Cleaning $2..."
FILE="$(pkgFilePath "$2")"
R2PM_CLEAN_GITDIR=1
if [ -f "${FILE}" ]; then
NAME="$2"
ACTION=clean
@ -581,15 +582,17 @@ case "$1" in
RC=1
fi
if [ -d "${R2PM_GITDIR}/$2" ]; then
echo "Cleaning up ${R2PM_GITDIR}/$2..."
rm -rf "${R2PM_GITDIR}/$2"
elif [ -d "${R2PM_GITDIR}/$2.git" ]; then
echo "Cleaning up ${R2PM_GITDIR}/$2.git..."
rm -rf "${R2PM_GITDIR}/$2.git"
else
echo "Cannot find $2 or $2.git in ${R2PM_GITDIR}"
RC=1
if [ "${R2PM_CLEAN_GITDIR}" = 1 ]; then
if [ -d "${R2PM_GITDIR}/$2" ]; then
echo "Cleaning up ${R2PM_GITDIR}/$2..."
rm -rf "${R2PM_GITDIR}/$2"
elif [ -d "${R2PM_GITDIR}/$2.git" ]; then
echo "Cleaning up ${R2PM_GITDIR}/$2.git..."
rm -rf "${R2PM_GITDIR}/$2.git"
else
echo "Cannot find $2 or $2.git in ${R2PM_GITDIR}"
RC=1
fi
fi
shift
done