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
Boxiang Sun
slapos.recipe.build
Commits
77828dd9
Commit
77828dd9
authored
Aug 26, 2011
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add copy and guessPlatform methods
parent
c7a0721b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
slapos/recipe/build.py
slapos/recipe/build.py
+36
-0
No files found.
slapos/recipe/build.py
View file @
77828dd9
...
...
@@ -26,12 +26,21 @@
##############################################################################
import
logging
import
os
from
platform
import
uname
import
setuptools
import
shutil
import
subprocess
import
tempfile
import
zc.buildout
ARCH_MAP
=
{
'i386'
:
'x86'
,
'i586'
:
'x86'
,
'i686'
:
'x86'
,
'x86_64'
:
'x86-64'
}
def
readElfAsDict
(
f
):
"""Reads ELF information from file"""
popen
=
subprocess
.
Popen
([
'readelf'
,
'-d'
,
f
],
...
...
@@ -80,6 +89,12 @@ def guessworkdir(path):
return
os
.
path
.
join
(
path
,
os
.
listdir
(
path
)[
0
])
return
path
def
guessPlatform
():
arch
=
uname
()[
-
2
]
target
=
ARCH_MAP
.
get
(
arch
)
assert
target
,
'Unknown architecture'
return
target
class
Script
:
"""Free script building system"""
def
_checkPromisee
(
self
,
location
):
...
...
@@ -150,6 +165,27 @@ class Script:
self
.
cleanup_dir_list
.
append
(
extract_dir
)
return
extract_dir
def
copy
(
self
,
origin
,
destination
,
ignore_dir_list
=
[]):
"""Copy directory.
"""
if
os
.
path
.
exists
(
destination
):
self
.
logger
.
info
(
'No need to re-install java part'
)
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
,
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
)
return
True
script
=
'raise NotImplementedError'
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
cleanup_dir_list
=
[]
...
...
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