Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Steven Gueguen
slapos
Commits
4bb47083
Commit
4bb47083
authored
Oct 16, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
factorize the code of boinc recipe
parent
28bed57e
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
133 additions
and
103 deletions
+133
-103
slapos/recipe/boinc/__init__.py
slapos/recipe/boinc/__init__.py
+33
-25
slapos/recipe/boinc/configure.py
slapos/recipe/boinc/configure.py
+86
-71
slapos/recipe/boinc/template/project_config.in
slapos/recipe/boinc/template/project_config.in
+7
-0
slapos/recipe/boinc/template/sed_update.in
slapos/recipe/boinc/template/sed_update.in
+0
-2
software/boinc/software.cfg
software/boinc/software.cfg
+1
-1
stack/boinc/buildout.cfg
stack/boinc/buildout.cfg
+2
-2
stack/boinc/instance-boinc.cfg
stack/boinc/instance-boinc.cfg
+4
-2
No files found.
slapos/recipe/boinc/__init__.py
View file @
4bb47083
...
...
@@ -103,7 +103,7 @@ class Recipe(GenericBaseRecipe):
#Define environment variable here
python
=
os
.
path
.
join
(
self
.
home
,
'bin/python'
)
python_path
=
self
.
boinc_egg
+
":"
+
os
.
environ
[
'PYTHONPATH'
]
python_path
=
self
.
boinc_egg
if
not
os
.
path
.
exists
(
python
):
os
.
symlink
(
self
.
pythonbin
,
python
)
for
f
in
os
.
listdir
(
self
.
developegg
):
...
...
@@ -112,8 +112,8 @@ class Recipe(GenericBaseRecipe):
python_path
+=
":"
+
dir
bin_dir
=
os
.
path
.
join
(
self
.
home
,
'bin'
)
environment
=
dict
(
PATH
=
self
.
svn
+
':'
+
bin_dir
+
':'
+
self
.
perl
+
':'
+
os
.
environ
[
'PATH'
]
,
PYTHONPATH
=
python_path
,
PATH
=
os
.
pathsep
.
join
([
self
.
svn
,
bin_dir
,
self
.
perl
,
os
.
environ
[
'PATH'
]])
,
PYTHONPATH
=
os
.
pathsep
.
join
([
python_path
,
os
.
environ
[
'PYTHONPATH'
]])
,
)
#Generate wrapper for php
...
...
@@ -134,7 +134,7 @@ class Recipe(GenericBaseRecipe):
dict
(
mysql_port
=
self
.
mysqlport
,
mysql_host
=
self
.
mysqlhost
,
mysql_user
=
self
.
username
,
mysql_password
=
self
.
password
,
database
=
self
.
database
,
file_status
=
file_status
,
python_path
=
python_path
file_status
=
file_status
,
environment
=
environment
)
)
...
...
@@ -160,6 +160,18 @@ class Recipe(GenericBaseRecipe):
)
path_list
.
append
(
install_wrapper
)
#generate sh script for project configuration
bash
=
os
.
path
.
join
(
self
.
home
,
'bin'
,
'project_config.sh'
)
sh_script
=
self
.
createFile
(
bash
,
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'project_config.in'
),
dict
(
dash
=
self
.
options
[
'dash'
].
strip
(),
uldl_pid
=
self
.
options
[
'apache-pid'
].
strip
(),
user
=
slapuser
,
fullname
=
self
.
fullname
,
copyright
=
self
.
copyright
,
installroot
=
self
.
installroot
))
)
path_list
.
append
(
sh_script
)
os
.
chmod
(
bash
,
0700
)
#After make_project run configure_script to perform and restart apache php services
service_status
=
os
.
path
.
join
(
self
.
home
,
'.start_service'
)
parameter
=
dict
(
...
...
@@ -171,10 +183,8 @@ class Recipe(GenericBaseRecipe):
xadd
=
os
.
path
.
join
(
self
.
installroot
,
'bin/xadd'
),
environment
=
environment
,
service_status
=
service_status
,
project
=
niceprojectname
,
fullname
=
self
.
fullname
,
copyright
=
self
.
copyright
,
drop_install
=
drop_install
drop_install
=
drop_install
,
sedconfig
=
bash
)
start_service
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'config_project'
),
...
...
@@ -191,8 +201,8 @@ class Recipe(GenericBaseRecipe):
installroot
=
self
.
installroot
,
drop_install
=
drop_install
,
mysql_port
=
self
.
mysqlport
,
mysql_host
=
self
.
mysqlhost
,
mysql_user
=
self
.
username
,
mysql_password
=
self
.
password
,
database
=
self
.
database
,
PATH
=
environment
[
'PATH'
]
,
python_path
=
python_path
,
start_boinc
=
start_boinc
)
database
=
self
.
database
,
environment
=
environment
,
start_boinc
=
start_boinc
)
start_wrapper
=
self
.
createPythonScript
(
os
.
path
.
join
(
self
.
wrapperdir
,
'start_boinc'
),
'%s.configure.restart_boinc'
%
__name__
,
...
...
@@ -211,14 +221,14 @@ class App(GenericBaseRecipe):
def
downloadFiles
(
self
):
"""This is used to download app files if necessary and update options values"""
for
key
in
(
'
template-result'
,
'template-wu'
,
'input-file
'
,
'binary'
):
option
=
self
.
options
[
key
].
strip
()
if
option
and
(
option
.
startswith
(
'http'
)
or
option
.
startswith
(
'ftp'
)):
for
key
in
(
'
input-file'
,
'template-result'
,
'template-wu
'
,
'binary'
):
param
=
self
.
options
[
key
].
strip
()
if
param
and
(
param
.
startswith
(
'http'
)
or
param
.
startswith
(
'ftp'
)):
#download the specified file
cache
=
os
.
path
.
join
(
self
.
options
[
'home'
].
strip
(),
't
e
mp'
)
cache
=
os
.
path
.
join
(
self
.
options
[
'home'
].
strip
(),
'tmp'
)
downloader
=
zc
.
buildout
.
download
.
Download
(
self
.
buildout
[
'buildout'
],
hash_name
=
True
,
cache
=
cache
)
path
,
_
=
downloader
(
option
,
md5sum
=
None
)
path
,
_
=
downloader
(
param
,
md5sum
=
None
)
mode
=
0600
if
key
==
'binary'
:
mode
=
0700
...
...
@@ -243,8 +253,9 @@ class App(GenericBaseRecipe):
print
"Invalid argement values...operation cancelled"
return
False
#write application to install
toInstall
=
open
(
os
.
path
.
join
(
self
.
options
[
'home'
].
strip
(),
'.install_'
+
self
.
appname
+
self
.
version
),
'w'
)
request_file
=
os
.
path
.
join
(
self
.
options
[
'home'
].
strip
(),
'.install_'
+
self
.
appname
+
self
.
version
)
toInstall
=
open
(
request_file
,
'w'
)
toInstall
.
write
(
'install or update'
)
toInstall
.
close
()
return
True
...
...
@@ -258,9 +269,8 @@ class App(GenericBaseRecipe):
path_list
=
[]
package
=
self
.
options
[
'boinc'
].
strip
()
#Define environment variable here
boinc_egg
=
os
.
path
.
join
(
package
,
'lib/python2.7/site-packages'
)
developegg
=
self
.
options
[
'develop-egg'
].
strip
()
python_path
=
boinc_egg
+
":"
+
os
.
environ
[
'PYTHONPATH'
]
python_path
=
os
.
path
.
join
(
package
,
'lib/python2.7/site-packages'
)
home
=
self
.
options
[
'home'
].
strip
()
user
=
pwd
.
getpwuid
(
os
.
stat
(
home
).
st_uid
)[
0
]
perl
=
self
.
options
[
'perl-binary'
].
strip
()
...
...
@@ -271,17 +281,15 @@ class App(GenericBaseRecipe):
python_path
+=
":"
+
dir
bin_dir
=
os
.
path
.
join
(
home
,
'bin'
)
environment
=
dict
(
PATH
=
svn
+
':'
+
bin_dir
+
':'
+
perl
+
':'
+
os
.
environ
[
'PATH'
]
,
PYTHONPATH
=
python_path
,
PATH
=
os
.
pathsep
.
join
([
svn
,
bin_dir
,
perl
,
os
.
environ
[
'PATH'
]])
,
PYTHONPATH
=
os
.
pathsep
.
join
([
python_path
,
os
.
environ
[
'PYTHONPATH'
]])
,
)
#generate project.xml and config.xml script updater
bash
=
os
.
path
.
join
(
home
,
'bin'
,
'update_config.sh'
)
sh_script
=
self
.
createFile
(
bash
,
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'sed_update.in'
),
dict
(
dash
=
self
.
options
[
'dash'
].
strip
(),
uldl_pid
=
self
.
options
[
'apache-pid'
].
strip
(),
user
=
user
))
dict
(
dash
=
self
.
options
[
'dash'
].
strip
()))
)
path_list
.
append
(
sh_script
)
os
.
chmod
(
bash
,
0700
)
...
...
@@ -311,7 +319,7 @@ class App(GenericBaseRecipe):
bash
=
bash
,
home_dir
=
home
,
)
deploy_app
=
self
.
createPythonScript
(
os
.
path
.
join
(
wrapperdir
,
self
.
appname
),
os
.
path
.
join
(
wrapperdir
,
'boinc_app'
),
'%s.configure.deployApp'
%
__name__
,
parameter
)
path_list
.
append
(
deploy_app
)
...
...
slapos/recipe/boinc/configure.py
View file @
4bb47083
This diff is collapsed.
Click to expand it.
slapos/recipe/boinc/template/project_config.in
0 → 100644
View file @
4bb47083
#!%(dash)s
sed -i "/remove the die/d" %(installroot)s/html/ops/create_forums.php
sed -i "s#REPLACE WITH PROJECT NAME#%(fullname)s#" %(installroot)s/html/project/project.inc
sed -i "s#REPLACE WITH COPYRIGHT HOLDER#%(copyright)s#" %(installroot)s/html/project/project.inc
sed -i.old -e "/<\/config>/i\<uldl_pid>%(uldl_pid)s</uldl_pid>" %(installroot)s/config.xml
sed -i.old -e "/<\/config>/i\<httpd_user>%(user)s</httpd_user>" %(installroot)s/config.xml
slapos/recipe/boinc/template/sed_update.in
View file @
4bb47083
...
...
@@ -10,7 +10,5 @@ sed -i.old -e "/<\/boinc>/i\<app>\n<name>$1</name>\n<user_friendly_name>$1</user
sed -i.old -e "/<\/daemons>/i\<daemon>\n<cmd>\nsample_bitwise_validator -d 3 -app $1\n</cmd>\n</daemon>" $2/config.xml
sed -i.old -e "/<\/daemons>/i\<daemon>\n<cmd>\nsample_assimilator -d 3 -app $1\n</cmd>\n</daemon>" $2/config.xml
sed -i.old -e "/<\/config>/i\<uldl_pid>%(uldl_pid)s</uldl_pid>" $2/config.xml
sed -i.old -e "/<\/config>/i\<httpd_user>%(user)s</httpd_user>" $2/config.xml
fi
\ No newline at end of file
software/boinc/software.cfg
View file @
4bb47083
...
...
@@ -43,7 +43,7 @@ exec-extension =
#Please read Boinc platform before update platform value: http://boinc.berkeley.edu/trac/wiki/BoincPlatforms
platform = x86_64-pc-linux-gnu
#Work Unit number number of work unit
wu-number =
4
wu-number =
2
[template-base]
recipe = slapos.recipe.download
...
...
stack/boinc/buildout.cfg
View file @
4bb47083
...
...
@@ -41,7 +41,7 @@ eggs =
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-boinc.cfg
output = ${buildout:directory}/template-boinc.cfg
md5sum =
003bff525faa1e63913fa5f38c18becd
md5sum =
22de71bad135ab3c760c63e537dcb182
mode = 0644
#Template for deploying MySQL Database Server
...
...
@@ -57,7 +57,7 @@ recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/${:filename}
mode = 0644
filename = apache.in
md5sum = 0
b3825a4a0ec82e279609d1f9dc72da
4
md5sum = 0
30892494ce87357e6e09dcd89187bf
4
location = ${buildout:parts-directory}/${:_buildout_section_name_}
# Local development
...
...
stack/boinc/instance-boinc.cfg
View file @
4bb47083
...
...
@@ -20,7 +20,9 @@ parts =
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#temporary solution
newest = false
offline = false
# Creation of all needed directories
...
...
@@ -226,7 +228,7 @@ wu-number = $${slap-parameter:wu-number}
binary = $${slap-parameter:binary}
platform = $${slap-parameter:platform}
extension = $${slap-parameter:extension}
template-result = $${slap-parameter:template-
wu
}
template-result = $${slap-parameter:template-
result
}
template-wu = $${slap-parameter:template-wu}
input-file = $${slap-parameter:input-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