[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
x86 = http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jre-6u30-linux-i586.bin 3e80243483bc825c34ae01a4373cce5f
x86-64 = http://download.oracle.com/otn-pub/java/jdk/6u30-b12/jre-6u30-linux-x64.bin a4d28c49251d6b9c2d300b3d61f1ce95
script =
  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, 0777)
  subprocess.call([auto_extract_bin])
  self.cleanup_dir_list.append(extract_dir)
  workdir = guessworkdir(extract_dir)
  self.copyTree(os.path.join(workdir, "jre1.6.0_30"), "%(location)s")

[java-sdk-1.6.0]
recipe = slapos.recipe.build
slapos_promisee =
  directory:bin
  directory:lib
  directory:man
  directory:plugin
  directory:javaws
  file:jre/lib/rt.jar
  file:bin/java
x86 = http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-i586.bin bdb5f05bd20c6aa9a4729726191bf6fd
x86-64 = http://download.oracle.com/otn-pub/java/jdk/6u27-b07/jdk-6u27-linux-x64.bin 94f93a3ff03f824a238ecd79ad90433e
script =
  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, 0777)
  subprocess.call(["patch", auto_extract_bin, "-i", "${jdk-6u27-no-user-interaction-patch:location}/${jdk-6u27-no-user-interaction-patch:filename}"])
  subprocess.call([auto_extract_bin])
  self.cleanup_dir_list.append(extract_dir)
  workdir = guessworkdir(extract_dir)
  self.copyTree(os.path.join(workdir, "jdk1.6.0_27"), "%(location)s")

[java-sdk-1.7.0]
recipe = slapos.recipe.build
slapos_promisee =
  directory:bin
  directory:lib
  directory:man
  directory:jre
  file:jre/lib/rt.jar
  file:bin/java
  file:bin/javac
x86 = http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-i586.tar.gz f97244a104f03731e5ff69f0dd5a9927
x86-64 = http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz b3c1ef5faea7b180469c129a49762b64
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")