Bug 1232466 - beta CI builds fail trying to use printconfigsetting.py, r=rail
authorJordan Lund <jlund@mozilla.com>
Tue, 15 Dec 2015 13:50:19 -0800
changeset 4600 b99e35634c328c747af77d8048c14edf6fcb8276
parent 4598 12ecc34610a670c221c7e1ac4b5c0a30f6ac00c1
child 4601 e8dc4cd30b9e1862e4b07b8bf13dae2ab1a67e9e
child 4603 73e830d00659a3ba5a85f59f79968ccceabea093
push id3854
push userjlund@mozilla.com
push dateTue, 15 Dec 2015 21:50:30 +0000
reviewersrail
bugs1232466
Bug 1232466 - beta CI builds fail trying to use printconfigsetting.py, r=rail
process/factory.py
--- a/process/factory.py
+++ b/process/factory.py
@@ -1355,39 +1355,44 @@ class MercurialBuildFactory(MozillaBuild
                      mock_workdir_prefix=None,
                      ))
 
     def addBuildInfoSteps(self):
         """Helper function for getting build information into properties.
         Looks for self._gotBuildInfo to make sure we only run this set of steps
         once."""
         if not getattr(self, '_gotBuildInfo', False):
-            if self.mozillaSrcDir:
-                # Thunderbird uses the c-c's config/printconfigsetting.py due to
-                # the removal of configobj.py (bug 957911)
-                useConfigDir = '%s/config' % self.baseWorkDir
+            printconfig_env = self.env.copy()
+            del printconfig_env['MOZ_OBJDIR']
+            printconfig_workdir = WithProperties('%(basedir)s/build/' + self.objdir)
+            # hax https://bugzilla.mozilla.org/show_bug.cgi?id=1232466#c10
+            if self.platform.startswith('win'):
+                python = ['c:/mozilla-build/python27/python', '-u']
             else:
-                useConfigDir = 'build%s/config' % self.mozillaSrcDir
+                python = ['/tools/buildbot/bin/python']
+            # we need abs paths because we are in a non relative workdir
+            printconfig_base_command = python + [
+                WithProperties('%(basedir)s/build/mach'), 'python',
+                WithProperties('%(basedir)s/build' + '%s/config/printconfigsetting.py' % self.mozillaSrcDir),
+                WithProperties('%(basedir)s/build' + '/%s/dist/bin/application.ini' % self.mozillaObjdir),
+            ]
+
             self.addStep(SetProperty(
-                command=[
-                    'python', '%s/printconfigsetting.py' % useConfigDir,
-                    'build/%s/dist/bin/application.ini' % self.mozillaObjdir,
-                    'App', 'BuildID'],
+                command=printconfig_base_command + ['App', 'BuildID'],
                 property='buildid',
-                workdir='.',
+                workdir=printconfig_workdir,
+                env=printconfig_env,
                 description=['getting', 'buildid'],
                 descriptionDone=['got', 'buildid'],
             ))
             self.addStep(SetProperty(
-                command=[
-                    'python', '%s/printconfigsetting.py' % useConfigDir,
-                    'build/%s/dist/bin/application.ini' % self.mozillaObjdir,
-                    'App', 'SourceStamp'],
+                command=printconfig_base_command + ['App', 'SourceStamp'],
                 property='sourcestamp',
-                workdir='.',
+                workdir=printconfig_workdir,
+                env=printconfig_env,
                 description=['getting', 'sourcestamp'],
                 descriptionDone=['got', 'sourcestamp']
             ))
             self._gotBuildInfo = True
 
     def addBuildAnalysisSteps(self):
         if self.platform in ('linux', 'linux64'):
             # Analyze the number of ctors
@@ -1642,45 +1647,49 @@ class MercurialBuildFactory(MozillaBuild
                 haltOnFailure=True
             ))
             if installerFilename:
                 self.addFilePropertiesSteps(filename=installerFilename,
                                             directory='build/%s/dist/install/sea' % self.mozillaObjdir,
                                             fileType='installer',
                                             haltOnFailure=True)
 
