Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Show changes
Commits on Source (6)
Showing
with 122 additions and 27 deletions
......@@ -17,8 +17,8 @@
# Authors:
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
import os
from .optionenum import OptionEnum
from ..utils import arch_from_uname
# OptionArch
......@@ -41,8 +41,7 @@ class OptionArch(OptionEnum):
super(OptionArch, self).load(node, allow_default_definition=False)
def load_default_value(self, node):
_, _, _, _, machine_arch = os.uname()
return machine_arch
return arch_from_uname()
def resolve(self):
......
#
# Copyright (C) 2017 Codethink Limited
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http://www.gnu.org/licenses/>.
#
# Authors:
# Raoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>
import os
from .optionenum import OptionEnum
# OptionOS
#
class OptionOS(OptionEnum):
OPTION_TYPE = 'os'
def load(self, node):
super(OptionOS, self).load(node, allow_default_definition=False)
def load_default_value(self, node):
return os.uname()[0]
def resolve(self):
# Validate that the default OS reported by uname() is explicitly
# supported by the project, if not overridden by user config or cli.
self.validate(self.value)
......@@ -28,6 +28,7 @@ from .optionenum import OptionEnum
from .optionflags import OptionFlags
from .optioneltmask import OptionEltMask
from .optionarch import OptionArch
from .optionos import OptionOS
_OPTION_TYPES = {
......@@ -36,6 +37,7 @@ _OPTION_TYPES = {
OptionFlags.OPTION_TYPE: OptionFlags,
OptionEltMask.OPTION_TYPE: OptionEltMask,
OptionArch.OPTION_TYPE: OptionArch,
OptionOS.OPTION_TYPE: OptionOS,
}
......
......@@ -73,6 +73,44 @@ class Platform():
else:
return min(cpu_count, cap)
@staticmethod
def get_host_os():
return os.uname()[0]
# get_host_arch():
#
# This returns the architecture of the host machine. The possible values
# map from uname -m in order to be a OS independent list.
#
# Returns:
# (string): String representing the architecture
@staticmethod
def get_host_arch():
# get the hardware identifier from uname
uname_machine = os.uname()[4]
uname_to_arch = {
"aarch64": "AArch64",
"aarch64_be": "AArch64-BE",
"amd64": "x86-64",
"arm": "AArch32",
"armv8l": "AArch64-LE",
"armv8b": "AArch64-BE",
"i386": "x86-32",
"i486": "x86-32",
"i586": "x86-32",
"i686": "x86-32",
"ppc64": "Power-ISA-BE",
"ppc64le": "Power-ISA-LE",
"sparc": "Sparc-V9",
"sparc64": "Sparc-V9",
"x86_64": "x86-64"
}
try:
return uname_to_arch[uname_machine]
except KeyError:
raise PlatformError("uname gave unsupported machine architecture: {}"
.format(uname_machine))
##################################################################
# Sandbox functions #
##################################################################
......
......@@ -2340,6 +2340,11 @@ class Element(Plugin):
project.ensure_fully_loaded()
sandbox_config = _yaml.node_chain_copy(project._sandbox)
# Get the platform to ask for host architecture
platform = Platform.get_platform()
host_arch = platform.get_host_arch()
host_os = platform.get_host_os()
# The default config is already composited with the project overrides
sandbox_defaults = _yaml.node_get(self.__defaults, Mapping, 'sandbox', default_value={})
sandbox_defaults = _yaml.node_chain_copy(sandbox_defaults)
......@@ -2349,10 +2354,13 @@ class Element(Plugin):
_yaml.node_final_assertions(sandbox_config)
# Sandbox config, unlike others, has fixed members so we should validate them
_yaml.node_validate(sandbox_config, ['build-uid', 'build-gid'])
_yaml.node_validate(sandbox_config, ['build-uid', 'build-gid', 'build-os', 'build-arch'])
return SandboxConfig(self.node_get_member(sandbox_config, int, 'build-uid'),
self.node_get_member(sandbox_config, int, 'build-gid'))
return SandboxConfig(
self.node_get_member(sandbox_config, int, 'build-uid'),
self.node_get_member(sandbox_config, int, 'build-gid'),
self.node_get_member(sandbox_config, str, 'build-os', default=host_os),
self.node_get_member(sandbox_config, str, 'build-arch', default=host_arch))
# This makes a special exception for the split rules, which
# elements may extend but whos defaults are defined in the project.
......
......@@ -16,7 +16,6 @@
#
# Authors:
# Jim MacArthur <jim.macarthur@codethink.co.uk>
import os
# SandboxConfig
......@@ -24,9 +23,11 @@ import os
# A container for sandbox configuration data. We want the internals
# of this to be opaque, hence putting it in its own private file.
class SandboxConfig():
def __init__(self, build_uid, build_gid):
def __init__(self, build_uid, build_gid, build_os=None, build_arch=None):
self.build_uid = build_uid
self.build_gid = build_gid
self.build_os = build_os
self.build_arch = build_arch
# get_unique_key():
#
......@@ -45,10 +46,9 @@ class SandboxConfig():
# However this should be the right place to support
# such configurations in the future.
#
operating_system, _, _, _, machine_arch = os.uname()
unique_key = {
'os': operating_system,
'arch': machine_arch
'os': self.build_os,
'arch': self.build_arch
}
# Avoid breaking cache key calculation with
......
......@@ -65,13 +65,20 @@ class SandboxRemote(Sandbox):
EnvironmentVariable(name=k, value=v)
for (k, v) in environment.items()]
config = self._get_config()
platform = remote_execution_pb2.Platform()
platform.properties.extend([remote_execution_pb2.Platform.
Property(name="os", value=config.build_os),
remote_execution_pb2.Platform.
Property(name="arch", value=config.build_arch)])
# Create and send the Command object.
remote_command = remote_execution_pb2.Command(arguments=command,
working_directory=working_directory,
environment_variables=environment_variables,
output_files=[],
output_directories=[self._output_directory],
platform=None)
platform=platform)
context = self._get_context()
cascache = context.artifactcache
# Upload the Command message to the remote CAS server
......
......@@ -5,10 +5,10 @@ sources:
url: gnomesdk:repo/
gpg-key: keys/gnome-sdk.gpg
(?):
- arch == "x86_64":
- arch == "x86-64":
track: runtime/org.freedesktop.BaseSdk/x86_64/1.4
ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882
- arch == "i386":
- arch == "x86-32":
track: runtime/org.freedesktop.BaseSdk/i386/1.4
ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981
config:
......
......@@ -10,6 +10,6 @@ options:
type: arch
description: The machine architecture
values:
- x86_64
- i386
- x86-64
- x86-32
......@@ -144,7 +144,7 @@ DATA_DIR = os.path.join(
# The cache key test uses a project which exercises all plugins,
# so we cant run it at all if we dont have them installed.
#
@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
reason='Cache keys depend on architecture')
@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
@pytest.mark.skipif(HAVE_BZR is False, reason="bzr is not available")
......
ce0ddf7126d45d14f5ec1a525337c39ec8ddbbe4b0ec2ef51bae777619ed39bb
\ No newline at end of file
a0d000abc1dea8714cd27f348d0b798b35e7246c44e330c4b3f7912fabacc6db
\ No newline at end of file
5e2a48dbeae43f6bab84071dbd02345a3aa32a473c189645ab26f3d5d6cfe547
\ No newline at end of file
79f546a78748d943a6958c99ab4ad03305f96fefd0b424b6b246b0c9816e00c6
\ No newline at end of file
b63c517f604e8ca64e973476f687190d14a813a0bf77573b93a557f5fb7ae214
\ No newline at end of file
36cb2ac57281343959266e87913eb690f4c68980d7267160ff5f071db778719d
\ No newline at end of file
6676f1cce86166eb66ab83254fe2deb43be93644967de110dd42713dea181508
\ No newline at end of file
30ffe86750a497052f8fc868c47a08644cd579f8e86f59be9b04fa5530b6a9b6
\ No newline at end of file
0f8f444566c097067f2dfa54f26100abff85cc49bf9acf0081129f53244bc144
\ No newline at end of file
1bac1d17cc2aed85ab14daf264f955b2204823799bc5bac5ff77c79b32d0c08b
\ No newline at end of file
aa72331d42f647e845243e8a77389febfb78acff09f70771a3545bdf0d4d70ad
\ No newline at end of file
99690e3a915f4c5b6f76a5bcee8bffe74d077a4398ac29623be36bca26703290
\ No newline at end of file
37bb4486f42e04b8a1c9f9cb9358adfd0d4dae0bb3b2a4072e090848cd2b955d
\ No newline at end of file
a3e25dabe35a2909920f94c9e457c977b00dfa49c161b82c47ad55e761349c6a
\ No newline at end of file
ce2dce59ad7fa810c945e7385cc25d4c8992adf71fbdc44336cf136330fe2b16
\ No newline at end of file
791aaae474dce95f98c849d748088697334a9b4bfcb6225c59804efe03e803c9
\ No newline at end of file
4fd32ee29026ecbcee717c8f04a0b807934a7042d67b8786e0eb9326757c845d
\ No newline at end of file
3aaf0565ffbeb2faa4e48230d07ef839b9bc2ff012780ca9b5f6b9c968f539b2
\ No newline at end of file
e24dd31bda628616138014391a94040490da0820a2c42ab10ec6dfad1b694df9
\ No newline at end of file
7cadfb9b592af06fa765389278d919cb8e29515ad057710563da9cd1c36e2ce9
\ No newline at end of file