summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
diff options
context:
space:
mode:
authorLei YU <mine260309@gmail.com>2019-03-14 13:29:07 +0800
committerAndrew Geissler <geissonator@yahoo.com>2019-03-20 21:56:53 -0500
commitf33c69ca1546765da370dea09f53fa4cadf18d0c (patch)
tree85fb6d3aa579393d67cae388a66e78e8b0205d24 /meta-phosphor/classes/obmc-phosphor-systemd.bbclass
parent806405f3f41f8e9fe42a06a18c299de702a83d78 (diff)
downloadtalos-openbmc-f33c69ca1546765da370dea09f53fa4cadf18d0c.tar.gz
talos-openbmc-f33c69ca1546765da370dea09f53fa4cadf18d0c.zip
obmc-phosphor-systemd: allow systemd unit from repo
If a recipe inherits obmc-phosphor-systemd, all the systemd units defined in the recipe shall exist in the code tree, otherwise it reports "Did not find unit file" error. This commit changes the behavior, and do not report the error if a unit does not exist in code tree. This allows the system unit to be installed from repo, as long as the repo does install the systemd unit to expected path. Tested: Verify the below case passes the build and the unit is installed correctly in the built image: * Put a systemd unit in repo; * In repo, install the unit into /lib/systemd/system * The repo's recipe defines SYSTEMD_SERVICE_${PN} without putting the unit in openbmc tree And verify if the systemd unit in repo is not installed, the build fails due to missing the unit. (From meta-phosphor rev: 5f56aaf1204a39035da1a493a97e86a73650000f) Change-Id: I9ec9c188357c2995d3e8ddbf2675c60f5e17560e Signed-off-by: Lei YU <mine260309@gmail.com> Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-phosphor/classes/obmc-phosphor-systemd.bbclass')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-systemd.bbclass16
1 files changed, 12 insertions, 4 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
index 3a3234f5e..e89230212 100644
--- a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass
@@ -110,7 +110,9 @@ python() {
searchpaths = d.getVar('FILESPATH', True)
path = bb.utils.which(searchpaths, '%s' % unit.name)
if not os.path.isfile(path):
- bb.fatal('Did not find unit file "%s"' % unit.name)
+ # Unit does not exist in tree. Allow it to install from repo.
+ # Return False here to indicate it does not exist.
+ return False
parser = systemd_parse_unit(d, path)
inhibit = listvar_to_list(d, 'INHIBIT_SYSTEMD_RESTART_POLICY_WARNING')
@@ -120,6 +122,7 @@ python() {
not parser.has_option('Service', 'Restart'):
bb.warn('Systemd unit \'%s\' does not '
'have a restart policy defined.' % unit.name)
+ return True
def add_default_subs(d, file):
@@ -134,7 +137,12 @@ python() {
'%s:%s:%s' % (x, d.getVar(x, True), file))
- def add_sd_unit(d, unit, pkg):
+ def add_sd_unit(d, unit, pkg, unit_exist):
+ # Do not add unit if it does not exist in tree.
+ # It will be installed from repo.
+ if not unit_exist:
+ return
+
name = unit.name
unit_dir = d.getVar('systemd_system_unitdir', True)
set_append(d, 'SRC_URI', 'file://%s' % name)
@@ -216,8 +224,8 @@ python() {
svc = [x for x in svc if not x.is_instance]
for unit in tmpl + svc:
- check_sd_unit(d, unit)
- add_sd_unit(d, unit, pkg)
+ unit_exist = check_sd_unit(d, unit)
+ add_sd_unit(d, unit, pkg, unit_exist)
add_sd_user(d, unit.name, pkg)
for name in listvar_to_list(d, 'SYSTEMD_ENVIRONMENT_FILE_%s' % pkg):
add_env_file(d, name, pkg)
OpenPOWER on IntegriCloud