-        if self.mozillaSrcDir:
-            useConfigDir = '%s/config' % self.baseWorkDir
+        printconfig_env = self.env.copy()
+        del printconfig_env['MOZ_OBJDIR']
+        printconfig_workdir = WithProperties('%(basedir)s/build/' + self.objdir)
+        # hax https://bugzilla.mozilla.org/show_bug.cgi?id=1232466#c10
+        if self.platform.startswith('win'):
+            python = ['c:/mozilla-build/python27/python', '-u']
         else:
-            useConfigDir = 'build%s/config' % self.mozillaSrcDir
+            python = ['/tools/buildbot/bin/python']
+        # we need abs paths because we are in a non relative workdir
+        printconfig_base_command = python + [
+            WithProperties('%(basedir)s/build/mach'), 'python',
+            WithProperties('%(basedir)s/build' + '%s/config/printconfigsetting.py' % self.mozillaSrcDir),
+            WithProperties('%(basedir)s/build' + '/%s/dist/bin/application.ini' % self.mozillaObjdir),
+        ]
         self.addStep(SetProperty(
-            command=[
-                'python', '%s/printconfigsetting.py' % useConfigDir,
-                        'build/%s/dist/bin/application.ini' % self.mozillaObjdir,
-                        'App', 'BuildID'],
+            command=printconfig_base_command + ['App', 'BuildID'],
             property='buildid',
-            workdir='.',
+            workdir=printconfig_workdir,
+            env=printconfig_env,
             name='get_build_id',
         ))
         self.addStep(SetProperty(
-            command=[
-                'python', '%s/printconfigsetting.py' % useConfigDir,
-                        'build/%s/dist/bin/application.ini' % self.mozillaObjdir,
-                        'App', 'Version'],
+            command=printconfig_base_command + ['App', 'Version'],
             property='appVersion',
-            workdir='.',
+            workdir=printconfig_workdir,
+            env=printconfig_env,
             name='get_app_version',
         ))
         self.addStep(SetProperty(
-            command=[
-                'python', '%s/printconfigsetting.py' % useConfigDir,
-                        'build/%s/dist/bin/application.ini' % self.mozillaObjdir,
-                        'App', 'Name'],
+            command=printconfig_base_command + ['App', 'Name'],
             property='appName',
-            workdir='.',
+            workdir=printconfig_workdir,
+            env=printconfig_env,
             name='get_app_name',
         ))
         self.pkg_env = pkg_env
 
     def addUploadSteps(self):
         if self.multiLocale:
             self.doUpload(postUploadBuildDir='en-US')
             cmd = ['python', '%s/%s' % (self.mozharness_path, self.multiLocaleScript),
@@ -2143,33 +2152,39 @@ class NightlyBuildFactory(MercurialBuild
             filename='application.ini',
             directory='previous',
             filetype='file',
             max_depth=4,
             property_name='previous_inipath',
             workdir=self.absMozillaObjDir,
             haltOnFailure=True,
         ))
-        if self.mozillaSrcDir:
-            # Thunderbird uses mozilla/ but uses
-            # comm-*'s /config/printconfigsettings.py
-            useConfigDir = '%s/config' % self.baseWorkDir
+        printconfig_env = self.env.copy()
+        del printconfig_env['MOZ_OBJDIR']
+        printconfig_workdir = WithProperties('%(basedir)s/build/' + self.objdir)
+        # hax https://bugzilla.mozilla.org/show_bug.cgi?id=1232466#c10
+        if self.platform.startswith('win'):
+            python = ['c:/mozilla-build/python27/python', '-u']
         else:
