From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E53841382C5 for ; Mon, 7 May 2018 17:05:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E7FDFE085B; Mon, 7 May 2018 17:05:17 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id ABF70E085B for ; Mon, 7 May 2018 17:05:17 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 64193335C74 for ; Mon, 7 May 2018 17:05:16 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7844027 for ; Mon, 7 May 2018 17:05:14 +0000 (UTC) From: "Ulrich Müller" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Ulrich Müller" Message-ID: <1525464432.0ce392fe023c489a1834a25e1fbf7dc406f86a0c.ulm@gentoo> Subject: [gentoo-commits] proj/pms:master commit in: / X-VCS-Repository: proj/pms X-VCS-Files: .gitignore Makefile eapi-cheatsheet.tex pms.cls vc vc-git.awk X-VCS-Directories: / X-VCS-Committer: ulm X-VCS-Committer-Name: Ulrich Müller X-VCS-Revision: 0ce392fe023c489a1834a25e1fbf7dc406f86a0c X-VCS-Branch: master Date: Mon, 7 May 2018 17:05:14 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: cefedc3a-cc27-425e-9a07-ec50b194abcc X-Archives-Hash: ab4660456503d388eef3611e493cdc68 commit: 0ce392fe023c489a1834a25e1fbf7dc406f86a0c Author: Ulrich Müller gentoo org> AuthorDate: Mon Feb 19 18:55:09 2018 +0000 Commit: Ulrich Müller gentoo org> CommitDate: Fri May 4 20:07:12 2018 +0000 URL: https://gitweb.gentoo.org/proj/pms.git/commit/?id=0ce392fe Change from vc to gitinfo2 for git metadata. The gitinfo2 package is included with TeXLive, has better support for git (e.g., information about branches and tags), and doesn't need any local scripts in the repository itself. .gitignore | 2 +- Makefile | 44 +++++++++++++++++---------- eapi-cheatsheet.tex | 12 ++++---- pms.cls | 25 ++++++++-------- vc | 24 --------------- vc-git.awk | 85 ----------------------------------------------------- 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;/]*\)\?$$/{N;bx;};:y;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}%" - } - } -}