Commit 25369e03 authored by Julien Muchembled's avatar Julien Muchembled

Drop multiarch support

It was redundant with conditional configuration sections.
SlapOS fork of zc.buildout has 'multiarch' value since 2.7.1+slapos015
parent ab661f01
...@@ -24,18 +24,15 @@ Example that installs software:: ...@@ -24,18 +24,15 @@ Example that installs software::
statlib:lib/libfoo.a statlib:lib/libfoo.a
statlib:lib/libfoo.la statlib:lib/libfoo.la
dynlib:bin/foo linked:libbar.so.1,libc.so.6,libfoo.so.1 rpath:${bar:location}/lib,!/lib dynlib:bin/foo linked:libbar.so.1,libc.so.6,libfoo.so.1 rpath:${bar:location}/lib,!/lib
i386-linux-gnu = http://host/path/i386.tar.gz [md5sum] url = http://host/path/foo.tar.gz
x86_64-linux-gnu = http://host/path/amd64.tar.gz [md5sum] md5sum = ...
install = install =
url, md5sum = options[multiarch()].split() extract_dir = self.extract(self.download(options['url'], options['md5sum']))
extract_dir = self.extract(self.download(url, md5sum))
self.copyTree(guessworkdir(extract_dir), location) self.copyTree(guessworkdir(extract_dir), location)
${:update} ${:update}
update = update =
... ...
See also the ``download-unpacked`` recipe, which has options to install multiarch specific archives.
Using the init option:: Using the init option::
[section-one] [section-one]
...@@ -509,23 +506,6 @@ Example:: ...@@ -509,23 +506,6 @@ Example::
Uninstalling download. Uninstalling download.
Installing download. Installing download.
multiarch
---------
`url` (optionally combined with `md5sum` and `alternate-url`) is actually a
default option to specify what to download. It can be overridden with machine
specific value, like in the example of the default recipe::
[buildout]
parts =
download
[download]
recipe = slapos.recipe.build:download-unpacked
i386-linux-gnu = http://host/path/i386.tar.gz [alternate-url] md5sum]
x86_64-linux-gnu = http://host/path/amd64.tar.gz [[alternate-url] md5sum]
Values can be separated with newlines.
============================== ==============================
slapos.recipe.build:gitclone slapos.recipe.build:gitclone
......
...@@ -5,7 +5,7 @@ except ImportError: ...@@ -5,7 +5,7 @@ except ImportError:
from pkgutil import extend_path from pkgutil import extend_path
__path__ = extend_path(__path__, __name__) __path__ = extend_path(__path__, __name__)
import errno, json, logging, os, shutil, stat, subprocess import errno, json, logging, os, shutil, stat
from hashlib import md5 from hashlib import md5
from zc.buildout import UserError from zc.buildout import UserError
from zc.buildout.rmtree import rmtree as buildout_rmtree from zc.buildout.rmtree import rmtree as buildout_rmtree
...@@ -31,22 +31,6 @@ def make_read_only_recursively(path): ...@@ -31,22 +31,6 @@ def make_read_only_recursively(path):
for file_ in file_list: for file_ in file_list:
make_read_only(os.path.join(root, file_)) make_read_only(os.path.join(root, file_))
def multiarch():
try:
m = multiarch.cache
except AttributeError:
try:
m = subprocess.check_output(
('gcc', '-dumpmachine'), universal_newlines=True).rstrip()
except Exception as e:
m = e
multiarch.cache = m
if type(m) is str:
if m:
return m
raise Exception("empty multiarch value")
raise m
def rmtree(path): def rmtree(path):
try: try:
buildout_rmtree(path) buildout_rmtree(path)
......
...@@ -35,7 +35,7 @@ import sys ...@@ -35,7 +35,7 @@ import sys
import tempfile import tempfile
from setuptools import archive_util from setuptools import archive_util
import zc.buildout import zc.buildout
from .. import is_true, multiarch, rmtree, EnvironMixin, Shared from .. import is_true, rmtree, EnvironMixin, Shared
from ..downloadunpacked import extraction_drivers, patched_extraction_drivers from ..downloadunpacked import extraction_drivers, patched_extraction_drivers
def readElfAsDict(f): def readElfAsDict(f):
...@@ -80,7 +80,7 @@ def guessworkdir(path): ...@@ -80,7 +80,7 @@ def guessworkdir(path):
return os.path.join(path, *x) if len(x) == 1 else path return os.path.join(path, *x) if len(x) == 1 else path
GLOBALS = (lambda *x: {x.__name__: x for x in x})( GLOBALS = (lambda *x: {x.__name__: x for x in x})(
call, guessworkdir, is_true, multiarch) call, guessworkdir, is_true)
class Script(EnvironMixin): class Script(EnvironMixin):
"""Free script building system""" """Free script building system"""
......
...@@ -31,8 +31,7 @@ import tarfile ...@@ -31,8 +31,7 @@ import tarfile
import tempfile import tempfile
from hashlib import md5 from hashlib import md5
from setuptools import archive_util from setuptools import archive_util
from zc.buildout import UserError from . import is_true, EnvironMixin, Shared
from . import is_true, multiarch, EnvironMixin, Shared
from . import make_read_only_recursively # for slapos.recipe.cmmi from . import make_read_only_recursively # for slapos.recipe.cmmi
class Recipe(EnvironMixin): class Recipe(EnvironMixin):
...@@ -42,25 +41,8 @@ class Recipe(EnvironMixin): ...@@ -42,25 +41,8 @@ class Recipe(EnvironMixin):
self.name = name self.name = name
self.options = options self.options = options
self._strip = is_true(options.get('strip-top-level-dir'), None) self._strip = is_true(options.get('strip-top-level-dir'), None)
self._alternate = options.get('alternate-url') self._url = options['url']
self._md5sum = options.get('md5sum')
url = options.get('url')
try:
m = multiarch()
except Exception as e:
if not url:
raise UserError(
"option 'url' missing; could not fallback on multiarch (%s)" % e)
else:
x = options.get(m)
if x:
x = x.split()
url = x.pop(0)
self._md5sum = x.pop() if x else None
self._alternate, = x or (None,)
elif not url:
raise UserError("missing option: 'url' or %r" % m)
self._url = url
shared = Shared(buildout, name, options) shared = Shared(buildout, name, options)
destination = options.get('destination') destination = options.get('destination')
if destination: if destination:
...@@ -81,9 +63,9 @@ class Recipe(EnvironMixin): ...@@ -81,9 +63,9 @@ class Recipe(EnvironMixin):
# inside slapos.buildout (see networkcache support) # inside slapos.buildout (see networkcache support)
from zc.buildout import download from zc.buildout import download
location = self._shared.location location = self._shared.location
alternate = self._alternate alternate = self.options.get('alternate-url')
path, is_temp = download.Download(self.buildout['buildout'], path, is_temp = download.Download(self.buildout['buildout'],
hash_name=True)(self._url, self._md5sum or None, hash_name=True)(self._url, self.options.get('md5sum') or None,
**({'alternate_url': alternate} if alternate else {})) **({'alternate_url': alternate} if alternate else {}))
try: try:
archive_util.extraction_drivers = patched_extraction_drivers archive_util.extraction_drivers = patched_extraction_drivers
......
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