blob: 7bafecb799d893df30bd2a08850c60d41ea62985 [file] [log] [blame]
Brad Bishopf8a7cd12017-07-09 23:41:49 -04001# Common code for recipes that modify the phosphor-mapper
2# configuration.
3#
4# Typically it is not desired to monitor all dbus traffic
5# on a system and as such, the phosphor-mapper has command
6# line options to control what path namespaces and dbus
7# interfaces it will keep track of.
8#
9# The Phosphor layer by default configures the mapper to
10# watch xyz.openbmc_project interfaces and paths only. This
11# configuration file is intended to be inherited by
12# native recipes in other layers that wish to add namespaces
13# or interfaces to the mapper watchlist.
14
15# Add path namespaces to be monitored:
16# PHOSPHOR_MAPPER_NAMESPACE_append = " /foo/bar"
17
18# Add interfaces to be monitored:
19# PHOSPHOR_MAPPER_INTERFACE_append = " foo.bar"
20
Brad Bishopf8a7cd12017-07-09 23:41:49 -040021inherit phosphor-mapperdir
Brad Bishop6f120e32018-03-09 16:51:57 -050022inherit obmc-phosphor-utils
Brad Bishopf8a7cd12017-07-09 23:41:49 -040023
24python phosphor_mapper_do_postinst() {
25 def process_var(d, var, dir):
26 for p in listvar_to_list(d, var):
27 parent = d.getVar('D', True) + d.getVar(dir, True)
28 if not os.path.exists(parent):
29 os.makedirs(parent)
30 path = os.path.join(
31 parent,
Brad Bishopb4eea302017-08-03 15:56:09 -040032 '-'.join(p.split(os.sep)))
Brad Bishopf8a7cd12017-07-09 23:41:49 -040033 with open(path, 'w+') as fd:
34 pass
35
36 process_var(d, 'PHOSPHOR_MAPPER_NAMESPACE', 'namespace_dir')
37 process_var(d, 'PHOSPHOR_MAPPER_INTERFACE', 'interface_dir')
Brad Bishopf8a7cd12017-07-09 23:41:49 -040038}
39
40do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACE"
41do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE"
Brad Bishopf8a7cd12017-07-09 23:41:49 -040042do_install[postfuncs] += "phosphor_mapper_do_postinst"