Bug 1290957 - ensure MOZ_AUTOMATION builds require a cargo with --frozen support; r=chmanchester

We want to ensure that our automation builds don't pull in libraries
from crates.io, and we need --frozen support in cargo to do that.  If we
don't have that support, we shouldn't build.
This commit is contained in:
Nathan Froyd 2016-08-09 18:10:19 -04:00
parent d7beb70278
commit 81545d0022

View File

@ -32,12 +32,16 @@ def rustc_info(rustc):
@depends_if(cargo)
@checking('cargo support for --frozen')
@imports('subprocess')
@imports('os')
def cargo_supports_frozen(cargo):
try:
lines = subprocess.check_output(
[cargo, 'help', 'build']
).splitlines()
return any(' --frozen' in l for l in lines)
supported = any(' --frozen' in l for l in lines)
if 'MOZ_AUTOMATION' in os.environ and not supported:
die('cargo in automation must support --frozen')
return supported
except subprocess.CalledProcessError as e:
die('Failed to call cargo: %s', e.message)