This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/18362 )
Change subject: vty reference: allow reference XML generated at build time
......................................................................
vty reference: allow reference XML generated at build time
Add variable BUILT_REFERENCE_XML for callers to indicate dependencies for the
VTY reference.
Add script find_existing_path.sh to pick a given path from either builddir or
srcdir, whichever exists.
In Makefile.vty-reference.inc, use find_existing_path.sh to make the VTY
reference build rules work no matter whether the reference.xml is built in
builddir or committed in srcdir.
Change-Id: I613d692328050a036d05b49a436ab495fc2087ba
---
M build/Makefile.vty-reference.inc
A build/find_existing_path.sh
2 files changed, 43 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/build/Makefile.vty-reference.inc b/build/Makefile.vty-reference.inc
index b2daf8a..c1db67b 100644
--- a/build/Makefile.vty-reference.inc
+++ b/build/Makefile.vty-reference.inc
@@ -6,6 +6,12 @@
# Manual additions to specific VTY nodes, any number of files.
# - vty/*_reference.xml
# Export from VTY 'show online-help', exactly one file.
+# The vty/*_reference.xml file may also live in the $(builddir)/vty/,
+# in which case you need to add it to BUILT_REFERENCE_XML, and provide a build rule, like:
+# BUILT_REFERENCE_XML = $(builddir)/vty/osmoyada_reference.xml
+# $(builddir)/vty/osmoyada_reference.xml:
+# mkdir -p $(builddir)/vty
+# $(top_builddir)/src/osmoyada --vty-ref-xml > $@
#
# In your Makefile.am,
# - define 'OSMO_GSM_MANUALS_DIR' to point at the osmo-gsm-manuals shared files
@@ -34,6 +40,12 @@
# your new VTY_REFERENCE entry ("vty-osmobar" in this example).
# - Add osmobar-vty-reference.xml and vty-osmobar to EXTRA_DIST in Makefile.am.
# - Full example: osmo-sgsn.git I24c3ca2fc2446673edceefb797c7d800c3a1a5d2
+# - The vty-osmobar/*_reference.xml may also live in the builddir: add it to
+# BUILT_REFERENCE_XML and provide a build rule, like:
+# BUILT_REFERENCE_XML += $(builddir)/vty-osmobar/osmobar_reference.xml
+# $(builddir)/vty-osmobar/osmobar_reference.xml: $(top_builddir)/src/osmobar
+# mkdir -p $(builddir)/vty-osmobar
+# $(top_builddir)/src/osmobar --vty-ref-xml > $@
DOCBOOKS = $(VTY_REFERENCE)
@@ -51,15 +63,17 @@
MERGE_DOC = $(shell realpath $(OSMO_GSM_MANUALS_DIR)/merge_doc.xsl)
CLEAN_FILES += generated
+CLEAN_FILES += $(BUILT_REFERENCE_XML)
# First VTY reference
generated/docbook_vty.xml: \
$(srcdir)/vty/*xml \
+ $(BUILT_REFERENCE_XML) \
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
$(OSMO_GSM_MANUALS_DIR)/common/chapters/vty.xml \
$(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl
$(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \
- $(srcdir)/vty/*reference.xml \
+ $$($(OSMO_GSM_MANUALS_DIR)/build/find_existing_path.sh "vty/*reference.xml" $(builddir) $(srcdir)) \
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
$(srcdir)/vty/*additions*.xml
xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl generated/combined.xml \
@@ -68,13 +82,16 @@
# Additional VTY references
generated/docbook_%-vty-reference.xml: \
$(srcdir)/vty-%/*xml \
+ $(BUILT_REFERENCE_XML) \
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
$(OSMO_GSM_MANUALS_DIR)/common/chapters/vty.xml \
$(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl
- export VTYDIR="$(srcdir)/vty-$(patsubst generated/docbook_%-vty-reference.xml,%,$@)" && \
+ export VTYDIR_NAME="vty-$(patsubst generated/docbook_%-vty-reference.xml,%,$@)" && \
+ export VTYDIR_SRC="$(srcdir)/$$VTYDIR_NAME" && \
+ export VTYDIR_BUILD="$(builddir)/$$VTYDIR_NAME" && \
export VTYGEN="$@_combine" && \
$(OSMO_GSM_MANUALS_DIR)/build/vty_reference_combine.sh "$(MERGE_DOC)" \
- $$VTYDIR/*reference.xml \
+ $$($(OSMO_GSM_MANUALS_DIR)/build/find_existing_path.sh "*reference.xml" $$VTYDIR_BUILD $$VTYDIR_SRC) \
$(OSMO_GSM_MANUALS_DIR)/common/vty_additions.xml \
- $$VTYDIR/*additions*.xml && \
+ $$VTYDIR_SRC/*additions*.xml && \
xsltproc $(OSMO_GSM_MANUALS_DIR)/vty_reference.xsl $$VTYGEN/combined.xml > "$@"
diff --git a/build/find_existing_path.sh b/build/find_existing_path.sh
new file mode 100755
index 0000000..08fcc71
--- /dev/null
+++ b/build/find_existing_path.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Pick a path, depending on where such path exists:
+# find_existing_path.sh "want/*.file" ./dir1 ../../dir2 /tmp/dir3
+# prints the first existing match:
+# ../../dir2/want/foo.file
+# or just the first argument if none is found:
+# want/*.file
+path="$1"
+
+shift 1
+for dir in $@ ; do
+ for f in "$dir"/$path ; do
+ if [ ! -r "$f" ]; then
+ continue
+ fi
+ echo "$f"
+ exit 0
+ done
+done
+
+echo "$path"
+exit 1
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-manuals/+/18362
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-Change-Id: I613d692328050a036d05b49a436ab495fc2087ba
Gerrit-Change-Number: 18362
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200613/6c9d1f5a/attachment.htm>