@@ -201,14 +201,22 @@ python write_specfile () {
try:
owner = pwd.getpwuid(stat_f.st_uid).pw_name
except Exception as e:
- bb.error("Content of /etc/passwd in sysroot:\n{}".format(
- open(d.getVar("RECIPE_SYSROOT") +"/etc/passwd").read()))
+ filename = d.getVar('RECIPE_SYSROOT') + '/etc/passwd'
+ if os.path.exists(filename):
+ bb.error("Content of /etc/passwd in sysroot:\n{}".format(
+ open(filename).read()))
+ else:
+ bb.error("File {} doesn't exist in sysroot!".format(filename))
raise e
try:
group = grp.getgrgid(stat_f.st_gid).gr_name
except Exception as e:
- bb.error("Content of /etc/group in sysroot:\n{}".format(
- open(d.getVar("RECIPE_SYSROOT") +"/etc/group").read()))
+ filename = d.getVar("RECIPE_SYSROOT") +"/etc/group"
+ if os.path.exists(filename):
+ bb.error("Content of /etc/group in sysroot:\n{}".format(
+ open(filename).read()))
+ else:
+ bb.error("File {} doesn't exists in sysroot!".format(filename))
raise e
return "%attr({:o},{},{}) ".format(mode, owner, group)