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
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
slapos.recipe.build
Commits
ed24d550
Commit
ed24d550
authored
Aug 26, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify and fix copy(), and renamed it to copytree()
parent
77828dd9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
22 deletions
+19
-22
slapos/recipe/build.py
slapos/recipe/build.py
+19
-22
No files found.
slapos/recipe/build.py
View file @
ed24d550
...
...
@@ -40,7 +40,6 @@ ARCH_MAP = {
'x86_64'
:
'x86-64'
}
def
readElfAsDict
(
f
):
"""Reads ELF information from file"""
popen
=
subprocess
.
Popen
([
'readelf'
,
'-d'
,
f
],
...
...
@@ -165,25 +164,23 @@ class Script:
self
.
cleanup_dir_list
.
append
(
extract_dir
)
return
extract_dir
def
copy
(
self
,
origin
,
destination
,
ignore_dir_list
=
[]):
"""Copy directory.
def
copytree
(
self
,
origin
,
destination
,
overwrite
=
False
,
ignore_dir_list
=
[]):
"""Recursively Copy directory. if "overwrite" is set to False, will stop if
destination already exists. ignore_dir_list is an array of directories
you want to exclude.
Example : copytree("/from", "/to", overwrite=True, ignore_dir_list=["a_private_dir"])
"""
if
os
.
path
.
exists
(
destination
)
:
self
.
logger
.
info
(
'No need to re-install java part
'
)
if
os
.
path
.
exists
(
destination
)
and
not
overwrite
:
self
.
logger
.
info
(
'Destination already exists, aborting.
'
)
return
False
self
.
logger
.
info
(
"Copying unpacked contents"
)
java_dir
=
''
if
'ignore'
in
shutil
.
copytree
.
func_code
.
co_varnames
:
shutil
.
copytree
(
os
.
path
.
join
(
origin
,
java_dir
),
destination
,
self
.
logger
.
info
(
"Copying %s to %s"
%
(
origin
,
destination
))
try
:
shutil
.
copytree
(
origin
,
destination
,
ignore
=
lambda
src
,
names
:
ignore_dir_list
)
else
:
shutil
.
copytree
(
origin
,
destination
)
for
ignore_dir
in
ignore_dir_list
:
ignore_dir
=
os
.
path
.
join
(
destination
,
ignore_dir
)
if
os
.
path
.
exists
(
ignore_dir
):
shutil
.
rmtree
(
ignore_dir
)
except
shutil
.
Error
:
self
.
logger
.
error
(
"Error occurred : %s"
)
shutil
.
rmtree
(
destination
)
return
False
return
True
script
=
'raise NotImplementedError'
...
...
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