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.saved
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos.recipe.build.saved
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
Hide 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
],
...
...
@@ -79,6 +88,12 @@ def guessworkdir(path):
if
len
(
os
.
listdir
(
path
))
==
1
:
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"""
...
...
@@ -149,6 +164,27 @@ class Script:
setuptools
.
archive_util
.
unpack_archive
(
path
,
extract_dir
)
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
):
...
...
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