Files
ioccc/tmp/check_path_list.sh
T
Cody Boone Ferguson 205fa25ced Change references of many terms to new names
This is a HUGE commit and this task is not done. There are still some
changes that might need to be discussed and since so much is done here I
think it's better to let this go through and then make sure everything
is okay. When the remaining references are discussed they can also be
changed.

I did NOT include changes in the tmp/OLD_manifest directory.

Some of the changes in this commit (it might be exhaustive but it might
not be - not sure):

- In the Makefiles the WINNERS was renamed AUTHORS.
- References to winners.html were changed to authors.html.
- The FAQ named anchor 'fix_a_winner' was renamed 'fix_an_entry'.
- The JSON fields (or whatever they're called) 'winner_id' and
'winner_JSON_format_version' were changed so that 'winner' is 'entry'.
- In scripts for entries 'IOCCC winner' was changed to 'IOCCC entry'.
- 'winners_text' is now 'entries_text'. It might be better to be
'entry_text' as it's per entry but this was not noticed at first. Since
this is easy to fix I am holding off on this for the meantime.
- The script tmp/update-manifest.sh now has the commit log messages
changed to the correct terms as well.

The index.html files were updated as well with any of the above
changes.

There are some references that should NOT be updated. Two examples
caught (and maybe more have slipped through that will have to be changed
back): in 1984/anonymous/README.md the author wrote back to Landon after
being told about the famous tattoo and they used the words:

    .. my entry will be the first IOCCC winner ..

but since this comes from the author it should remain so.

The other one is that winners.html should still refer to winners.html as
it informs people that it's been moved to authors.html (it does redirect
too but even so if it was changed it would defeat the purpose of the
message).

With paths like authors.html I tried to copy paste so that hopefully
there are no typos. It is possible that I did not end up doing this with
all but these can be fixed when discovered.
2024-02-13 07:31:36 -08:00

90 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# check_path_list.sh - look for problems with path_list.* files
#
# XXX - This is a temporary utility that will be replaced when
# the .entry.json files are built
#
# setup
#
export REQUIRED_PATH_LIST="path_list.required.txt"
export BUILT_PATH_LIST="path_list.built.txt"
export MANIFEST_LIST="path_list.manifest.txt"
export FOUND_LIST="path_list.found.txt"
export EXIT_CODE=0
# firewall
#
if [[ ! -f $REQUIRED_PATH_LIST ]]; then
echo "$0: ERROR: missing REQUIRED_PATH_LIST: $REQUIRED_PATH_LIST" 1>&2
exit 10
fi
if [[ ! -s $REQUIRED_PATH_LIST ]]; then
echo "$0: ERROR: REQUIRED_PATH_LIST is empty: $REQUIRED_PATH_LIST" 1>&2
exit 11
fi
if [[ ! -f $BUILT_PATH_LIST ]]; then
echo "$0: ERROR: missing BUILT_PATH_LIST: $BUILT_PATH_LIST" 1>&2
exit 12
fi
if [[ ! -s $BUILT_PATH_LIST ]]; then
echo "$0: ERROR: BUILT_PATH_LIST is empty: $BUILT_PATH_LIST" 1>&2
exit 13
fi
if [[ ! -f $MANIFEST_LIST ]]; then
echo "$0: ERROR: missing MANIFEST_LIST: $MANIFEST_LIST" 1>&2
exit 14
fi
if [[ ! -s $MANIFEST_LIST ]]; then
echo "$0: ERROR: MANIFEST_LIST is empty: $MANIFEST_LIST" 1>&2
exit 15
fi
if [[ ! -f $FOUND_LIST ]]; then
echo "$0: ERROR: missing FOUND_LIST: $FOUND_LIST" 1>&2
exit 16
fi
if [[ ! -s $FOUND_LIST ]]; then
echo "$0: ERROR: FOUND_LIST is empty: $FOUND_LIST" 1>&2
exit 17
fi
# look for missing required files
#
export TMP_FILE="tmp.$$.missing"
trap 'rm -f $TMP_FILE; exit' 0 1 2 3 15
comm -23 "$REQUIRED_PATH_LIST" "$FOUND_LIST" | sort -t/ > "$TMP_FILE"
if [[ -s $TMP_FILE ]]; then
COUNT=$(wc -l < "$TMP_FILE" | sed -e 's/^ *//')
echo "# $0: Warning: missing required file count: $COUNT"
EXIT_CODE=18 # exit 18
echo "#"
echo "# $0: missing required file list starts below"
cat "$TMP_FILE"
echo "# $0: missing required file list ends above"
fi
rm -f "$TMP_FILE"
# look for found files not in the manifest
#
export TMP_FILE="tmp.$$.missing"
trap 'rm -f $TMP_FILE; exit' 0 1 2 3 15
comm -13 "$MANIFEST_LIST" "$FOUND_LIST" | sort -t/ > "$TMP_FILE"
if [[ -s $TMP_FILE ]]; then
COUNT=$(wc -l < "$TMP_FILE" | sed -e 's/^ *//')
echo "# $0: Warning: found files not in the manifest count: $COUNT"
EXIT_CODE=19 # exit 19
echo "#"
echo "# $0: found files not in the manifest list starts below"
cat "$TMP_FILE"
echo "# $0: found files not in the manifest list ends above"
fi
rm -f "$TMP_FILE"
# All Done!!! -- Jessica Noll, Age 2
#
if [[ $EXIT_CODE -ne 0 ]]; then
echo "$0: Warning: about to exit: $EXIT_CODE" 1>&2
fi
exit "$EXIT_CODE"