Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion plat/unix/update_gtags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ set -e
PROG_NAME=$0
GTAGS_EXE=gtags
FILE_LIST_CMD=
TAGS_FILES="GTAGS GPATH GRTAGS"
GTAGS_PATHARG="${!#}" # last arg is always the path
LOCKFILE="$GTAGS_PATHARG/gtags.lock"

ShowUsage() {
echo "Usage:"
Expand All @@ -30,7 +33,7 @@ while [[ $# -ne 0 ]]; do
shift 2
;;
*)
GTAGS_ARGS="$GTAGS_ARGS $1"
GTAGS_ARGS="$GTAGS_ARGS $(printf %q "$1")"
shift
;;
esac
Expand All @@ -42,7 +45,24 @@ else
CMD="$GTAGS_EXE $GTAGS_ARGS"
fi

echo "Locking gtags files..."
set -C
echo $$ > "$LOCKFILE"

# Remove lock and any partial files on script exit
trap '\
errorcode=$?; \
for f in $TAGS_FILES; \
do rm -f "$GTAGS_PATHARG/$f"; done; \
rm -f "$LOCKFILE"; \
exit $errorcode; \
' INT QUIT TERM

echo "Running gtags:"
echo "$CMD"
eval "$CMD"

echo "Unlocking gtags file..."
rm -f "$LOCKFILE"

echo "Done."
1 change: 1 addition & 0 deletions plat/unix/update_pyscopedb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ if [ "$1" != "" ]; then
fi

echo "Locking pycscope DB file..."
set -C
echo $$ > "$DB_FILE.lock"

# Remove lock and temp file if script is stopped unexpectedly.
Expand Down
7 changes: 4 additions & 3 deletions plat/unix/update_scopedb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ if [ "$1" != "" ]; then
exit 1
fi

echo "Locking cscope DB file..."
echo $$ > "$DB_FILE.lock"

# Remove lock and temp file if script is stopped unexpectedly.
CleanUp() {
rm -f "$DB_FILE.lock" "$DB_FILE.files" "$DB_FILE.temp"
Expand All @@ -65,6 +62,10 @@ CleanUp() {
fi
}

echo "Locking cscope DB file..."
set -C
echo $$ > "$DB_FILE.lock"

trap CleanUp INT QUIT TERM EXIT

PREVIOUS_DIR=$(pwd)
Expand Down
1 change: 1 addition & 0 deletions plat/unix/update_tags.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ if [ "$1" != "" ]; then
fi

echo "Locking tags file..."
set -C
echo $$ > "$TAGS_FILE.lock"

# Remove lock and temp file if script is stopped unexpectedly.
Expand Down