Skip to content

Commit

Permalink
do not show missions in archive.sh (except with -v)
Browse files Browse the repository at this point in the history
  • Loading branch information
phyver committed Jun 28, 2021
1 parent 4f9a1f3 commit c98b212
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions utils/archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ options:
-a keep 'auto.sh' scripts for missions that have one
-t keep 'test.sh' scripts for missions that have one
-z keep tgz archive
-v show the list of mission directories as they are being processed
EOH
}

Expand Down Expand Up @@ -52,8 +54,9 @@ GENERATE_MO=1
# KEEP_PO=1 # this is set to 1 if we generate .mo files. Setting it to 1 here
# (or before generating .mo files) will keep the .po files
LANGUAGES=""
VERBOSE=

while getopts ":hp:N:atPzL:E" opt
while getopts ":hp:N:atPzL:Ev" opt
do
case $opt in
h)
Expand Down Expand Up @@ -86,6 +89,9 @@ do
KEEP_PO=0
GENERATE_MO=0
;;
v)
VERBOSE=1
;;
*)
echo "invalid option: '-$OPTARG'" >&2
exit 1
Expand Down Expand Up @@ -115,31 +121,59 @@ cp -RPp "$GSH_ROOT/start.sh" "$GSH_ROOT/bin" "$GSH_ROOT/utils" "$GSH_ROOT/lib" "

# copy missions
mkdir "$TMP_DIR/$NAME/missions"
echo "copy missions"
if [ -z "$VERBOSE" ]
then
printf "copying missions: "
else
echo "copying missions"
fi

if ! make_index "$@" > "$TMP_DIR/$NAME/missions/index.txt"
then
echo "Error: archive.sh, couldn't make index.txt"
rm -rf "$TMP_DIR"
exit 1
fi

NB_MISSIONS=0
NB_DUMMY=0
cat "$TMP_DIR/$NAME/missions/index.txt" | while read MISSION_DIR
do
DUMMY=
case $MISSION_DIR in
"" | "#"* )
continue
;;
"!"*)
MISSION_DIR=$(echo "$MISSION_DIR" | cut -c2-)
NB_DUMMY=$((NB_DUMMY + 1))
DUMMY=1
;;
esac
echo " -> copy $MISSION_DIR"
NB_MISSIONS=$((NB_MISSIONS + 1))
if [ -z "$VERBOSE" ]
then
if [ -z "$DUMMY" ]
then
printf "."
else
printf "!"
fi
else
if [ -z "$DUMMY" ]
then
echo " - $MISSION_DIR"
else
echo " ! $MISSION_DIR (dummy)"
fi
fi
mkdir -p "$TMP_DIR/$NAME/missions/$MISSION_DIR"
ARCHIVE_MISSION_DIR=$TMP_DIR/$NAME/missions/$MISSION_DIR
# NOTE: macOS' cp doesn't have '--archive', and '-a' is not POSIX.
# use POSIX options to make sure it is portable
cp -RPp "$GSH_MISSIONS/$MISSION_DIR"/* "$ARCHIVE_MISSION_DIR"
done
[ -n "$VERBOSE" ] || echo

# define new GSH_ROOT
export GSH_ROOT="$TMP_DIR/$NAME"
Expand Down Expand Up @@ -200,8 +234,8 @@ then
PO_LANG=$(basename "$PO_FILE" .po)
mkdir -p "$GSH_ROOT/locale/$PO_LANG/LC_MESSAGES"
msgfmt -o "$GSH_ROOT/locale/$PO_LANG/LC_MESSAGES/$DOMAIN.mo" "$PO_FILE"
printf "."
done
printf "."
fi
fi
done < "$GSH_ROOT/missions/index.txt"
Expand All @@ -220,7 +254,7 @@ echo "removing unnecessary files"
find . -name "Makefile" | xargs rm -f
find . -name "template.pot" | xargs rm -f
[ "$KEEP_PO" -eq 0 ] && find . -name "*.po" | xargs rm -f
[ "$KEEP_TEST" -ne 1 ] && echo "remove tests" && find ./missions -name "test.sh" | xargs rm -f
[ "$KEEP_TEST" -ne 1 ] && find ./missions -name "test.sh" | xargs rm -f
[ "$KEEP_AUTO" -ne 1 ] && find ./missions -name auto.sh | xargs rm -f

# rm -f "$GSH_ROOT/bin/boxes-data.awk" "$GSH_ROOT/utils/archive.sh"
Expand Down

0 comments on commit c98b212

Please sign in to comment.