summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--Makefile44
-rw-r--r--eapi-cheatsheet.tex12
-rw-r--r--pms.cls25
-rw-r--r--vc24
-rw-r--r--vc-git.awk85
6 files changed, 47 insertions, 145 deletions
diff --git a/.gitignore b/.gitignore
index 6d150b7..583b6ae 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@
*.blg
*.css
*.dvi
+*.gin
*.html
*.idv
*.lg
@@ -18,7 +19,6 @@
*.tmp
*.toc
*.xref
-vc.tex
# Emacs backup files and locks
*~
diff --git a/Makefile b/Makefile
index d10a65a..5359342 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
-LATEXFILES := $(filter-out vc.tex,$(wildcard *.tex)) pms.cls
-SOURCES = $(LATEXFILES) pms.bib vc vc-git.awk Makefile
+LATEXFILES := $(wildcard *.tex) pms.cls
+SOURCES = $(LATEXFILES) pms.bib Makefile
+COMMITINFO = gitHeadLocal.gin
TWOSIDE =
@@ -10,7 +11,7 @@ all: pms.pdf
html: pms.html
-pms.pdf eapi-cheatsheet.pdf: $(LATEXFILES) pms.bbl vc.tex
+pms.pdf eapi-cheatsheet.pdf: $(LATEXFILES) pms.bbl $(COMMITINFO)
$(aux-clean)
set -e; \
while true; do \
@@ -32,7 +33,7 @@ eapi-cheatsheet-nocombine.pdf: pms.pdf
grep -q 'Warning.*Rerun' eapi-cheatsheet-nocombine.log || break; \
done
-pms.dvi: $(LATEXFILES) pms.bbl vc.tex
+pms.dvi: $(LATEXFILES) pms.bbl $(COMMITINFO)
$(aux-clean)
set -e; \
while true; do \
@@ -40,7 +41,7 @@ pms.dvi: $(LATEXFILES) pms.bbl vc.tex
grep -q 'Warning.*Rerun' pms.log || break; \
done
-pms.html: $(LATEXFILES) pms.bbl vc.tex
+pms.html: $(LATEXFILES) pms.bbl $(COMMITINFO)
set -e; sum=''; \
while true; do \
mk4ht xhlatex pms xhtml,fn-in; \
@@ -58,26 +59,37 @@ pms.html: $(LATEXFILES) pms.bbl vc.tex
@# remove redundant span elements
LC_ALL=C sed -i -e ':x;/<span\(\s\+[^>]*\)\?$$/{N;bx;};:y;s/\(<span\s\+[^>]*>\)\([^<]*\)<\/span>\1/\1\2/;ty' $@
-pms.bbl: pms.bib $(LATEXFILES) vc.tex
+pms.bbl: pms.bib $(LATEXFILES) $(COMMITINFO)
$(aux-clean)
latex pms
bibtex pms
-vc.tex: $(SOURCES)
- /bin/sh ./vc -m
-
-dist: $(SOURCES) vc.tex pms.pdf pms.html
+$(COMMITINFO): $(SOURCES)
+ @# see gitinfo2 documentation
+ reltag=$$(git describe --tags --long --always --dirty='-*' \
+ --match='eapi-*-approved*' 2>/dev/null); \
+ if test -n "$${reltag}"; then \
+ TZ=UTC git log -1 --date=short-local --decorate=short \
+ --pretty="format:\usepackage[%%%n shash={%h},%n\
+ lhash={%H},%n authname={%an},%n authemail={%ae},%n\
+ authsdate={%ad},%n authidate={%ai},%n authudate={%at},%n\
+ commname={%cn},%n commemail={%ce},%n commsdate={%cd},%n\
+ commidate={%ci},%n commudate={%ct},%n refnames={%d},%n\
+ reltag={$${reltag}}%n]{gitexinfo}%n" > $@; \
+ fi
+
+dist: $(SOURCES) $(COMMITINFO) pms.pdf pms.html
PV='$(PV)'; \
if test -z "$${PV}"; then \
current_eapi=$$(sed -n 's/.*CurrentEAPIIs{\(.*\)}.*/\1/p' pms.tex); \
- vc_date=$$(sed -n \
- 's/.*VCDateISO{\([0-9]*\)-\([0-9]*\)-\([0-9]*\)}.*/\1\2\3/p' \
- vc.tex); \
- PV=$${current_eapi}_p$${vc_date}; \
+ commit_date=$$(sed -n \
+ 's/.*commsdate={\([0-9]*\)-\([0-9]*\)-\([0-9]*\)}.*/\1\2\3/p' \
+ $(COMMITINFO)); \
+ PV=$${current_eapi}_p$${commit_date}; \
fi; \
echo "PV = $${PV}"; \
tar -cJf pms-"$${PV}".tar.xz --transform="s%^%pms-$${PV}/%" \
- $(SOURCES) vc.tex && \
+ $(SOURCES) $(COMMITINFO) && \
tar -cJf pms-"$${PV}"-prebuilt.tar.xz --transform="s%^%pms-$${PV}/%" \
pms.pdf eapi-cheatsheet.pdf pms*.html pms.css
@@ -90,7 +102,7 @@ clean:
*.lot *.out *.html *.css *.png *.4ct *.4tc *.idv *.lg *.tmp *.xref
maintainer-clean: clean
- rm -f vc.tex
+ rm -f $(COMMITINFO)
.PHONY: all html dist upload clean maintainer-clean
diff --git a/eapi-cheatsheet.tex b/eapi-cheatsheet.tex
index 61481d0..e785ed6 100644
--- a/eapi-cheatsheet.tex
+++ b/eapi-cheatsheet.tex
@@ -12,6 +12,7 @@
\usepackage[orig,english]{isodate}
\usepackage[scaled=.90]{helvet}
\usepackage[nohyphen]{underscore}
+\usepackage[local]{gitinfo2}
\newcommand{\code}[1]{\texttt{#1}}
% This should reflect the latest approved EAPI version
\newcommand{\version}{7.0}
@@ -28,12 +29,11 @@
Ulrich Müller \\
\href{mailto:ulm@gentoo.org}{ulm@gentoo.org}
}
-\input{vc.tex}
-\ifthenelse{\equal{\VCDateISO}{}}
-{
- \date{Version \version{}, generated on: \\\today}
-}{
- \date{Version \version\\\printdate{\VCDateISO}}
+\date{%
+ Version \version \\
+ \ifthenelse{\equal{\gitCommitterDate}{(None)}}
+ {Generated on: \today}
+ {\printdate{\gitCommitterDate}}%
}
\CutLine*{1}
\CutLine*{3}
diff --git a/pms.cls b/pms.cls
index 66e1828..e00b4e9 100644
--- a/pms.cls
+++ b/pms.cls
@@ -25,6 +25,7 @@
\PassOptionsToPackage{nohyphen}{underscore}
\PassOptionsToPackage{nottoc,notlot,notlof}{tocbibind}
\PassOptionsToPackage{hyphens}{url} % url.sty implicitly loaded by hyperref
+\PassOptionsToPackage{local}{gitinfo2}
\PassOptionsToPackage{chapter}{algorithm}
% algorithmic and algorithm to be loaded last to avoid failures
\RequirePackage{%
@@ -52,15 +53,13 @@
caption, % Extended float environment formatting
float, % More control over float environments
hyperref, % Support for hyperlinks
+ gitinfo2, % Metadata from git
algorithm, %
algorithmic % Set algorithms
}
}
\ClassInfo{pms}{Capsulation of LaTeX stuff for the Package Manager
Specification, loaded baseclass: \ClassToLoad\MessageBreak}
-% Contains information over the source control system, generated
-% through Makefile
-\input{vc.tex}
% Make processing with TeX4HT possible
\newboolean{TEX4HT-HACKS}
@@ -160,16 +159,16 @@
}
% Reads the last commit date from the Git repository and even succeeds
% when none is available
-\ifthenelse{\equal{\VCDateISO}{}}
-{
- \date{Generated on: \today}
- \newcommand{\commitinfo}{}
-}{
- \date{\printdate{\VCDateISO}}
- \newcommand{\commitinfo}{%
- This version corresponds to commit \VCRevision
- \ifthenelse{\VCModified=0}{}{ with local changes}.
- }
+\date{%
+ \ifthenelse{\equal{\gitCommitterDate}{(None)}}
+ {Generated on: \today}
+ {\printdate{\gitCommitterDate}}%
+}
+\newcommand{\commitinfo}{%
+ \ifthenelse{\equal{\gitCommitterDate}{(None)}}{}{%
+ This version corresponds to commit \gitAbbrevHash
+ \ifthenelse{\equal{\gitDirty}{}}{}{ with local changes}.%
+ }%
}
% Set page title
diff --git a/vc b/vc
deleted file mode 100644
index 4ad591e..0000000
--- a/vc
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-# This is file 'vc' from the vc bundle for TeX.
-# The original file can be found at CTAN:support/vc.
-# This file is Public Domain.
-
-# Parse command line options.
-full=0
-mod=0
-while [ -n "$(echo $1 | grep '-')" ]; do
- case $1 in
- -f ) full=1 ;;
- -m ) mod=1 ;;
- * ) echo 'usage: vc [-f] [-m]'
- exit 1
- esac
- shift
-done
-# English locale.
-LC_ALL=C
-TZ=UTC git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %ad%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %cd%n" --date=iso-local | gawk -v script=log -v full=$full -f vc-git.awk > vc.tex
-if [ "$mod" = 1 ]
-then
- git status --porcelain |gawk -v script=status -f vc-git.awk >> vc.tex
-fi
diff --git a/vc-git.awk b/vc-git.awk
deleted file mode 100644
index 8b9b052..0000000
--- a/vc-git.awk
+++ /dev/null
@@ -1,85 +0,0 @@
-# This is file 'vc-git.awk' from the vc bundle for TeX.
-# The original file can be found at CTAN:support/vc.
-# This file is Public Domain.
-BEGIN {
-### Process output of "git status".
- if (script=="status") {
- modified = 0
- }
-}
-
-
-
-### Process output of "git log".
-script=="log" && /^Hash:/ { Hash = substr($0, 2+match($0, ":")) }
-script=="log" && /^Abr. Hash:/ { AbrHash = substr($0, 2+match($0, ":")) }
-script=="log" && /^Parent Hashes:/ { ParentHashes = substr($0, 2+match($0, ":")) }
-script=="log" && /^Abr. Parent Hashes:/ { AbrParentHashes = substr($0, 2+match($0, ":")) }
-script=="log" && /^Author Name:/ { AuthorName = substr($0, 2+match($0, ":")) }
-script=="log" && /^Author Email:/ { AuthorEmail = substr($0, 2+match($0, ":")) }
-script=="log" && /^Author Date:/ { AuthorDate = substr($0, 2+match($0, ":")) }
-script=="log" && /^Committer Name:/ { CommitterName = substr($0, 2+match($0, ":")) }
-script=="log" && /^Committer Email:/ { CommitterEmail = substr($0, 2+match($0, ":")) }
-script=="log" && /^Committer Date:/ { CommitterDate = substr($0, 2+match($0, ":")) }
-
-### Process output of "git status".
-### Changed index?
-script=="status" && /^[MADRC]/ { if (modified == 0) modified = 1 }
-### Unstaged modifications?
-script=="status" && /^.[MD]/ { modified = 2 }
-
-
-
-END {
-### Process output of "git log".
- if (script=="log") {
-### Standard encoding is UTF-8.
- if (Encoding == "") Encoding = "UTF-8"
-### Extract relevant information from variables.
- LongDate = substr(CommitterDate, 1, 25)
- DateRAW = substr(LongDate, 1, 10)
- DateISO = DateRAW
- DateTEX = DateISO
- gsub("-", "/", DateTEX)
- Time = substr(LongDate, 12, 14)
-### Write file identification to vc.tex.
- print "%%% This file has been generated by the vc bundle for TeX."
- print "%%% Do not edit this file!"
- print "%%%"
-### Write Git specific macros.
- print "%%% Define Git specific macros."
- print "\\gdef\\GITHash{" Hash "}%"
- print "\\gdef\\GITAbrHash{" AbrHash "}%"
- print "\\gdef\\GITParentHashes{" ParentHashes "}%"
- print "\\gdef\\GITAbrParentHashes{" AbrParentHashes "}%"
- print "\\gdef\\GITAuthorName{" AuthorName "}%"
- print "\\gdef\\GITAuthorEmail{" AuthorEmail "}%"
- print "\\gdef\\GITAuthorDate{" AuthorDate "}%"
- print "\\gdef\\GITCommitterName{" CommitterName "}%"
- print "\\gdef\\GITCommitterEmail{" CommitterEmail "}%"
- print "\\gdef\\GITCommitterDate{" CommitterDate "}%"
-### Write generic version control macros.
- print "%%% Define generic version control macros."
- print "\\gdef\\VCRevision{\\GITAbrHash}%"
- print "\\gdef\\VCAuthor{\\GITAuthorName}%"
- print "\\gdef\\VCDateRAW{" DateRAW "}%"
- print "\\gdef\\VCDateISO{" DateISO "}%"
- print "\\gdef\\VCDateTEX{" DateTEX "}%"
- print "\\gdef\\VCTime{" Time "}%"
- print "\\gdef\\VCModifiedText{\\textcolor{red}{with local modifications!}}%"
- print "%%% Assume clean working copy."
- print "\\gdef\\VCModified{0}%"
- print "\\gdef\\VCRevisionMod{\\VCRevision}%"
- }
-
-### Process output of "git status".
- if (script=="status") {
- print "%%% Is working copy modified?"
- print "\\gdef\\VCModified{" modified "}%"
- if (modified==0) {
- print "\\gdef\\VCRevisionMod{\\VCRevision}%"
- } else {
- print "\\gdef\\VCRevisionMod{\\VCRevision~\\VCModifiedText}%"
- }
- }
-}