Use different syntax to specify architectures

parent 94b519d8
......@@ -74,14 +74,24 @@ Example buildout::
slapos_promisee =
...
[architecturedependant]
recipe = slapos.cookbook:download
x86_url = http://host/path/zipball_x86.zip
x86_md5sum = 9631070eac74f92a812d4785a84d1b4e
x86-64_url = http://host/path/zipball_x64.zip
x86-64_md5sum = 9631070eac74f92a812d4785a84d1b4e
[download]
# Downloads, extracts and copy files to part directory
recipe = slapos.recipe.build:download
slapos_promisee =
directory:bin
...
url =
md5sum =
[choosearchitecture]
recipe = slapos.recipe.build:download
slapos_promisee =
directory:bin
...
# List here supported architectures with URL of archive and md5sum
architecture_list =
x86 http://javadl.sun.com/webapps/download/AutoDL?BundleId=483 377456da9fa4d867d4bdf4c655a16dce
x86-64 http://javadl.sun.com/webapps/download/AutoDL?BundleId=48338 bae0cb5d10181abdd9650dcb590eda67
TODO:
......
......@@ -282,12 +282,22 @@ call(["make", "install"], cwd=workdir, env=env)
class Download(Script):
"""Download and install binary package depending on your architecture.
"""
def setUrl(self):
if not self.options.get('url'):
try:
architecture_list = self.options.get('architecture_list').split('\n')
except AttributeError:
architecture_list = []
architecture_dict = dict()
for architecture_information in architecture_list:
if architecture_information is not '':
architecture, url, md5sum = architecture_information.split(' ')
architecture_dict[architecture] = (url, md5sum)
self.options['url'], self.options['md5sum'] = architecture_dict[guessPlatform()]
script = """
if not self.options.get('url'):
architecture = guessPlatform()
self.options['url'] = self.options["%%s_url" %% architecture]
self.options['md5sum'] = self.options["%%s_md5sum" %% architecture]
# Specific url/md5sum can be given. Else, list of architecture-specific urls are given
self.setUrl()
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
print(extract_dir)
workdir = guessworkdir(extract_dir)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment