VPD Tool: Update Hardware

Vpd tool has --Hardware/-H flag which should be given along
with writeKeyword flags, if the user wants to write directly to "Hardware".

In general the user should give only the object path in
--path/-P value.

Only if --Hardware/-H flag is given, the user has an
option to give either eeprom path or the object path in
--path/-P value.

Test:
Tested on simics.

./vpd-tool --writeKeyword -H --path < hardware path/object path > -R < record name > -K < keyword > -V < value in hex/ascii >

CASE 1: <updating eeprom path> < update directly on hardware using -H.>
./vpd-tool -u -H -P /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a480.i2c-bus/i2c-8/8-0051/8-00510/nvmem -R VINI -K PN -V 0x717273
updation successful on both dbus and hardware.

CASE 2:
./vpd-tool -u -H -P /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a480.i2c-bus/i2c-8/8-0051/8-00510/nvmem -R DINF -K FL -V 0x717273
updation successful on hardware. <this wont get updated in dbus as the given record-keyword pair is not required to update in dbus(only those record keywords
present in dbus_properties.json are required to be updated in dbus).

CASE 3: <failure case - invalid eeprom path>
root@rainier:/tmp# ./vpd-tool -u -H -P /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a490.i2c-bus/i2c-8/8-0051/8-00510/nvmem -R VINI -K PN -V 0x717273
Invalid object path : /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a490.i2c-bus/i2c-8/8-0051/8-00510/nvmem. Unable to find the corresponding EEPROM path for the given object path : /sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e7$

Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: I6b893e699fe343c90c3a3fd2b07fd8b9a4711687
diff --git a/meson.build b/meson.build
index d5080b3..1a44195 100644
--- a/meson.build
+++ b/meson.build
@@ -47,22 +47,23 @@
                        'INVENTORY_JSON_SYM_LINK': '"'+get_option('INVENTORY_JSON_SYM_LINK')+'"',
                        'INVENTORY_JSON_2U': '"'+get_option('INVENTORY_JSON_2U')+'"',
                        'INVENTORY_JSON_4U': '"'+get_option('INVENTORY_JSON_4U')+'"',
-                       'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"'
+                       'INVENTORY_JSON_EVEREST': '"'+get_option('INVENTORY_JSON_EVEREST')+'"',
+                       'DBUS_PROP_JSON': '"'+get_option('DBUS_PROP_JSON')+'"'
                        }
   )
 
+common_SOURCES =[
+'vpd-parser/parser_factory.cpp',
+                 'vpd-parser/memory_vpd_parser.cpp',
+                 'vpd-parser/keyword_vpd_parser.cpp',
+                 'vpd-parser/ipz_parser.cpp', 'impl.cpp', 'utils.cpp',
+                 'vpdecc/vpdecc.c', 'vpdecc/vpdecc_support.c'
+]
+
 if get_option('ibm-parser').enabled()
         libgpiodcxx = dependency('libgpiodcxx')
-        ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp',
-                                'vpd-parser/ipz_parser.cpp',
-                                'impl.cpp',
-                                'utils.cpp',
-                                'vpd-parser/keyword_vpd_parser.cpp',
-                                'vpdecc/vpdecc.c',
-                                'vpdecc/vpdecc_support.c',
-                                'vpd-parser/memory_vpd_parser.cpp',
-                                'vpd-parser/parser_factory.cpp'
-                               ]
+        ibm_read_vpd_SOURCES = ['ibm_vpd_app.cpp'
+                               ]+common_SOURCES
 
         ibm_vpd_exe = executable(
                                 'ibm-read-vpd',
@@ -78,8 +79,11 @@
                             )
 
         vpd_tool_SOURCES = ['vpd_tool.cpp',
-                            'vpd_tool_impl.cpp'
-                           ]
+                            'vpd_tool_impl.cpp',
+                            'vpd-manager/editor_impl.cpp',
+                           ]+common_SOURCES
+
+        vpd_tool_INCLUDE = include_directories('vpd-parser/', 'vpd-manager')
 
         vpd_tool_exe = executable(
                                  'vpd-tool',
@@ -87,7 +91,8 @@
                                  dependencies: [
                                    sdbusplus
                                    ],
-                                 install: true
+                                 install: true,
+                                 include_directories : vpd_tool_INCLUDE
                                  )
 if get_option('vpd-manager').enabled()
     subdir('vpd-manager')