yaml: move to subdirectory
A pending sdbusplus change (I38b69bc67b6a3d80cda1b508a76e106a50d8ab93)
is going to require YAML to be in a specific subdirectory and not in
the root. Move here in prep for that change.
Also add in the regenerate-meson script as a helper to regenerate
the sdbusplus meson files for this repository.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I2c9e74b85550e3e8f0f5cb56a82e85c5b13c6d00
diff --git a/gen/meson.build b/gen/meson.build
index af850f2..2756633 100644
--- a/gen/meson.build
+++ b/gen/meson.build
@@ -4,10 +4,10 @@
'--version',
).stdout().strip().split('\n')[0]
-if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 2'
+if sdbuspp_gen_meson_ver != 'sdbus++-gen-meson version 4'
warning('Generated meson files from wrong version of sdbus++-gen-meson.')
warning(
- 'Expected "sdbus++-gen-meson version 2", got:',
+ 'Expected "sdbus++-gen-meson version 4", got:',
sdbuspp_gen_meson_ver
)
endif
diff --git a/gen/org/open_power/Host/Boot/meson.build b/gen/org/open_power/Host/Boot/meson.build
index 718b2c2..6a86ba3 100644
--- a/gen/org/open_power/Host/Boot/meson.build
+++ b/gen/org/open_power/Host/Boot/meson.build
@@ -1,13 +1,14 @@
# Generated file; do not modify.
generated_sources += custom_target(
'org/open_power/Host/Boot__cpp'.underscorify(),
- input: [ meson.project_source_root() / 'org/open_power/Host/Boot.errors.yaml', ],
+ input: [ '../../../../../yaml/org/open_power/Host/Boot.errors.yaml', ],
output: [ 'error.cpp', 'error.hpp', ],
+ depend_files: sdbusplusplus_depfiles,
command: [
sdbuspp_gen_meson_prog, '--command', 'cpp',
'--output', meson.current_build_dir(),
'--tool', sdbusplusplus_prog,
- '--directory', meson.project_source_root(),
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
'org/open_power/Host/Boot',
],
)
diff --git a/gen/org/open_power/Host/meson.build b/gen/org/open_power/Host/meson.build
index fed2c12..4c34ff4 100644
--- a/gen/org/open_power/Host/meson.build
+++ b/gen/org/open_power/Host/meson.build
@@ -2,15 +2,15 @@
subdir('Boot')
generated_others += custom_target(
'org/open_power/Host/Boot__markdown'.underscorify(),
- input: [ meson.project_source_root() / 'org/open_power/Host/Boot.errors.yaml', ],
+ input: [ '../../../../yaml/org/open_power/Host/Boot.errors.yaml', ],
output: [ 'Boot.md' ],
+ depend_files: sdbusplusplus_depfiles,
command: [
sdbuspp_gen_meson_prog, '--command', 'markdown',
'--output', meson.current_build_dir(),
'--tool', sdbusplusplus_prog,
- '--directory', meson.project_source_root(),
+ '--directory', meson.current_source_dir() / '../../../../yaml',
'org/open_power/Host/Boot',
],
- build_by_default: true,
)
diff --git a/gen/regenerate-meson b/gen/regenerate-meson
new file mode 100755
index 0000000..a39ad64
--- /dev/null
+++ b/gen/regenerate-meson
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+REPO_ROOT=$(git rev-parse --show-toplevel)
+
+# Find sdbus++-gen-meson
+# 1. Check $SDBUSPP_GEN_MESON
+# 2. Check in $PATH
+# 3. Check in subprojects/sdbusplus
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+ SDBUSPP_GEN_MESON="$(which sdbus++-gen-meson 2> /dev/null)"
+fi
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+ SDBUSPP_GEN_MESON="$REPO_ROOT/subprojects/sdbusplus/tools/sdbus++-gen-meson"
+fi
+if [ ! -x "$SDBUSPP_GEN_MESON" ]; then
+ echo "Cannot find sdbus++-gen-meson ($SDBUSPP_GEN_MESON)."
+ exit 1
+fi
+
+$SDBUSPP_GEN_MESON \
+ --command meson \
+ --directory "$REPO_ROOT/yaml" \
+ --output "$REPO_ROOT/gen"
diff --git a/gen/run-ci b/gen/run-ci
new file mode 100755
index 0000000..dba8109
--- /dev/null
+++ b/gen/run-ci
@@ -0,0 +1,16 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit
+find . -mindepth 1 -maxdepth 1 -type d -exec rm -r {} \;
+./regenerate-meson || exit
+rc=0
+git --no-pager diff --exit-code -- . || rc=$?
+untracked="$(git ls-files --others --exclude-standard -- .)" || rc=$?
+if [ -n "$untracked" ]; then
+ echo "Untracked files:" >&2
+ echo "$untracked" >&2
+ rc=1
+fi
+if ((rc != 0)); then
+ echo "Generated meson files differ from expected values" >&2
+ exit 1
+fi