[buildout]

parts =
  java

[jdk-6u27-no-user-interaction-patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
download-only = true
filename = jdk-6u27-no-user-interaction.patch
md5sum = 4c4303240647a114d07f3c411b2e6b5b

[java]
<= java-re

[java-re]
<= java-re-1.6.0

[java-sdk]
<= java-sdk-1.6.0

[java-re-1.6.0]
recipe = slapos.recipe.build
slapos_promisee =
  directory:bin
  directory:lib
  directory:man
  directory:plugin
  directory:javaws
  file:lib/rt.jar
  file:bin/java
# http://java.com/en/download/manual_v6.jsp
x86 = http://javadl.sun.com/webapps/download/AutoDL?BundleId=68284 7eda40e790de1a907d591b62949b6e72
x86-64 = http://javadl.sun.com/webapps/download/AutoDL?BundleId=68286 839548714931443ba89719a995ece846
script =
  import glob
  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
  download_file = self.download(self.options['url'], self.options.get('md5sum'))
  extract_dir = tempfile.mkdtemp(self.name)
  os.chdir(extract_dir)
  (download_dir, filename) = os.path.split(download_file)
  auto_extract_bin = os.path.join(extract_dir, filename)
  shutil.move(download_file, auto_extract_bin)
  os.chmod(auto_extract_bin, 0755)
  subprocess.call([auto_extract_bin])
  self.cleanup_dir_list.append(extract_dir)
  workdir = guessworkdir(extract_dir)
  self.copyTree(glob.glob(os.path.join(workdir, "jre1.6.0_*"))[0], "%(location)s")

[java-re-1.7.0]
recipe = slapos.recipe.build
slapos_promisee =
  directory:bin
  directory:lib
  directory:man
  directory:plugin
  file:lib/rt.jar
  file:bin/java
# http://java.com/en/download/manual.jsp?locale=en
x86 = http://javadl.sun.com/webapps/download/AutoDL?BundleId=68234 ea99bedd9db33e9e2970f4b70abd1e4b
x86-64 = http://javadl.sun.com/webapps/download/AutoDL?BundleId=68236 5aa9bd26cdf1fa6afd2b15826b4ba139
script =
  if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
  extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
  workdir = guessworkdir(extract_dir)
  self.copyTree(workdir, "%(location)s")
