Jim MacArthur pushed to branch jmac/vdir_import_unreadable_files at BuildStream / buildstream
Commits:
-
14e1a3b3
by Jürg Billeter at 2018-10-01T08:18:05Z
-
232662f1
by Jürg Billeter at 2018-10-01T08:53:06Z
-
f447aedd
by Tiago Gomes at 2018-10-01T10:33:11Z
-
682dddce
by Tiago Gomes at 2018-10-01T10:35:12Z
-
fafa8136
by Tiago Gomes at 2018-10-01T10:59:54Z
-
76c8070b
by Jim MacArthur at 2018-10-01T15:27:27Z
4 changed files:
- .gitlab-ci.yml
- buildstream/_platform/darwin.py
- buildstream/_platform/platform.py
- buildstream/utils.py
Changes:
| ... | ... | @@ -161,14 +161,14 @@ docs: |
| 161 | 161 |
.overnight-tests: &overnight-tests-template
|
| 162 | 162 |
stage: test
|
| 163 | 163 |
variables:
|
| 164 |
- bst_ext_url: git+https://gitlab.com/BuildStream/bst-external.git
|
|
| 165 |
- bst_ext_ref: 1d6ab71151b93c8cbc0a91a36ffe9270f3b835f1 # 0.5.1
|
|
| 166 |
- fd_sdk_ref: 88d7c22c2281b987faa02edd57df80d430eecf1f # 18.08.12
|
|
| 164 |
+ BST_EXT_URL: git+https://gitlab.com/BuildStream/bst-external.git
|
|
| 165 |
+ BST_EXT_REF: 1d6ab71151b93c8cbc0a91a36ffe9270f3b835f1 # 0.5.1
|
|
| 166 |
+ FD_SDK_REF: 88d7c22c2281b987faa02edd57df80d430eecf1f # 18.08.11-35-g88d7c22c
|
|
| 167 | 167 |
before_script:
|
| 168 | 168 |
- (cd dist && ./unpack.sh && cd buildstream && pip3 install .)
|
| 169 |
- - pip3 install --user -e ${bst_ext_url}@${bst_ext_ref}#egg=bst_ext
|
|
| 169 |
+ - pip3 install --user -e ${BST_EXT_URL}@${BST_EXT_REF}#egg=bst_ext
|
|
| 170 | 170 |
- git clone https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
|
| 171 |
- - git -C freedesktop-sdk checkout ${fd_sdk_ref}
|
|
| 171 |
+ - git -C freedesktop-sdk checkout ${FD_SDK_REF}
|
|
| 172 | 172 |
only:
|
| 173 | 173 |
- schedules
|
| 174 | 174 |
|
| ... | ... | @@ -41,10 +41,11 @@ class Darwin(Platform): |
| 41 | 41 |
return True
|
| 42 | 42 |
|
| 43 | 43 |
def get_cpu_count(self, cap=None):
|
| 44 |
- if cap < os.cpu_count():
|
|
| 45 |
- return cap
|
|
| 44 |
+ cpu_count = os.cpu_count()
|
|
| 45 |
+ if cap is None:
|
|
| 46 |
+ return cpu_count
|
|
| 46 | 47 |
else:
|
| 47 |
- return os.cpu_count()
|
|
| 48 |
+ return min(cpu_count, cap)
|
|
| 48 | 49 |
|
| 49 | 50 |
def set_resource_limits(self, soft_limit=OPEN_MAX, hard_limit=None):
|
| 50 | 51 |
super().set_resource_limits(soft_limit)
|
| ... | ... | @@ -67,7 +67,11 @@ class Platform(): |
| 67 | 67 |
return cls._instance
|
| 68 | 68 |
|
| 69 | 69 |
def get_cpu_count(self, cap=None):
|
| 70 |
- return min(len(os.sched_getaffinity(0)), cap)
|
|
| 70 |
+ cpu_count = len(os.sched_getaffinity(0))
|
|
| 71 |
+ if cap is None:
|
|
| 72 |
+ return cpu_count
|
|
| 73 |
+ else:
|
|
| 74 |
+ return min(cpu_count, cap)
|
|
| 71 | 75 |
|
| 72 | 76 |
##################################################################
|
| 73 | 77 |
# Sandbox functions #
|
| ... | ... | @@ -831,8 +831,18 @@ def _process_list(srcdir, destdir, filelist, actionfunc, result, |
| 831 | 831 |
result.ignored.append(path)
|
| 832 | 832 |
continue
|
| 833 | 833 |
|
| 834 |
+ if not file_stat.st_mode & stat.S_IRUSR:
|
|
| 835 |
+ os.chmod(srcpath, stat.S_IRUSR | stat.S_IWUSR)
|
|
| 836 |
+ |
|
| 834 | 837 |
actionfunc(srcpath, destpath, result=result)
|
| 835 | 838 |
|
| 839 |
+ if not file_stat.st_mode & stat.S_IRUSR:
|
|
| 840 |
+ # actionfunc would normally preserve permissions, but
|
|
| 841 |
+ # if we changed them before copying, we need to reset
|
|
| 842 |
+ # the permissions on both.
|
|
| 843 |
+ os.chmod(destpath, file_stat.st_mode)
|
|
| 844 |
+ os.chmod(srcpath, file_stat.st_mode)
|
|
| 845 |
+ |
|
| 836 | 846 |
elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode):
|
| 837 | 847 |
# Block or character device. Put contents of st_dev in a mknod.
|
| 838 | 848 |
if not safe_remove(destpath):
|
