Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.build
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Leymonerie
slapos.recipe.build
Commits
9c883311
Commit
9c883311
authored
Aug 21, 2018
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download, downloadunpacked: Each shared part should be read-only.
parent
0b3ee931
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
slapos/recipe/download.py
slapos/recipe/download.py
+2
-0
slapos/recipe/downloadunpacked.py
slapos/recipe/downloadunpacked.py
+14
-0
No files found.
slapos/recipe/download.py
View file @
9c883311
...
...
@@ -30,6 +30,7 @@ import shutil
import
zc.buildout
import
logging
from
hashlib
import
md5
from
downloadunpacked
import
make_read_only_recursively
class
Recipe
(
object
):
_parts
=
None
...
...
@@ -110,6 +111,7 @@ class Recipe(object):
if
self
.
_shared
:
with
open
(
os
.
path
.
join
(
parts
,
".slapos.recipe.build.signature"
),
'w'
)
as
f
:
f
.
write
(
'
\
n
'
.
join
(
self
.
_debug_signature_text
))
make_read_only_recursively
(
self
.
_parts
)
return
result
def
update
(
self
):
...
...
slapos/recipe/downloadunpacked.py
View file @
9c883311
...
...
@@ -32,6 +32,7 @@ import tarfile
import
zc.buildout
import
tempfile
import
setuptools.archive_util
import
stat
from
hashlib
import
md5
is_true
=
(
'false'
,
'true'
).
index
...
...
@@ -161,6 +162,7 @@ class Recipe:
if
self
.
shared
:
with
open
(
os
.
path
.
join
(
self
.
parts
,
".slapos.recipe.build.signature"
),
'w'
)
as
f
:
f
.
write
(
'
\
n
'
.
join
(
self
.
_debug_signature_text
))
make_read_only_recursively
(
self
.
parts
)
return
[]
if
self
.
parts
is
not
None
:
return
[
self
.
parts
]
...
...
@@ -222,3 +224,15 @@ def unpatch_archive_util():
setuptools
.
archive_util
.
unpack_zipfile
,
setuptools
.
archive_util
.
unpack_tarfile
,
)
_read_only_mask
=
0o777
^
(
stat
.
S_IWRITE
|
stat
.
S_IWGRP
|
stat
.
S_IWOTH
)
def
make_read_only
(
path
):
os
.
chmod
(
path
,
os
.
stat
(
path
).
st_mode
&
_read_only_mask
)
def
make_read_only_recursively
(
path
):
make_read_only
(
path
)
for
root
,
dir_list
,
file_list
in
os
.
walk
(
path
):
for
dir
in
dir_list
:
make_read_only
(
os
.
path
.
join
(
root
,
dir
))
for
file_
in
file_list
:
make_read_only
(
os
.
path
.
join
(
root
,
file_
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment