Change in osmo-gsm-manuals[master]: Makefile: move dep-check code to check-depends.sh

osmith gerrit-no-reply at lists.osmocom.org
Mon Nov 12 13:05:49 UTC 2018


osmith has uploaded this change for review. ( https://gerrit.osmocom.org/11737


Change subject: Makefile: move dep-check code to check-depends.sh
......................................................................

Makefile: move dep-check code to check-depends.sh

Make it possible to run the dependency check without the Makefile. This
is needed to split up the manual pages into the projects repositories,
so we can call check-depends.sh from there.

Related: OS#3385
Change-Id: I82a7efd7e9c265c82d1ba8a60856c892a15a7a33
---
M Makefile
A check-depends.sh
2 files changed, 31 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gsm-manuals refs/changes/37/11737/1

diff --git a/Makefile b/Makefile
index 34c18ad..eb3be75 100644
--- a/Makefile
+++ b/Makefile
@@ -72,21 +72,5 @@
 	cd OsmocomBB; $(MAKE) check
 	cd OsmoTRX; $(MAKE) check
 
-define check_dep_bin
-    @type $(1) >/dev/null 2>&1 || { echo >&2 "Binary '$(1)' not found in path, please install $(2)."; exit 1; }
-endef
-define check_dep_python2_module
-    @echo "import $(1)" | python2 - >/dev/null 2>&1 || { echo >&2 "Failed to import '$(1)' module, please install $(2)."; exit 1; }
-endef
-
 check-deps:
-	$(call check_dep_bin,mscgen,mscgen)
-	$(call check_dep_bin,xsltproc,libxslt)
-	$(call check_dep_bin,git,git)
-	$(call check_dep_bin,a2x,asciidoc)
-	$(call check_dep_bin,asciidoc,asciidoc)
-	$(call check_dep_bin,dblatex,dblatex)
-	$(call check_dep_bin,packetdiag,nwdiag)
-	$(call check_dep_bin,dot,graphviz)
-	$(call check_dep_bin,python2,python2)
-	$(call check_dep_python2_module,pychart,python2-pychart)
+	./check-depends.sh
diff --git a/check-depends.sh b/check-depends.sh
new file mode 100755
index 0000000..7845719
--- /dev/null
+++ b/check-depends.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# $1: program name, $2: package name
+check_dep_bin() {
+	if ! type "$1" >/dev/null 2>&1; then
+		echo "Binary '$1' not found in path, please install $2."
+		exit 1
+	fi
+}
+
+# $1: module name, $2: package name
+check_dep_python2_module() {
+	if ! echo "import $1" | python2 - >/dev/null 2>&1; then
+		echo "Failed to import '$1' module, please install $2."
+		exit 1
+	fi
+}
+
+check_dep_bin mscgen mscgen
+check_dep_bin xsltproc libxslt
+check_dep_bin git git
+check_dep_bin a2x asciidoc
+check_dep_bin asciidoc asciidoc
+check_dep_bin dblatex dblatex
+check_dep_bin packetdiag nwdiag
+check_dep_bin dot graphviz
+check_dep_bin python2 python2
+check_dep_python2_module pychart python2-pychart
+
+echo "All dependencies installed!"

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

Gerrit-Project: osmo-gsm-manuals
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I82a7efd7e9c265c82d1ba8a60856c892a15a7a33
Gerrit-Change-Number: 11737
Gerrit-PatchSet: 1
Gerrit-Owner: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181112/65df711f/attachment.html>


More information about the gerrit-log mailing list