website: Add git the git hash and subject to the bottom of the pages.

Without this change, we have no idea if the website we see on
https://gnu.org/software/gnuboot/ is using the latest git commit.

It also allows anyone to spot and report to us that the website has
the wrong revision.

With this change we can also potentially spot issues in the website
generation for instance when the website should have been regenerated
and it wasn't, or from an archive or web page file, get to the git
commit it was generated from.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
Acked-by: Adrien 'neox' Bourmault <neox@gnu.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2024-09-06 18:15:39 +02:00 committed by Adrien 'neox' Bourmault
parent 43caba609e
commit 9ee2908475
Signed by: neox
GPG Key ID: 57BC26A3687116F6
4 changed files with 33 additions and 2 deletions

2
website/.gitignore vendored
View File

@ -27,3 +27,5 @@
/site.cfg
/untitled/
/website.tar.gz
/pages/footer.include
/pages/footer-git-commit.include

View File

@ -30,11 +30,36 @@ index.html: index.html.tmpl
history/git-history.jpg: history/git-history.dot
dot -T jpg history/git-history.dot > "$@"
# We need force the regeneration of the page because if only the git
# commit changes, there is no way to know about it. In addition the
# full website is regenerated each time the build target is run, so
# generating one more page has insignificant performance impact.
.PHONY: pages/footer-git-commit.include
pages/footer-git-commit.include:
rm -f $@
printf "This page was generated with %s from the commit %s\n" \
"[Untitled](https://untitled.vimuser.org/)" \
"`git show --no-patch HEAD --pretty=\"%h\"`" \
>> $@
printf "(\"%s\").\n" \
"`git show --no-patch HEAD --pretty=\"%s\"`" \
>> $@
printf "\n" >> $@
pages/footer.include: pages/footer.include.tmpl pages/footer-git-commit.include
cat \
pages/footer.include.tmpl \
pages/footer-git-commit.include \
> $@
site.cfg: site.cfg.tmpl
sed -e "s#WEBSITE_PREFIX#$(WEBSITE_PREFIX)#g" "$^" > "$@"
if WANT_GUIX
build: site.cfg
build: site.cfg pages/footer.include
guix time-machine \
--commit=c15a1cd88f80a90437f4b0159f22dfc84b9e6851 \
-- shell \
@ -53,7 +78,7 @@ build: site.cfg
-- \
./build.sh $(BUILD_OPTIONS)
else
build: site.cfg
build: site.cfg pages/footer.include
./build.sh $(BUILD_OPTIONS)
endif

View File

@ -148,5 +148,9 @@ if [ "${download_only}" -eq 0 ] ; then
copy_website "untitled/www/lbwww/"
cd untitled
# Remove "This HTML page was generated by the Untitled Static Site
# Generator." at the bottom of each page as it is already mentionned above.
sed 's/^SHAMELESS_PLUG=".*"/SHAMELESS_PLUG=""/g' -i lang/*/strings.cfg
./build sites lbwww
fi