[bootlin/training-materials updates] master: Refactor latest update date and add to agenda (d8db0fed)

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Oct 20 14:37:24 CEST 2021


Repository : https://github.com/bootlin/training-materials
On branch  : master
Link       : https://github.com/bootlin/training-materials/commit/d8db0fed297739d02f7caaf5307c547f73f79bbb

>---------------------------------------------------------------

commit d8db0fed297739d02f7caaf5307c547f73f79bbb
Author: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
Date:   Wed Oct 20 14:37:24 2021 +0200

    Refactor latest update date and add to agenda
    
    Instead of showing the date of today as the latest update date, show
    the date of the latest Git commit.
    
    And add a latest update date to the training agenda.
    
    Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>


>---------------------------------------------------------------

d8db0fed297739d02f7caaf5307c547f73f79bbb
 Makefile                      | 17 +++++++++++++----
 common/agenda.sty             |  6 +++++-
 common/beamerthemeBootlin.sty |  2 +-
 common/labs-header.tex        |  1 +
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index d8371f90..7c6051ce 100644
--- a/Makefile
+++ b/Makefile
@@ -125,13 +125,14 @@ SLIDES_TEX      = \
 	$(SLIDES_COMMON_AFTER)
 SLIDES_PICTURES = $(call PICTURES,$(foreach s,$(SLIDES_CHAPTERS),slides/$(s))) $(COMMON_PICTURES)
 
-%-slides.pdf: $(VARS) $(SLIDES_TEX) $(SLIDES_PICTURES) $(STYLESHEET)
+%-slides.pdf: $(VARS) $(SLIDES_TEX) $(SLIDES_PICTURES) $(STYLESHEET) $(OUTDIR)/last-update.tex
 	@echo $(SLIDES_CHAPTERS_NUM)
 	@mkdir -p $(OUTDIR)
 # We generate a .tex file with \input{} directives (instead of just
 # concatenating all files) so that when there is an error, we are
 # pointed at the right original file and the right line in that file.
 	rm -f $(OUTDIR)/$(basename $@).tex
+	echo "\input{last-update}" >> $(OUTDIR)/$(basename $@).tex
 	echo "\input{$(VARS)}" >> $(OUTDIR)/$(basename $@).tex
 	for f in $(filter %.tex,$^) ; do \
 		echo -n "\input{../"          >> $(OUTDIR)/$(basename $@).tex ; \
@@ -182,12 +183,13 @@ LABS_TEX      = \
 	$(LABS_FOOTER)
 LABS_PICTURES = $(call PICTURES,$(foreach s,$(LABS_CHAPTERS),labs/$(s))) $(COMMON_PICTURES)
 
-%-labs.pdf: common/labs.sty $(VARS) $(LABS_TEX) $(LABS_PICTURES)
+%-labs.pdf: common/labs.sty $(VARS) $(LABS_TEX) $(LABS_PICTURES) $(OUTDIR)/last-update.tex
 	@mkdir -p $(OUTDIR)
 # We generate a .tex file with \input{} directives (instead of just
 # concatenating all files) so that when there is an error, we are
 # pointed at the right original file and the right line in that file.
 	rm -f $(OUTDIR)/$(basename $@).tex
+	echo "\input{last-update}" >> $(OUTDIR)/$(basename $@).tex
 	echo "\input{$(VARS)}" >> $(OUTDIR)/$(basename $@).tex
 	for f in $(filter %.tex,$^) ; do \
 		cp $$f $(OUTDIR)/`basename $$f` ; \
@@ -231,9 +233,9 @@ ifdef AGENDA
 AGENDA_TEX = agenda/$(AGENDA)-agenda.tex
 AGENDA_PICTURES = $(COMMON_PICTURES) $(call PICTURES,agenda)
 
-%-agenda.pdf: common/agenda.sty $(AGENDA_TEX) $(AGENDA_PICTURES)
+%-agenda.pdf: common/agenda.sty $(AGENDA_TEX) $(AGENDA_PICTURES) $(OUTDIR)/last-update.tex
 	rm -f $(OUTDIR)/$(basename $@).tex
-	cp $(filter %.tex,$^) $(OUTDIR)/$(basename $@).tex
+	cp $(filter %-agenda.tex,$^) $(OUTDIR)/$(basename $@).tex
 	(cd $(OUTDIR); $(PDFLATEX_ENV) $(PDFLATEX) $(basename $@).tex)
 	cat $(OUTDIR)/$@ > $@
 else
@@ -242,6 +244,13 @@ FORCE:
 	@$(MAKE) $@ AGENDA=$*
 endif
 
+#
+# === Last update file generation ===
+#
+$(OUTDIR)/last-update.tex:
+	t=`git log -1 --format=%ct` && printf "\def \lastupdate{%s}\n" "`(LANG=en_EN.UTF-8 date -d @$${t} +'%B %d, %Y')`" > $@
+
+
 #
 # === Picture generation ===
 #
diff --git a/common/agenda.sty b/common/agenda.sty
index 30a49459..57cf8b3f 100644
--- a/common/agenda.sty
+++ b/common/agenda.sty
@@ -20,6 +20,8 @@
 \usepackage{calc}
 \usepackage{ifthen}
 
+\input{last-update}
+
 % A nicer font
 \usepackage{fontspec}
 \defaultfontfeatures{Ligatures=TeX}
@@ -124,7 +126,9 @@
     \LARGE
     \trainingtitle{}\\
     \large
-    \trainingduration{}
+    \trainingduration{}\\
+    \small
+    Latest update: \lastupdate{}
   \end{center}
   \vspace{1cm}
 }
diff --git a/common/beamerthemeBootlin.sty b/common/beamerthemeBootlin.sty
index 94c4583d..c096e777 100644
--- a/common/beamerthemeBootlin.sty
+++ b/common/beamerthemeBootlin.sty
@@ -126,7 +126,7 @@
       \tinyv
       © Copyright 2004-\the\year, Bootlin.\\
       Creative Commons BY-SA 3.0 license.\\
-      Latest update: \today.\\
+      Latest update: \lastupdate{}.\\
       \vspace{1em}
       Document updates and sources:\\
       \url{\@trainingurl}\\
diff --git a/common/labs-header.tex b/common/labs-header.tex
index 68bb7cd6..8eb112cd 100644
--- a/common/labs-header.tex
+++ b/common/labs-header.tex
@@ -83,6 +83,7 @@
 \ifdefstring{\labbooksubtitle}{}{}{\Large \labbooksubtitle \\}
 \huge\vspace{1cm} Practical Labs}
 \trainingurl{https://bootlin.com/doc/training/__SESSION_NAME__}
+\date{\lastupdate{}}
 
 \begin{document}
 \maketitle




More information about the training-materials-updates mailing list