Change in osmo-gsm-manuals[master]: *filter.conf/*.sty: use symlinks to build, common

osmith gerrit-no-reply at lists.osmocom.org
Wed Nov 21 15:12:53 UTC 2018


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/11798 )

Change subject: *filter.conf/*.sty: use symlinks to build, common
......................................................................

*filter.conf/*.sty: use symlinks to build, common

$(OSMO_GSM_MANUALS_DIR) is used in most places to reference to the top
dir, which contains "build" and "common". But not in the asciidoc
mscgen filter configurations, and in the custom LaTeX style. They have
../common or ../build hardcoded, which won't work anymore when the
project specific files will be in another repository.

Update the Makefiles to create symlinks to "build" and "common" in the
dir where the build was started. Use ./common in the files that had
../common hardcoded, and do the same for ./build.

Update the Makefile.common.inc comment to refer to common targets in
general, so we don't need to list each single one there (like the new
'common' and 'build' targets).

I've also thought about using variables there, but this would only work
for the asciidoc files, not for the .sty file. We would need to
generate the latter from another file and replace the variable
dynamically. Having the symlinks instead seemed to be slightly easier.

(moving manuals to project repositories 7/19)

Related: OS#3385
Change-Id: I4cfd1a9ef482d382f10cdf060e8e2cba81852864
---
M .gitignore
M build/Makefile.asciidoc.inc
M build/Makefile.common.inc
M build/Makefile.docbook.inc
M build/custom-dblatex.sty
M build/mscgen-filter.conf
M build/python2-filter.conf
7 files changed, 25 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Neels Hofmeyr: Looks good to me, approved



diff --git a/.gitignore b/.gitignore
index 30bc93e..b174bb9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,7 @@
 *.pc
 Makefile.in
 Makefile
+
+# symlinks to shared dirs (needed for out-of-tree builds)
+*/common
+*/build
diff --git a/build/Makefile.asciidoc.inc b/build/Makefile.asciidoc.inc
index 18cfa88..6b57c7d 100644
--- a/build/Makefile.asciidoc.inc
+++ b/build/Makefile.asciidoc.inc
@@ -54,7 +54,8 @@
 		$(ASCIIDOC_DEPS) \
 		$(ASCIIDOCSTYLE) \
 		$(OSMO_GSM_MANUALS_DIR)/common/*/*.adoc \
-		$(OSMO_GSM_MANUALS_DIR)/common/images/*
+		$(OSMO_GSM_MANUALS_DIR)/common/images/* \
+		build common
 	@test -n "$(BUILD_RELEASE)" && echo -e "\n\n\
 	  NOTE: TO REMOVE DRAFT MODE, YOU NEED TO EDIT build/custom-dblatex.sty\n\
 	        and remove three lines starting with '% \"DRAFT\" on first page'\n" \
@@ -64,7 +65,11 @@
 
 check: $(ASCIIDOC_CHECKS)
 
-$(ASCIIDOC_CHECKS): %.check: %.adoc %-docinfo.xml $(ASCIIDOCSTYLE) $(OSMO_GSM_MANUALS_DIR)/common/chapters/*.adoc $(ASCIIDOC_DEPS)
+$(ASCIIDOC_CHECKS): %.check: %.adoc %-docinfo.xml \
+		$(ASCIIDOCSTYLE) \
+		$(OSMO_GSM_MANUALS_DIR)/common/chapters/*.adoc \
+		$(ASCIIDOC_DEPS) \
+		build common
 	asciidoc -v $(ASCIIDOC_OPTS) $< > $@ 2>&1
 	# Make absolutely sure that the %.check target is updated.
 	touch $@
diff --git a/build/Makefile.common.inc b/build/Makefile.common.inc
index 6a210bc..efd56f6 100644
--- a/build/Makefile.common.inc
+++ b/build/Makefile.common.inc
@@ -3,9 +3,14 @@
 # Other makefiles like Makefile.asciidoc.inc and Makefile.vty-reference.inc add
 # entries to UPLOAD_FILES and CLEAN_FILES.
 #
-# Include this file at the end to have 'upload' and 'clean' targets.
+# Include this file at the end to have the common targets (upload, clean etc.).
 
 UPLOAD_PATH ?= generic at sysmocom-downloads:documents
+SYMLINKS = common build
+CLEAN_FILES += $(SYMLINKS)
+
+$(SYMLINKS):
+	ln -s $(OSMO_GSM_MANUALS_DIR)/$@ $@
 
 upload: $(UPLOAD_FILES)
 	rsync -avz $(UPLOAD_FILES) $(UPLOAD_PATH)/
diff --git a/build/Makefile.docbook.inc b/build/Makefile.docbook.inc
index b69fcea..4d015a7 100644
--- a/build/Makefile.docbook.inc
+++ b/build/Makefile.docbook.inc
@@ -32,6 +32,6 @@
 	xmllint --xinclude --postvalid --noout $<
 
 # Create a PDF file and lint it before
-%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS)
+%.pdf: %.xml %.xml-lint $(DOCBOOKS_DEPS) build common
 	dblatex $(dblatex_quiet) -P draft.mode=no $<
 
diff --git a/build/custom-dblatex.sty b/build/custom-dblatex.sty
index 606b9ab..16931ad 100644
--- a/build/custom-dblatex.sty
+++ b/build/custom-dblatex.sty
@@ -1,5 +1,6 @@
 %%
 %% This style is derived from the docbook one.
+%% "${OSMO_GSM_MANUALS_DIR}/common" is symlinked to ./common when building.
 %%
 \NeedsTeXFormat{LaTeX2e}
 \ProvidesPackage{asciidoc}[2008/06/05 AsciiDoc DocBook Style]
@@ -40,13 +41,13 @@
 \textsf{
 \vfill
 \begin{center}
-  \includegraphics{../common/images/sysmocom.pdf}
+  \includegraphics{./common/images/sysmocom.pdf}
   \ \\ %
   \huge{\Company}
 \end{center}
 \vspace{2.5cm}
 \begin{center}
-  \includegraphics{../common/images/osmocom.pdf}
+  \includegraphics{./common/images/osmocom.pdf}
   \ \\ %
   \vspace{0.5cm}
   \huge{\textbf{\DBKtitle}}\\ %
diff --git a/build/mscgen-filter.conf b/build/mscgen-filter.conf
index ce3cb3f..fa8f03e 100644
--- a/build/mscgen-filter.conf
+++ b/build/mscgen-filter.conf
@@ -1,9 +1,10 @@
 #
 # AsciiDoc mscgen filter configuration file.
+# ${OSMO_GSM_MANUALS}/build is symlinked to ./build when building.
 #
 
 [mscgen-filter-style]
-mscgen-style=template="mscgen-block",subs=(),posattrs=("style","target"),filter='../build/filter-wrapper.py mscgen -o "{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}" -T{format={basebackend-docbook!png}{basebackend-docbook?png}} -'
+mscgen-style=template="mscgen-block",subs=(),posattrs=("style","target"),filter='./build/filter-wrapper.py mscgen -o "{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}" -T{format={basebackend-docbook!png}{basebackend-docbook?png}} -'
 
 [blockdef-listing]
 template::[mscgen-filter-style]
diff --git a/build/python2-filter.conf b/build/python2-filter.conf
index ca2ddaf..812c7c2 100644
--- a/build/python2-filter.conf
+++ b/build/python2-filter.conf
@@ -1,9 +1,10 @@
 #
 # AsciiDoc mscgen filter configuration file.
+# ${OSMO_GSM_MANUALS}/build is symlinked to ./build when building.
 #
 
 [python2-filter-style]
-python2-style=template="python2-block",subs=(),posattrs=("style","target"),filter='../build/filter-wrapper.py python2 - --output="{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}"'
+python2-style=template="python2-block",subs=(),posattrs=("style","target"),filter='./build/filter-wrapper.py python2 - --output="{outdir={indir}}/{imagesdir=}{imagesdir?/}{target}"'
 
 [blockdef-listing]
 template::[python2-filter-style]

-- 
To view, visit https://gerrit.osmocom.org/11798
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4cfd1a9ef482d382f10cdf060e8e2cba81852864
Gerrit-Change-Number: 11798
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181121/ffb34380/attachment.html>


More information about the gerrit-log mailing list