git: 578d48f1bc19 - main - rmport: ready for git
Rene Ladan
rene at FreeBSD.org
Tue Apr 6 20:59:23 UTC 2021
The branch main has been updated by rene:
URL: https://cgit.FreeBSD.org/ports/commit/?id=578d48f1bc1949bd03d0ea4b6ae9750eb9aed43e
commit 578d48f1bc1949bd03d0ea4b6ae9750eb9aed43e
Author: Rene Ladan <rene at FreeBSD.org>
AuthorDate: 2021-04-06 20:56:09 +0000
Commit: Rene Ladan <rene at FreeBSD.org>
CommitDate: 2021-04-06 20:56:09 +0000
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
---
Tools/scripts/rmport | 23 +++++++++++++++++++----
1 file 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
More information about the dev-commits-ports-all
mailing list