Bug 1324998 - Error out when a in-tree mozconfig is included. r?gps draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 21 Dec 2016 16:58:38 +0900
changeset 452816 69d633fac3eecb42ea31f83626b4ecafe652000c
parent 452815 3243da874b46e576c92ec9222ee47bc836b7148e
child 540319 d0b96304885f33173362abc6adbdcc08f419f2c9
push id39508
push userbmo:mh+mozilla@glandium.org
push dateThu, 22 Dec 2016 10:07:47 +0000
reviewersgps
bugs1324998
milestone53.0a1
Bug 1324998 - Error out when a in-tree mozconfig is included. r?gps Many people have been shooting themselves in the foot for too long by including in-tree mozconfigs. This change adds a guard that makes it an error when this happens on builds not running on automation. Analysis of the in-tree mozconfigs indicate that build/mozconfig.automation is properly included by the in-tree mozconfig that matter, directly or indirectly. The only ones that don't include it are: b2g/config/mozconfigs/common.override b2g/graphene/config/mozconfigs/common.override browser/config/mozconfigs/linux64/source browser/config/mozconfigs/win64/common-win64 build/mozconfig.cache build/mozconfig.clang-cl build/mozconfig.common.override build/mozconfig.rust build/mozconfig.vs-common build/mozconfig.win-common build/unix/mozconfig.gtk build/unix/mozconfig.stdcxx build/win32/mozconfig.vs-latest build/win32/mozconfig.vs2015-win64 build/win64/mozconfig.vs-latest build/win64/mozconfig.vs2015 mobile/android/config/mozconfigs/common.override which are either empty for use in try builds (override files), or would already cause great pain if they were directly included, so there's little chance they would be.
build/moz.configure/init.configure
build/mozconfig.automation
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -223,22 +223,30 @@ def early_options():
             option.env
             for option in __sandbox__._options.itervalues()
             if option.env
         )
     return early_options
 
 early_options = early_options()
 
-@depends(mozconfig, '--help')
+@depends(mozconfig, 'MOZ_AUTOMATION', '--help')
 # This gives access to the sandbox. Don't copy this blindly.
 @imports('__sandbox__')
 @imports('os')
-def mozconfig_options(mozconfig, help):
+def mozconfig_options(mozconfig, automation, help):
     if mozconfig['path']:
+        if 'MOZ_AUTOMATION_MOZCONFIG' in mozconfig['env']['added']:
+            if not automation:
+                log.error('%s directly or indirectly includes an in-tree '
+                          'mozconfig.', mozconfig['path'])
+                log.error('In-tree mozconfigs make strong assumptions about '
+                          'and are only meant to be used by Mozilla'
+                          'automation.')
+                die("Please don't use them.")
         helper = __sandbox__._helper
         log.info('Adding configure options from %s' % mozconfig['path'])
         for arg in mozconfig['configure_args']:
             log.info('  %s' % arg)
             # We could be using imply_option() here, but it has other
             # contraints that don't really apply to the command-line
             # emulation that mozconfig provides.
             helper.add(arg, origin='mozconfig', args=helper._args)
--- a/build/mozconfig.automation
+++ b/build/mozconfig.automation
@@ -26,8 +26,10 @@ if test "$MOZ_AUTOMATION_PRETTY" = "1"; 
     mk_add_options "export MOZ_AUTOMATION_PRETTY_PACKAGE_TESTS=${MOZ_AUTOMATION_PACKAGE_TESTS-1}"
     mk_add_options "export MOZ_AUTOMATION_PRETTY_L10N_CHECK=${MOZ_AUTOMATION_L10N_CHECK-1}"
     mk_add_options "export MOZ_AUTOMATION_PRETTY_INSTALLER=${MOZ_AUTOMATION_INSTALLER-0}"
 
     # Note that we always build the update packaging with pretty names even if
     # we don't build it without, so this is set to 1.
     mk_add_options "export MOZ_AUTOMATION_PRETTY_UPDATE_PACKAGING=1"
 fi
+
+export MOZ_AUTOMATION_MOZCONFIG=1