diff options
author | Rasmus Villemoes <ravi@prevas.dk> | 2025-06-06 11:39:05 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-06-26 11:02:34 +0100 |
commit | ba290e7ec884209239baeb52f7efc9ca7ccd717c (patch) | |
tree | 33fd926eab238fe91471700516caa329143a4276 | |
parent | 24cab297ed78840817f04ee0432a01ae8564f75d (diff) | |
download | poky-ba290e7ec884209239baeb52f7efc9ca7ccd717c.tar.gz |
sstate: apply proper umask when fetching from SSTATE_MIRROR
Currently, files and directories created under ${SSTATE_DIR} when
fetching from an sstate mirror are not created with group write,
unlike when the sstate artifacts are generated locally. That's
inconsistent, and problematic when the local sstate dir is shared
among multiple users.
Wrap the fetching in a bb.utils.umask() context manager, and for simplicity
move the mkdir of SSTATE_DIR inside that.
(From OE-Core rev: a6038553aaef3b88b834a09018c524c4fa41e625)
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-global/sstate.bbclass | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass index 1d7b033b80..2968cc4c2e 100644 --- a/meta/classes-global/sstate.bbclass +++ b/meta/classes-global/sstate.bbclass | |||
@@ -726,7 +726,6 @@ def pstaging_fetch(sstatefetch, d): | |||
726 | localdata = bb.data.createCopy(d) | 726 | localdata = bb.data.createCopy(d) |
727 | 727 | ||
728 | dldir = localdata.expand("${SSTATE_DIR}") | 728 | dldir = localdata.expand("${SSTATE_DIR}") |
729 | bb.utils.mkdirhier(dldir) | ||
730 | 729 | ||
731 | localdata.delVar('MIRRORS') | 730 | localdata.delVar('MIRRORS') |
732 | localdata.setVar('FILESPATH', dldir) | 731 | localdata.setVar('FILESPATH', dldir) |
@@ -746,16 +745,19 @@ def pstaging_fetch(sstatefetch, d): | |||
746 | if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False): | 745 | if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False): |
747 | uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] | 746 | uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] |
748 | 747 | ||
749 | for srcuri in uris: | 748 | with bb.utils.umask(0o002): |
750 | localdata.delVar('SRC_URI') | 749 | bb.utils.mkdirhier(dldir) |
751 | localdata.setVar('SRC_URI', srcuri) | ||
752 | try: | ||
753 | fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) | ||
754 | fetcher.checkstatus() | ||
755 | fetcher.download() | ||
756 | 750 | ||
757 | except bb.fetch2.BBFetchException: | 751 | for srcuri in uris: |
758 | pass | 752 | localdata.delVar('SRC_URI') |
753 | localdata.setVar('SRC_URI', srcuri) | ||
754 | try: | ||
755 | fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False) | ||
756 | fetcher.checkstatus() | ||
757 | fetcher.download() | ||
758 | |||
759 | except bb.fetch2.BBFetchException: | ||
760 | pass | ||
759 | 761 | ||
760 | def sstate_setscene(d): | 762 | def sstate_setscene(d): |
761 | shared_state = sstate_state_fromvars(d) | 763 | shared_state = sstate_state_fromvars(d) |