build-tools/stx: better permissions of empty files

When creating empty files (eg "build_done"), set their permissions to
0666-UMASK, rather than 0600. Otherwise some of these files become
non-readable for eg users trying to copy a loadbuild directory.

Story: 2010055
Task: 51243

TESTS
=================================
Rebuild a representative package, ca-certificates.
Make sure "build_done" and empty patch "series" files are created
with permissions mask 0644, rather than 0600.

Signed-off-by: Davlet Panech <davlet.panech@windriver.com>
Change-Id: I9d10b01a69961a7abdd6eae461b3248ad8a86281
This commit is contained in:
Davlet Panech 2024-11-01 14:06:46 -04:00
parent e89bdfc4c1
commit 5c20650f45
2 changed files with 2 additions and 2 deletions

View File

@ -1339,7 +1339,7 @@ class BuildController():
stamp_dir = os.path.join(os.environ.get('MY_WORKSPACE'), build_type, 'stamp')
os.makedirs(stamp_dir, exist_ok=True)
dsc_stamp = '.'.join([os.path.basename(dsc_file), checksum, state])
os.mknod(os.path.join(stamp_dir, dsc_stamp))
os.mknod(os.path.join(stamp_dir, dsc_stamp), 0o666)
except Exception as e:
logger.error(str(e))
logger.error("Failed to create stamp(%s) for %s", state, pkg_dir)

View File

@ -602,7 +602,7 @@ class Parser():
series_file = os.path.join(self.pkginfo["srcdir"], "debian/patches/series")
if not os.path.isdir(patches_folder):
os.mkdir(patches_folder)
os.mknod(series_file)
os.mknod(series_file, 0o666)
pwd = os.getcwd()
os.chdir(self.pkginfo["srcdir"])