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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos
Commits
e1078967
Commit
e1078967
authored
May 26, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java installation recipe.
parent
bc1024a6
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
287 additions
and
0 deletions
+287
-0
slapos/slapos.recipe.java/CHANGES.txt
slapos/slapos.recipe.java/CHANGES.txt
+12
-0
slapos/slapos.recipe.java/MANIFEST.in
slapos/slapos.recipe.java/MANIFEST.in
+1
-0
slapos/slapos.recipe.java/PKG-INFO
slapos/slapos.recipe.java/PKG-INFO
+58
-0
slapos/slapos.recipe.java/README.txt
slapos/slapos.recipe.java/README.txt
+46
-0
slapos/slapos.recipe.java/setup.cfg
slapos/slapos.recipe.java/setup.cfg
+5
-0
slapos/slapos.recipe.java/setup.py
slapos/slapos.recipe.java/setup.py
+32
-0
slapos/slapos.recipe.java/src/slapos/__init__.py
slapos/slapos.recipe.java/src/slapos/__init__.py
+6
-0
slapos/slapos.recipe.java/src/slapos/recipe/__init__.py
slapos/slapos.recipe.java/src/slapos/recipe/__init__.py
+6
-0
slapos/slapos.recipe.java/src/slapos/recipe/java/__init__.py
slapos/slapos.recipe.java/src/slapos/recipe/java/__init__.py
+1
-0
slapos/slapos.recipe.java/src/slapos/recipe/java/recipe.py
slapos/slapos.recipe.java/src/slapos/recipe/java/recipe.py
+120
-0
No files found.
slapos/slapos.recipe.java/CHANGES.txt
0 → 100644
View file @
e1078967
Changelog
=========
0.0.2
----------------
Adapting to use auto-extracting packages, and not rpms.
[Cedric de Saint Martin]
0.0.1
----------------
Initial Commit
[Cedric de Saint Martin]
\ No newline at end of file
slapos/slapos.recipe.java/MANIFEST.in
0 → 100644
View file @
e1078967
include CHANGES.txt
\ No newline at end of file
slapos/slapos.recipe.java/PKG-INFO
0 → 100644
View file @
e1078967
Metadata-Version: 1.0
Name: slapos.recipe.java
Version: 0.0.2
Summary: zc.buildout recipe that downloads and installs Java
Home-page: http://www.slapos.org
Author: Cedric de Saint Martin
Author-email: cedric.dsm@tiolive.com
License: ZPL 2.1
Description: slapos.recipe.java
=====================
This recipe downloads and installs java in your buildout.
Buildout configuration:
-----------------------
Add this section to your buildout configuration::
[buildout]
parts =
... your other parts ...
java
...
[java]
recipe = slapos.recipe.java
By default it will fetch Java 6u25, but you might want to install from another location or another version like this::
[java]
recipe = slapos.recipe.java
download-url = ftp://location/to/self-extracting/java.bin
Or you can install openjdk instead.
[java]
recipe = slapos.recipe.java
flavour = openjdk
Notes:
------
This recipe only works with linux at the moment
This recipe requires rpm2cpio and cpio to be installed on your system.
Authors:
--------
Original author: Cedric de Saint Martin - cedric.dsm [ at ] tiolive [ dot ] com
Inspired by : z3c.recipe.openoffice made by Jean-Francois Roche - jfroche@affinitic.be
Keywords: buildout java slapos
Platform: UNKNOWN
slapos/slapos.recipe.java/README.txt
0 → 100644
View file @
e1078967
slapos.recipe.java
=====================
This recipe downloads and installs java in your buildout.
Buildout configuration:
-----------------------
Add this section to your buildout configuration::
[buildout]
parts =
... your other parts ...
java
...
[java]
recipe = slapos.recipe.java
By default it will fetch Java 6u25, but you might want to install from another location or another version like this::
[java]
recipe = slapos.recipe.java
download-url = ftp://location/to/self-extracting/java.bin
Or you can install openjdk instead.
[java]
recipe = slapos.recipe.java
flavour = openjdk
Notes:
------
This recipe only works with linux at the moment
This recipe requires rpm2cpio and cpio to be installed on your system.
Authors:
--------
Original author: Cedric de Saint Martin - cedric.dsm [ at ] tiolive [ dot ] com
Inspired by : z3c.recipe.openoffice made by Jean-Francois Roche - jfroche@affinitic.be
slapos/slapos.recipe.java/setup.cfg
0 → 100644
View file @
e1078967
[egg_info]
tag_build =
tag_date = 0
tag_svn_revision = 0
slapos/slapos.recipe.java/setup.py
0 → 100644
View file @
e1078967
from
setuptools
import
setup
,
find_packages
import
os
version
=
'0.0.2'
name
=
'slapos.recipe.java'
def
read
(
*
rnames
):
return
open
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
rnames
)).
read
()
long_description
=
(
read
(
'README.txt'
)
+
'
\
n
'
+
read
(
'CHANGES.txt'
)
)
setup
(
name
=
name
,
version
=
version
,
author
=
"Cedric de Saint Martin"
,
author_email
=
"cedric.dsm@tiolive.com"
,
description
=
"zc.buildout recipe that downloads and installs Java"
,
long_description
=
long_description
,
license
=
'ZPL 2.1'
,
keywords
=
"buildout java slapos"
,
url
=
'http://www.slapos.org/'
,
packages
=
find_packages
(
'src'
),
include_package_data
=
True
,
package_dir
=
{
''
:
'src'
},
namespace_packages
=
[
'slapos'
,
'slapos.recipe'
],
install_requires
=
[
'zc.buildout'
,
'setuptools'
],
entry_points
=
{
'zc.buildout'
:
[
'default = %s.recipe:Recipe'
%
name
]},
)
slapos/slapos.recipe.java/src/slapos/__init__.py
0 → 100644
View file @
e1078967
# namespace package boilerplate
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.recipe.java/src/slapos/recipe/__init__.py
0 → 100644
View file @
e1078967
# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
try
:
__import__
(
'pkg_resources'
).
declare_namespace
(
__name__
)
except
ImportError
:
from
pkgutil
import
extend_path
__path__
=
extend_path
(
__path__
,
__name__
)
slapos/slapos.recipe.java/src/slapos/recipe/java/__init__.py
0 → 100644
View file @
e1078967
#
slapos/slapos.recipe.java/src/slapos/recipe/java/recipe.py
0 → 100644
View file @
e1078967
import
logging
import
os
import
shutil
import
zc.buildout.easy_install
import
zc.buildout.download
from
platform
import
uname
import
subprocess
JAVA_URLS
=
{
'x86'
:
"http://javadl.sun.com/webapps/download/AutoDL?BundleId=48334"
,
'x86-64'
:
"http://javadl.sun.com/webapps/download/AutoDL?BundleId=48338"
}
# See http://java.com/en/download/manual.jsp
ARCH_MAP
=
{
'i386'
:
'x86'
,
'i586'
:
'x86'
,
'i686'
:
'x86'
,
'x86_64'
:
'x86-64'
}
ARCH_DIR_MAP
=
{
'x86'
:
'x86'
,
'x86-64'
:
'x86_64'
}
class
Recipe
(
object
):
def
__init__
(
self
,
buildout
,
name
,
options
):
self
.
buildout
=
buildout
self
.
name
=
name
self
.
options
=
options
self
.
logger
=
logging
.
getLogger
(
self
.
name
)
options
[
'location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
options
.
setdefault
(
'cpio'
,
'cpio'
)
options
.
setdefault
(
'tmp-storage'
,
options
[
'location'
]
+
'__unpack__'
)
if
not
options
.
get
(
'download-url'
):
options
.
setdefault
(
'platform'
,
self
.
_guessPackagePlatform
())
options
.
setdefault
(
'flavour'
,
'oracle-jdk'
)
# or 'openjdk'
if
options
[
'flavour'
]
==
'openjdk'
:
raise
Exception
(
'OpenJDK is not yet supported.'
)
else
:
options
[
'download-url'
]
=
JAVA_URLS
[
options
[
'platform'
]]
def
_guessPackagePlatform
(
self
):
arch
=
uname
()[
-
2
]
target
=
ARCH_MAP
.
get
(
arch
)
assert
target
,
'Unknown architecture'
return
target
def
install
(
self
):
location
=
self
.
options
[
'location'
]
if
os
.
path
.
exists
(
location
):
return
location
storage
=
self
.
options
[
'tmp-storage'
]
download_file
,
is_temp
=
self
.
download
()
self
.
extract
(
storage
,
download_file
)
self
.
copy
(
storage
)
shutil
.
rmtree
(
storage
)
return
[
location
,]
def
download
(
self
):
"""Download tarball. Caching if required.
"""
url
=
self
.
options
[
'download-url'
]
namespace
=
self
.
options
[
'recipe'
]
download
=
zc
.
buildout
.
download
.
Download
(
self
.
buildout
[
'buildout'
],
namespace
=
namespace
,
logger
=
self
.
logger
)
return
download
(
url
)
def
extract
(
self
,
storage
,
download_file
):
# Creates parts/java__something temp dir
if
os
.
path
.
exists
(
storage
):
shutil
.
rmtree
(
storage
)
os
.
mkdir
(
storage
)
os
.
chdir
(
storage
)
# Move downloaded file into temp dir
(
download_dir
,
filename
)
=
os
.
path
.
split
(
download_file
)
auto_extract_bin
=
os
.
path
.
join
(
storage
,
filename
)
shutil
.
move
(
download_file
,
auto_extract_bin
)
# Run auto-extract bin file
os
.
chmod
(
auto_extract_bin
,
0777
)
subprocess
.
call
([
auto_extract_bin
])
def
copy
(
self
,
storage
):
"""Copy java installation into parts directory.
"""
location
=
self
.
options
[
'location'
]
if
os
.
path
.
exists
(
location
):
self
.
logger
.
info
(
'No need to re-install java part'
)
return
False
self
.
logger
.
info
(
"Copying unpacked contents"
)
java_dir
=
''
for
java_dir
in
(
'java'
,
'jre1.6.0_25'
):
if
os
.
path
.
isdir
(
os
.
path
.
join
(
storage
,
java_dir
)):
break
assert
java_dir
,
'Java directory seems missing.'
ignore_dir_list
=
[]
if
'ignore'
in
shutil
.
copytree
.
func_code
.
co_varnames
:
shutil
.
copytree
(
os
.
path
.
join
(
storage
,
java_dir
),
location
,
ignore
=
lambda
src
,
names
:
ignore_dir_list
)
else
:
shutil
.
copytree
(
os
.
path
.
join
(
storage
,
java_dir
),
location
)
for
ignore_dir
in
ignore_dir_list
:
ignore_dir
=
os
.
path
.
join
(
location
,
ignore_dir
)
if
os
.
path
.
exists
(
ignore_dir
):
shutil
.
rmtree
(
ignore_dir
)
return
True
def
update
(
self
):
pass
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