Gentoo Archives: gentoo-pms

From: Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>
To: gentoo-pms@l.g.o
Cc: Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>
Subject: [gentoo-pms] [PATCH] How about a \ChangeWhenAddingAnEAPI marker?
Date: Sun, 06 May 2012 15:36:49
Message-Id: 1336318433-5790-1-git-send-email-ciaran.mccreesh@googlemail.com
It's easy to miss some places that have to be updated when adding a new
EAPI. This hack fixes that. It works like this:

In pms.tex, at the top, we say

    \CurrentEAPIIs{4}

Then everywhere where we have EAPI dependent content, we put

    \ChangeWhenAddingAnEAPI{4}

which we can then grep for. Also, if you change the current EAPI, and
forget to change any of the markers, an error is produced.

I've not updated everywhere that needs this yet; there's just one
example. There might be a better way of getting the same effect. If not,
I'll go through carefully and put these in before we start work on 5.
---
 dependencies.tex |    1 +
 pms.cls          |    5 +++++
 pms.tex          |    3 +++
 3 files changed, 9 insertions(+)

diff --git a/dependencies.tex b/dependencies.tex
index 0f74b3b..5f91eb5 100644
--- a/dependencies.tex
+++ b/dependencies.tex
@@ -76,6 +76,7 @@ be surrounded on both sides by whitespace, except at the start and end of the st
 
 In particular, note that whitespace is not optional.
 
+\ChangeWhenAddingAnEAPI{4}
 \begin{centertable}{EAPIs supporting \t{SRC\_URI} arrows} \label{tab:uri-arrows-table}
     \begin{tabular}{ l l }
         \toprule
diff --git a/pms.cls b/pms.cls
index db2fd48..a37d78a 100644
--- a/pms.cls
+++ b/pms.cls
@@ -147,6 +147,11 @@
 % margin.
 \areaset[-30mm]{400pt}{700pt}
 
+% To find everywhere that needs updating when we add an EAPI
+\newcommand{\CurrentEAPIIs}[1]{\def\TheCurrentEAPI{#1}}
+\newcommand{\ChangeWhenAddingAnEAPI}[1]{\ifthenelse{\equal{\TheCurrentEAPI}{#1}}{}{\errmessage{This
+needs to be updated for EAPI \TheCurrentEAPI}}}
+
 % vim: set filetype=tex fileencoding=utf8 et tw=100 spell spelllang=en :
 
 %%% Local Variables:
diff --git a/pms.tex b/pms.tex
index 4ada8ec..1c9ed30 100644
--- a/pms.tex
+++ b/pms.tex
@@ -1,5 +1,8 @@
 \documentclass{pms}
 
+\CurrentEAPIIs{4}
+\ChangeWhenAddingAnEAPI{4}
+
 \begin{document}
 \maketitle
 
-- 
1.7.10.1

Replies