add tools to compare entry's manifest with its files

Added `bin/bin/tar-entry.sh` to build a compressed tarball for an
entry.  The compressed tarball is formed by gnu tar with options
so that the same entry file content will always produce the same
compressed tarball, byte for byte.

As some files are missing from some entries, one should
use the `-W` option as in:

```sh
bin/tar-entry.sh -v 5 -W 2020/ferguson1
```

Added `make form_entry_tarball` to the top level `Makefile`
to build entry tarballs even when files are still missing.

Added `make verify_entry_files` to verify that all entries have all
of their files listed in their manifest, plus the top level ioccc.css
and var.mk files.  As file entry files are still missing (due to
HTML files that need to be built), the overall `make quick_www` and
`make www` do **NOT** (yet) exit when the `make verify_entry_files`
fails.

Improved `bin/chk-entry.sh` by removing some variables
that were not needed.

TODO: Improve `bin/` tool exit codes as the current use is a bit silly.

TODO: Clean out some variables used in `bin/` tools as some of then
are only set printed in debug statements.

TODO: Clean up usage messages, some of the options listed to not
match the `getopts(1)` parsing.  In some cases the option needs to
be parsed but needs to be ignored by the tool because another tool
automatically passes along certain options that really have no
effect.  Such ignored options need to be show as "This option is
ignored" in the usage message.
This commit is contained in:
Landon Curt Noll committed 2024-02-13 03:29:54 -08:00
1 parent dd36a407ad
commit ecabb73bf6
325 files changed
+748 -19

No files matched your search

+13 -17
View File
@@ -49,7 +49,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
# set variables referenced in the usage message
#
export VERSION="1.0 2024-02-12"
export VERSION="1.0.1 2024-02-13"
NAME=$(basename "$0")
export NAME
export V_FLAG=0
@@ -65,11 +65,7 @@ if [[ $status -eq 0 ]]; then
TOPDIR=$("$GIT_TOOL" rev-parse --show-toplevel)
fi
export TOPDIR
export DOCROOT_SLASH="../../"
export PANDOC_WRAPPER="bin/pandoc-wrapper.sh"
export REPO_URL="https://github.com/ioccc-src/temp-test-ioccc"
export SITE_URL="https://ioccc-src.github.io/temp-test-ioccc"
export URL="#"
# set usage message
#
@@ -375,11 +371,7 @@ if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: V_FLAG=$V_FLAG" 1>&2
echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
echo "$0: debug[3]: DOCROOT_SLASH=$DOCROOT_SLASH" 1>&2
echo "$0: debug[3]: PANDOC_WRAPPER=$PANDOC_WRAPPER" 1>&2
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
echo "$0: debug[3]: URL=$URL" 1>&2
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
echo "$0: debug[3]: ENTRY_PATH=$ENTRY_PATH" 1>&2
@@ -411,48 +403,50 @@ fi
#
TMP_MANIFEST_LIST=".$NAME.$$.manifest.list"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: temporary markdown file: $TMP_MANIFEST_LIST" 1>&2
echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
fi
if [[ -z $NOOP ]]; then
trap 'rm -f $TMP_MANIFEST_LIST; exit' 0 1 2 3 15
rm -f "$TMP_MANIFEST_LIST"
if [[ -e $TMP_MANIFEST_LIST ]]; then
echo "$0: ERROR: cannot remove temporary markdown file: $TMP_MANIFEST_LIST" 1>&2
echo "$0: ERROR: cannot remove temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
exit 227
fi
:> "$TMP_MANIFEST_LIST"
if [[ ! -e $TMP_MANIFEST_LIST ]]; then
echo "$0: ERROR: cannot create temporary markdown file: $TMP_MANIFEST_LIST" 1>&2
echo "$0: ERROR: cannot create temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
exit 228
fi
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary markdown file is not used: $TMP_MANIFEST_LIST" 1>&2
echo "$0: debug[3]: because of -n, temporary file manifest list is not used: $TMP_MANIFEST_LIST" 1>&2
fi
# create a temporary find files list
#
TMP_FILE_LIST=".$NAME.$$.find.list"
if [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: temporary markdown file: $TMP_FILE_LIST" 1>&2
echo "$0: debug[3]: temporary file manifest list: $TMP_FILE_LIST" 1>&2
fi
if [[ -z $NOOP ]]; then
trap 'rm -f $TMP_MANIFEST_LIST $TMP_FILE_LIST; exit' 0 1 2 3 15
rm -f "$TMP_FILE_LIST"
if [[ -e $TMP_FILE_LIST ]]; then
echo "$0: ERROR: cannot remove temporary markdown file: $TMP_FILE_LIST" 1>&2
echo "$0: ERROR: cannot remove temporary file manifest list: $TMP_FILE_LIST" 1>&2
exit 227
fi
:> "$TMP_FILE_LIST"
if [[ ! -e $TMP_FILE_LIST ]]; then
echo "$0: ERROR: cannot create temporary markdown file: $TMP_FILE_LIST" 1>&2
echo "$0: ERROR: cannot create temporary file manifest list: $TMP_FILE_LIST" 1>&2
exit 228
fi
elif [[ $V_FLAG -ge 3 ]]; then
echo "$0: debug[3]: because of -n, temporary markdown file is not used: $TMP_FILE_LIST" 1>&2
echo "$0: debug[3]: because of -n, temporary file manifest list is not used: $TMP_FILE_LIST" 1>&2
fi
# generate sorted list of entry files from the entry's manifest
#
# We also add ioccc.css and var.mk from the top level.
#
awk -f "$FILELIST_ENTRY_JSON_AWK" "$ENTRY_JSON" > "$TMP_MANIFEST_LIST"
status="$?"
if [[ $status -ne 0 ]]; then
@@ -470,6 +464,8 @@ fi
# generate sorted list of found entry files
#
# We also add ioccc.css and var.mk from the top level.
#
find "$IOCCC_CSS" "$VAR_MK" "$ENTRY_PATH" -type f -print > "$TMP_FILE_LIST"
status="$?"
if [[ $status -ne 0 ]]; then