-            useConfigDir = '%s/config' % self.absMozillaSrcDir
+            python = ['/tools/buildbot/bin/python']
+        # we need abs paths because we are in a non relative workdir
+        printconfig_base_command = python + [
+            WithProperties('%(basedir)s/build/mach'), 'python',
+            # abs*Dir attrs lie. they are not absolute paths
+            WithProperties('%(basedir)s/' + '%s/config/printconfigsetting.py' % self.absMozillaSrcDir),
+            WithProperties('%(basedir)s/' + self.absMozillaObjDir + '/%(previous_inipath)s')
+        ]
         self.addStep(SetProperty(
             name='set_previous_buildid',
             description=['set', 'previous', 'buildid'],
             doStepIf=self.previousMarExists,
-            command=['python',
-                     '%s/printconfigsetting.py' % useConfigDir,
-                     WithProperties(
-                         self.absMozillaObjDir + '/%(previous_inipath)s'),
-                     'App', 'BuildID'],
+            command=printconfig_base_command + ['App', 'BuildID'],
             property='previous_buildid',
-            workdir='.',
+            workdir=printconfig_workdir,
+            env=printconfig_env,
             haltOnFailure=True,
         ))
         for dir in ['current', 'previous']:
             self.addStep(ShellCommand(
                 name='remove pgc files (%s)' % dir,
                 command="find . -name \*.pgc -print -delete",
                 env=updateEnv,
                 workdir="%s/%s" % (self.absMozillaObjDir, dir),
@@ -3516,46 +3531,51 @@ class NightlyRepackFactory(BaseRepackFac
             filename='application.ini',
             directory='dist/l10n-stage',
             filetype='file',
             max_depth=5,
             property_name='inipath',
             workdir=self.absMozillaObjDir,
             haltOnFailure=True,
         ))
-        if self.mozillaSrcDir:
-            useConfigDir = '%s/config' % self.baseWorkDir
+        printconfig_env = self.env.copy()
+        del printconfig_env['MOZ_OBJDIR']
+        printconfig_workdir = WithProperties('%(basedir)s/build/' + self.objdir)
+        # hax https://bugzilla.mozilla.org/show_bug.cgi?id=1232466#c10
+        if self.platform.startswith('win'):
+            python = ['c:/mozilla-build/python27/python', '-u']
         else:
-            useConfigDir = '%s/config' % self.absMozillaSrcDir
+            python = ['/tools/buildbot/bin/python']
+        # we need abs paths because we are in a non relative workdir
+        printconfig_base_command = python + [
+            WithProperties('%(basedir)s/build/mach'), 'python',
+            # abs*Dir attrs lie. they are not absolute paths
+            WithProperties('%(basedir)s/' + '%s/config/printconfigsetting.py' % self.absMozillaSrcDir),
+            WithProperties('%(basedir)s/' + self.absMozillaObjDir + '%(inipath)s')
+        ]
         self.addStep(SetProperty(
-            command=['python', '%s/printconfigsetting.py' % useConfigDir,
-                     WithProperties('%s/' % self.absMozillaObjDir + '%(inipath)s'),
-                     'App', 'BuildID'],
+            command=printconfig_base_command + ['App', 'BuildID'],
             name='get_build_id',
-            workdir='.',
-            env=self.env,
+            workdir=printconfig_workdir,
+            env=printconfig_env,
             property='buildid',
         ))
         self.addStep(SetProperty(
-            command=['python', '%s/printconfigsetting.py' % useConfigDir,
-                     WithProperties('%s/' % self.absMozillaObjDir + '%(inipath)s'),
-                     'App', 'Version'],
+            command=printconfig_base_command + ['App', 'Version'],
             property='appVersion',
             name='get_app_version',
-            workdir='.',
-            env=self.env,
+            workdir=printconfig_workdir,
+            env=printconfig_env,
         ))
         self.addStep(SetProperty(
-            command=['python', '%s/printconfigsetting.py' % useConfigDir,
-                     WithProperties('%s/' % self.absMozillaObjDir + '%(inipath)s'),
-                     'App', 'Name'],
+            command=printconfig_base_command + ['App', 'Name'],
             property='appName',
             name='get_app_name',
-            workdir='.',
-            env=self.env,
+            workdir=printconfig_workdir,
+            env=printconfig_env,
         ))
 
         if self.l10nNightlyUpdate:
             self.addFilePropertiesSteps(filename='*.complete.mar',
                                         directory='%s/dist/update' % self.absMozillaObjDir,
                                         fileType='completeMar',
                                         haltOnFailure=True)