summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Le <philipp-le-prviat@freenet.de>2020-07-01 23:40:02 +0200
committerPhilipp Le <philipp-le-prviat@freenet.de>2021-03-04 22:44:39 +0100
commitc2e3ef1e6336c9d8f078df0d73bf111913f9e750 (patch)
tree99c54b49ec2f64bf5cb0449f3f8421e8cbc6adb8
parentc1db4510292b388c228d8d8dab18c6d09cc869ba (diff)
downloaddcs-lecture-notes-c2e3ef1e6336c9d8f078df0d73bf111913f9e750.zip
dcs-lecture-notes-c2e3ef1e6336c9d8f078df0d73bf111913f9e750.tar.gz
dcs-lecture-notes-c2e3ef1e6336c9d8f078df0d73bf111913f9e750.tar.bz2
Replace manually set revision number and date by Git commit number and date (automatically generated)
-rw-r--r--Makefile8
-rw-r--r--common/imprint.tex3
-rw-r--r--common/settings.tex4
-rwxr-xr-xcommon/titlepage.tex2
-rwxr-xr-xgen_vcs_info.sh29
5 files changed, 42 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f4c0e03..fe43eda 100644
--- a/Makefile
+++ b/Makefile
@@ -24,11 +24,11 @@ clean:
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) ; rm -f *.aux *.fdb_latexmk *.fls *.lof *.log *.lot *.pdf *.synctex.gz
-$(BUILD_DIR)/DCS.pdf: main/DCS.tex $(COMMON_DEPS) */*.tex $(ALL_SVGS)
+$(BUILD_DIR)/DCS.pdf: main/DCS.tex $(COMMON_DEPS) */*.tex $(ALL_SVGS) $(BUILD_DIR)/vcs_info.tex
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) ; $(LATEXMK) ../$<
-$(BUILD_DIR)/%.pdf: main/%.tex $(COMMON_DEPS) %/*.tex $(ALL_SVGS)
+$(BUILD_DIR)/%.pdf: main/%.tex $(COMMON_DEPS) %/*.tex $(ALL_SVGS) $(BUILD_DIR)/vcs_info.tex
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) ; $(LATEXMK) ../$<
@@ -53,6 +53,10 @@ $(BUILD_DIR)/svg/ch04_win_tri.pdf: chapter04/win_tri.svg
$(BUILD_DIR)/svg/ch04_win_gauss.pdf: chapter04/win_gauss.svg
$(BUILD_DIR)/svg/ch06_FFT_Butterfly.pdf: chapter06/FFT_Butterfly.svg
+.PHONY: $(BUILD_DIR)/vcs_info.tex
+$(BUILD_DIR)/vcs_info.tex:
+ ./gen_vcs_info.sh > $@
+
%-watch: main/%.tex
mkdir -p $(BUILD_DIR)
cd $(BUILD_DIR) ; $(LATEXMK_PVC) ../$<
diff --git a/common/imprint.tex b/common/imprint.tex
index 6a3e9a1..1b8ab2a 100644
--- a/common/imprint.tex
+++ b/common/imprint.tex
@@ -37,6 +37,9 @@ License:
\LaTeX{} sources at \url{https://github.com/pl33/dcs-lecture-notes}.
+Git commit hash: \texttt{\VcsCommitHashLong{} \ifdefined\VcsIsClean \else (dirty) \fi}\\
+Git commit date: \texttt{\VcsCommitTime}
+
\vspace{1.5em}
\hrule{}
diff --git a/common/settings.tex b/common/settings.tex
index e382b96..bc25edf 100644
--- a/common/settings.tex
+++ b/common/settings.tex
@@ -298,6 +298,8 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PDF Metadata
+\input{../build/vcs_info.tex}
+
\def\hyperrefgeneraltitle{Digital Communication Systems - \thekindofdocument{}}
\ifdefined\thesubtitle
\def\hyperreftitle{\hyperrefgeneraltitle{} - \thesubtitle{}}
@@ -308,7 +310,7 @@
\usepackage[
pdftitle={\hyperreftitle{}},
pdfauthor={Philipp Le},
- pdfcreator={LaTeX with hyperref and KOMA-Script on Arch Linux},
+ pdfcreator={LaTeX with hyperref and KOMA-Script on Arch Linux, Git commit \VcsCommitHashLong (\VcsCleanStr{}\VcsDirtyStr{})},
pdfsubject={},
pdfkeywords={},
pdfstartview={Fit},
diff --git a/common/titlepage.tex b/common/titlepage.tex
index c83303e..0832f5c 100755
--- a/common/titlepage.tex
+++ b/common/titlepage.tex
@@ -58,6 +58,6 @@
\begin{flushright}
\footnotesize
- Revision \therevision, \therevisiondate
+ Serial number \VcsCommitNo, \VcsCommitDate
\end{flushright}
\end{titlepage}
diff --git a/gen_vcs_info.sh b/gen_vcs_info.sh
new file mode 100755
index 0000000..129ec2c
--- /dev/null
+++ b/gen_vcs_info.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+SHA1_SHORT=`git rev-parse --short HEAD`
+SHA1_LONG=`git rev-parse HEAD`
+COMMIT_NO=`git rev-list --count HEAD`
+TIME_ISO=`git log -1 --format=%cd --date=iso8601`
+TIME_ISO_STRICT=`git log -1 --format=%cd --date=iso8601-strict`
+DATE=`git log -1 --format=%cd --date=short`
+
+if [ -z "$(git status --porcelain)" ]; then
+ CLEAN="clean"
+ DIRTY=""
+ IS_CLEAN="\\def\\VcsIsClean{}"
+else
+ CLEAN=""
+ DIRTY="dirty"
+ IS_CLEAN=""
+fi
+
+echo -e "\\def\\VcsCommitHashShort{$SHA1_SHORT}
+\\def\\VcsCommitHashLong{$SHA1_LONG}
+\\def\\VcsCommitNo{$COMMIT_NO}
+\\def\\VcsCommitTime{$TIME_ISO}
+\\def\\VcsCommitTimeISO{$TIME_ISO_STRICT}
+\\def\\VcsCommitDate{$DATE}
+\\def\\VcsCleanStr{$CLEAN}
+\\def\\VcsDirtyStr{$DIRTY}
+$IS_CLEAN
+"