--- a/python/mozbuild/mozbuild/vendor_rust.py
+++ b/python/mozbuild/mozbuild/vendor_rust.py
@@ -34,25 +34,28 @@ class VendorRust(MozbuildObject):
'''
out = subprocess.check_output([cargo, '--version']).splitlines()[0]
if not out.startswith('cargo'):
return False
return LooseVersion(out.split()[1]) >= b'0.13'
def check_cargo_vendor_version(self, cargo):
'''
- Ensure that cargo-vendor is new enough. cargo-vendor 0.1.3 and newer
- strips out .gitattributes files which we want.
+ Ensure that cargo-vendor is new enough. cargo-vendor 0.1.11 and newer
+ strips out .orig and .rej files which we want.
'''
for l in subprocess.check_output([cargo, 'install', '--list']).splitlines():
- # The line looks like `cargo-vendor v0.1.3:`
- m = re.match('cargo-vendor v((\d\.)*\d):', l)
+ # The line looks like one of the following:
+ # cargo-vendor v0.1.11:
+ # cargo-vendor v0.1.11 (file:///path/to/local/build/cargo-vendor):
+ # and we want to extract the version part of it
+ m = re.match('cargo-vendor v((\d+\.)*\d+)', l)
if m:
version = m.group(1)
- return LooseVersion(version) >= b'0.1.3'
+ return LooseVersion(version) >= b'0.1.11'
return False
def check_modified_files(self):
'''
Ensure that there aren't any uncommitted changes to files
in the working copy, since we're going to change some state
on the user. Allow changes to Cargo.{toml,lock} since that's
likely to be a common use case.
@@ -109,17 +112,17 @@ Please commit or stash these changes bef
self.log(logging.DEBUG, 'cargo_version', {}, 'cargo is new enough')
have_vendor = any(l.strip() == 'vendor' for l in subprocess.check_output([cargo, '--list']).splitlines())
if not have_vendor:
self.log(logging.INFO, 'installing', {}, 'Installing cargo-vendor (this may take a few minutes)...')
env = self.check_openssl()
self.run_process(args=[cargo, 'install', 'cargo-vendor'],
append_env=env)
elif not self.check_cargo_vendor_version(cargo):
- self.log(logging.INFO, 'cargo_vendor', {}, 'cargo-vendor >= 0.1.3 required; force-reinstalling (this may take a few minutes)...')
+ self.log(logging.INFO, 'cargo_vendor', {}, 'cargo-vendor >= 0.1.11 required; force-reinstalling (this may take a few minutes)...')
env = self.check_openssl()
self.run_process(args=[cargo, 'install', '--force', 'cargo-vendor'],
append_env=env)
else:
self.log(logging.DEBUG, 'cargo_vendor', {}, 'sufficiently new cargo-vendor is already installed')
return cargo
@@ -269,17 +272,17 @@ license file's hash.
('gkrust-gtest', 'toolkit/library/gtest/rust'),
('mozjs_sys', 'js/src'),
('geckodriver', 'testing/geckodriver'),
)
for (lib, crate_root) in crates_and_roots:
path = mozpath.join(self.topsrcdir, crate_root)
# We do an |update -p| here to regenerate the Cargo.lock file with minimal changes. See bug 1324462
self._run_command_in_srcdir(args=[cargo, 'update', '--manifest-path', mozpath.join(path, 'Cargo.toml'), '-p', lib])
- self._run_command_in_srcdir(args=[cargo, 'vendor', '--sync', mozpath.join(path, 'Cargo.lock'), vendor_dir])
+ self._run_command_in_srcdir(args=[cargo, 'vendor', '--no-delete', '--sync', mozpath.join(path, 'Cargo.lock'), vendor_dir])
if not self._check_licenses(vendor_dir):
self.log(logging.ERROR, 'license_check_failed', {},
'''The changes from `mach vendor rust` will NOT be added to version control.''')
sys.exit(1)
self.repository.add_remove_files(vendor_dir)