Bug 1377524 - Add a version check for tup; r?Build draft
authorMike Shal <mshal@mozilla.com>
Thu, 24 May 2018 14:54:04 -0400
changeset 800045 64d30e0ff0a452af98f34b90e74e5a4e30504bad
parent 800044 0b4f3218107fc52118432935701f821a819e944c
push id111241
push userbmo:mshal@mozilla.com
push dateFri, 25 May 2018 19:34:16 +0000
reviewersBuild
bugs1377524
milestone62.0a1
Bug 1377524 - Add a version check for tup; r?Build We have two checks here - first, to make sure that tup is a recent enough version, and second to make sure that we're using the ldpreload dependency checker. The FUSE dependency checker requires user namespaces to track dependencies when a subprocess uses full paths, and not all Linux distributions have user namespaces enabled by default. Additionally, the FUSE filesystem adds significant overhead for I/O intensive processes (such as linking libxul), which results in a bad user experience. MozReview-Commit-ID: H8l96dV7Qjx
moz.configure
--- a/moz.configure
+++ b/moz.configure
@@ -398,16 +398,49 @@ check_prog('GMAKE', possible_makes)
 def tup_progs(build_backends):
     for backend in build_backends:
         if 'Tup' in backend:
             return ['tup']
     return None
 
 tup = check_prog('TUP', tup_progs)
 
+@depends_if(tup)
+@checking('for tup version')
+@imports('re')
+def tup_version(tup):
+    tup_min_version = '0.7.6'
+    out = check_cmd_output(tup, '--version',
+                           onerror=lambda: die('Failed to get tup version'))
+    m = re.search(r'tup v?([0-9]+\.[0-9]+\.[0-9]+)', out)
+
+    if not m:
+        raise FatalCheckError('Unknown version of tup: %s' % out)
+    ver = Version(m.group(1))
+
+    if ver < tup_min_version:
+        raise FatalCheckError('To use the tup backend you must have tup version '
+                              '%s or greater in your path' % tup_min_version)
+    return ver
+
+@depends_if(tup)
+@checking('for tup ldpreload dependency checker')
+def tup_is_ldpreload(tup):
+    out = check_cmd_output(tup, 'server',
+                           onerror=lambda: die('Failed to get tup dependency checker'))
+    if out.rstrip() != 'ldpreload':
+        raise FatalCheckError('To use the tup backend, please use a version '
+                              'of tup compiled with the ldpreload dependency '
+                              'checker. Either compile tup locally with '
+                              'CONFIG_TUP_SERVER=ldpreload in your tup.config '
+                              'file, or use the version from the toolchain '
+                              'task via |./mach artifact toolchain '
+                              '--from-build linux64-tup|')
+    return True
+
 # watchman detection
 # ==============================================================
 
 option(env='WATCHMAN', nargs=1, help='Path to the watchman program')
 
 @depends('WATCHMAN')
 @checking('for watchman', callback=lambda w: w.path if w else 'not found')
 def watchman(prog):