Refactor wait-vpd-status from script to executable
This commit implements wait-vpd-status.sh logic as an application
written in C++. Moving the logic to C++ allows better error handling and
more flexibility with respect to future requirements.
Test:
```
1. Ensure vpd-manager CollectionStatus property is in "Completed" state.
2. Run wait-vpd-parser executable
3. Observe executable waits for 2s, then reads vpd-manager
CollectionStatus property and outputs a trace saying VPD collection
is completed, and then exits with return code 0
4. Using busctl change vpd-manager CollectionStatus property to
"InProgress"
5. Run wait-vpd-parser executable
6. Observe executable waits for 2s, and reads vpd-manager
CollectionStatus property for a total of 100 retries. After 100
retries, it outputs a trace saying timeout and exits with return code 1
7. Using busctl change vpd-manager CollectionStatus property to
"InProgress"
8. Run wait-vpd-parser executable
9. Observe executable waits for 2s, and reads vpd-manager with retry
count starting from 100 and counting down.
10. Now change CollectionStatus property to "Completed"
11. Observe executable reads vpd-manager CollectionStatus property and
outputs a trace saying VPD collection is completed, and then exits
with return code 0.
```
Change-Id: Ifa96a1262b73f4eacc6e13d4e05c710d6e693035
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/wait-vpd-parser/meson.build b/wait-vpd-parser/meson.build
new file mode 100644
index 0000000..c9d6a6e
--- /dev/null
+++ b/wait-vpd-parser/meson.build
@@ -0,0 +1,19 @@
+compiler = meson.get_compiler('cpp')
+if compiler.has_header('CLI/CLI.hpp')
+ CLI_dep = declare_dependency()
+else
+ CLI_dep = dependency('CLI11')
+endif
+
+sdbusplus = dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep'])
+dependency_list = [CLI_dep, sdbusplus]
+
+sources = ['src/wait_vpd_parser.cpp', '../vpd-manager/src/logger.cpp']
+
+wait_vpd_parser_exe = executable(
+ 'wait-vpd-parser',
+ sources,
+ include_directories: ['../', '../vpd-manager/include'],
+ dependencies: dependency_list,
+ install: true,
+)