aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorRene Ladan <rene@FreeBSD.org>2021-04-06 20:56:09 +0000
committerRene Ladan <rene@FreeBSD.org>2021-04-06 20:56:09 +0000
commit578d48f1bc1949bd03d0ea4b6ae9750eb9aed43e (patch)
tree86c17f4e5a0a4f91c924e33bf3a67054a5076da8 /Tools
parent25996ce5b64cbc5e3c7297b7f80c133c614265c4 (diff)
downloadports-578d48f1bc1949bd03d0ea4b6ae9750eb9aed43e.tar.gz
ports-578d48f1bc1949bd03d0ea4b6ae9750eb9aed43e.zip
rmport: ready for git
- do not remove ports immediately but store them in a temporary file and remove them once the script has iterated over all ports to be removed. This prevents failed searches. The Subversion version used a temporary worktree so the main tree was unaffected. - remove a "merge" from a question, we use rebase now. - check if INDEX is readable and exit if not
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/rmport23
1 files changed, 19 insertions, 4 deletions
diff --git a/Tools/scripts/rmport b/Tools/scripts/rmport
index 840bb2d5ddb5..2b4a1c579150 100755
--- a/Tools/scripts/rmport
+++ b/Tools/scripts/rmport
@@ -307,9 +307,9 @@ rm_port()
{
catport=${1}
- log "${catport}: removing port's files"
+ log "${catport}: scheduling port removal"
- ${GIT} rm -r ${catport}
+ echo ${catport} >> ${gitrmlist}
}
append_Template()
@@ -337,7 +337,7 @@ append_Template()
commit()
{
${GIT} commit --file=${gitlog}
- answer=$(ask "Do you want to merge and tweak the commit message")
+ answer=$(ask "Do you want to tweak the commit message")
if [ "${answer}" = "y" ] ; then
${GIT} pull --ff-only --rebase 2>&1
${GIT} commit 2>&1 # modify final commit message
@@ -349,7 +349,7 @@ cleanup()
{
log "cleaning up"
- rm -f ${gitlog}
+ rm -f ${gitlog} ${gitrmlist}
}
usage()
@@ -380,6 +380,11 @@ if ! ${GIT} diff --exit-code remotes/origin/main ; then
echo "you have local commits, exiting" >&2
exit
fi
+if [ ! -r ${INDEX} ] ; then
+ echo "${INDEX} not readable, exiting" >&2
+ exit
+fi
+
git_dir="$(${GIT} rev-parse --git-dir)"
exitcode=$?
if [ ${exitcode} -ne 0 ] ; then
@@ -427,6 +432,10 @@ if [ ${1} = "-a" ] ; then
fi
gitlog=$(mktemp -t gitlog)
+gitrmlist=$(mktemp -t gitrmlist)
+
+echo "Remove expired ports:" > ${gitlog}
+echo "" >> ${gitlog}
for catport in $* ; do
# convert to category/port
@@ -458,6 +467,12 @@ for catport in $* ; do
rm_port ${catport}
done
+if [ -s ${gitrmlist} ] ; then
+ ${GIT} rm -r $(cat ${gitrmlist})
+else
+ log "No port directories to remove"
+fi
+
# give a chance to the committer to edit files by hand and recreate/review
# the diff afterwards
answer=y