Bug 1424825: Skip cargo checking file checksums to work around https://github.com/rust-lang/cargo/issues/4813 ; r=me draft
authorTom Prince <mozilla@hocat.ca>
Tue, 12 Dec 2017 14:39:09 -0700
changeset 23494 f88cff8d4bb488997ace1cd9156809b899f90741
parent 23493 02fd46566f884ab908321e95b2bbb9d3f75535fe
push id177
push userbmo:mozilla@hocat.ca
push dateTue, 12 Dec 2017 22:59:56 +0000
reviewersme
bugs1424825
Bug 1424825: Skip cargo checking file checksums to work around https://github.com/rust-lang/cargo/issues/4813 ; r=me MozReview-Commit-ID: 4wOHbMjNW16
client.py
mail/config/mozconfigs/macosx64/debug
mail/config/mozconfigs/macosx64/nightly
mail/config/mozconfigs/macosx64/release
--- a/client.py
+++ b/client.py
@@ -471,16 +471,20 @@ o.add_option("-r", "--rev", dest="defaul
 o.add_option("--apply-patches", dest="apply_patches",
              action="store_true", default=False,
              help="Look for and apply local patches (repo*.patch)")
 
 o.add_option("--tinderbox-print", dest="tinderbox_print",
              action="store_true", default=False,
              help="Print repo revisions for Tinderbox")
 
+o.add_option("--fixup-rust-vendoring-bug-1424825", dest="fixup_rust_vendoring",
+             action="store_true", default=False,
+             help="Remove checksums from vendored rust crates to work around Bug 1424825.")
+
 
 def fixup_comm_repo_options(options):
     """Check options.comm_repo value.
 
     options.comm_repo is normally None.
     This is fine -- our "hg pull" command will omit the repo URL.
     The exception is the initial checkout, which does an "hg clone".
     That command requires a repository URL.
@@ -577,16 +581,35 @@ def fixup_inspector_repo_options(options
             not os.path.exists(os.path.join(topsrcdir, 'mozilla', 'extensions',
                                             'inspector')):
         options.inspector_repo = DEFAULTS['INSPECTOR_REPO']
 
     if options.inspector_rev is None:
         options.inspector_rev = get_DEFAULT_tag("INSPECTOR_REV")
 
 
+def fixup_rust_vendoring():
+    import json
+
+    print("Patching .cargo-checksum.json files to work around Bug 1424825.")
+
+    files = glob.glob("mozilla/third_party/rust/*/.cargo-checksum.json")
+    for file in files:
+        if options.verbose:
+            print("\t{file}".format(file))
+        with open(file, "r") as fp:
+            cksum = json.load(fp)
+        cksum['files'] = {}
+        with open(file, "w") as fp:
+            json.dump(cksum, fp)
+
+    if options.verbose:
+        print("Done patching .cargo-checksum.json files.")
+
+
 try:
     (options, (action,)) = o.parse_args()
 except ValueError:
     o.print_help()
     sys.exit(2)
 
 if options.default_rev:
     # We now wish to override all the DEFAULTS.
@@ -625,11 +648,14 @@ if action in ('checkout', 'co'):
     if not options.skip_inspector:
         fixup_inspector_repo_options(options)
         do_hg_pull(os.path.join('mozilla', 'extensions', 'inspector'),
                    options.inspector_repo, options.hg, options.inspector_rev)
 
     if options.apply_patches:
         do_apply_patches(topsrcdir, options.hg)
 
+    if options.fixup_rust_vendoring:
+        fixup_rust_vendoring()
+
 else:
     o.print_help()
     sys.exit(2)
--- a/mail/config/mozconfigs/macosx64/debug
+++ b/mail/config/mozconfigs/macosx64/debug
@@ -20,14 +20,17 @@ MOZ_REQUIRE_ADDON_SIGNING=0
 export MOZ_PACKAGE_JSSHELL=1
 
 . "$topsrcdir/build/mozconfig.cache"
 
 
 if [ "$MOZ_IS_COMM_TOPDIR" = "1" ]; then
   # XXX hack to work around dsymutil failing on OSX builds (bug 1380381, 1382262)
   ac_add_options RUSTFLAGS='-C debuginfo=1'
+
+  # https://bugzilla.mozilla.org/show_bug.cgi?id=1424825
+  mk_add_options "CLIENT_PY_ARGS += --fixup-rust-vendoring-bug-1424825"
 fi
 
 if [ "$MOZ_IS_COMM_TOPDIR" != "1" ]; then
   # https://bugzilla.mozilla.org/show_bug.cgi?id=1419472
   ac_add_options --disable-clang-plugin
 fi
--- a/mail/config/mozconfigs/macosx64/nightly
+++ b/mail/config/mozconfigs/macosx64/nightly
@@ -23,16 +23,19 @@ MOZ_ADDON_SIGNING=0
 # Disable enforcing that add-ons are signed by the trusted root
 MOZ_REQUIRE_ADDON_SIGNING=0
 
 . "$topsrcdir/build/mozconfig.cache"
 
 if [ "$MOZ_IS_COMM_TOPDIR" = "1" ]; then
   # XXX hack to work around dsymutil failing on OSX builds (bug 1380381, 1382262)
   ac_add_options RUSTFLAGS='-C debuginfo=1'
+
+  # https://bugzilla.mozilla.org/show_bug.cgi?id=1424825
+  mk_add_options "CLIENT_PY_ARGS += --fixup-rust-vendoring-bug-1424825"
 fi
 
 if [ "$MOZ_IS_COMM_TOPDIR" != "1" ]; then
   # https://bugzilla.mozilla.org/show_bug.cgi?id=1419472
   ac_add_options --disable-clang-plugin
 fi
 
 mk_add_options "export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token"
--- a/mail/config/mozconfigs/macosx64/release
+++ b/mail/config/mozconfigs/macosx64/release
@@ -20,16 +20,19 @@ MOZ_ADDON_SIGNING=0
 MOZ_REQUIRE_ADDON_SIGNING=0
 
 # Package js shell
 export MOZ_PACKAGE_JSSHELL=1
 
 if [ "$MOZ_IS_COMM_TOPDIR" = "1" ]; then
   # XXX hack to work around dsymutil failing on OSX builds (bug 1380381, 1382262)
   ac_add_options RUSTFLAGS='-C debuginfo=1'
+
+  # https://bugzilla.mozilla.org/show_bug.cgi?id=1424825
+  mk_add_options "CLIENT_PY_ARGS += --fixup-rust-vendoring-bug-1424825"
 fi
 
 if [ "$MOZ_IS_COMM_TOPDIR" != "1" ]; then
   # https://bugzilla.mozilla.org/show_bug.cgi?id=1419472
   ac_add_options --disable-clang-plugin
 fi
 
 mk_add_options "export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token"