[dpdk-ci] [PATCH v5 3/9] config: add loader and template

Thomas Monjalon thomas.monjalon at 6wind.com
Thu Dec 15 00:05:17 CET 2016


The configuration file will allow to set some environment-specific
options and paths to be used by the scripts.

Signed-off-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 README                  | 11 +++++++++++
 config/ci.config        |  4 ++++
 tools/load-ci-config.sh | 14 ++++++++++++++
 3 files changed, 29 insertions(+)
 create mode 100644 config/ci.config
 create mode 100644 tools/load-ci-config.sh

diff --git a/README b/README
index 806ce8f..12a208c 100644
--- a/README
+++ b/README
@@ -52,3 +52,14 @@ Scripts help
 Some scripts in this repository (dpdk-ci) may help to build a test.
 
 Their purpose and options are described when using the option -h.
+
+
+Scripts configuration
+---------------------
+
+Some scripts may need some configuration.
+
+The file config/ci.config will be read if it is copied to /etc/dpdk/ci.config,
+~/.config/dpdk/ci.config or .ciconfig in this directory.
+The optional options can be uncommented to change the default values used in
+the scripts.
diff --git a/config/ci.config b/config/ci.config
new file mode 100644
index 0000000..2aeff04
--- /dev/null
+++ b/config/ci.config
@@ -0,0 +1,4 @@
+# Configuration template to be copied in
+#         /etc/dpdk/ci.config
+#     or  ~/.config/dpdk/ci.config
+#     or  .ciconfig
diff --git a/tools/load-ci-config.sh b/tools/load-ci-config.sh
new file mode 100644
index 0000000..9ec18b4
--- /dev/null
+++ b/tools/load-ci-config.sh
@@ -0,0 +1,14 @@
+#! /bin/echo must be loaded with .
+
+# Load DPDK CI config and allow override
+# from system file
+test ! -r /etc/dpdk/ci.config ||
+        . /etc/dpdk/ci.config
+# from user file
+test ! -r ~/.config/dpdk/ci.config ||
+        . ~/.config/dpdk/ci.config
+# from local file
+test ! -r $(dirname $(readlink -m $0))/../.ciconfig ||
+        . $(dirname $(readlink -m $0))/../.ciconfig
+
+# The config files must export variables in the shell style
-- 
2.7.0



More information about the ci mailing list