Bug 1237182: Remove set_property(..., write_to_file) support r=tomprince,Callek
authorChris AtLee <catlee@mozilla.com>
Mon, 28 May 2018 13:58:47 -0400
changeset 420918 feda34d6ae78263537465b093a63350272d420c0
parent 420917 9061381462aca330700a09cfeccef685213efe29
child 420919 3b9d55ec305565977c6d3adfe7f4eef0dd950bdf
push id34083
push userapavel@mozilla.com
push dateSat, 02 Jun 2018 23:03:25 +0000
treeherdermozilla-central@1f62ecdf59b6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstomprince, Callek
bugs1237182
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237182: Remove set_property(..., write_to_file) support r=tomprince,Callek Differential Revision: https://phabricator.services.mozilla.com/D1447
testing/mozharness/mozharness/mozilla/automation.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
testing/mozharness/mozharness/mozilla/testing/testbase.py
testing/mozharness/scripts/desktop_l10n.py
testing/mozharness/scripts/mobile_l10n.py
--- a/testing/mozharness/mozharness/mozilla/automation.py
+++ b/testing/mozharness/mozharness/mozilla/automation.py
@@ -59,22 +59,19 @@ class AutomationMixin(object):
                                                  TBPL_WORST_LEVEL_TUPLE)
             if self.worst_status != tbpl_status:
                 self.info("Current worst status %s is worse; keeping it." %
                           self.worst_status)
             self.add_summary("# TBPL %s #" % self.worst_status, level=level)
             if set_return_code:
                 self.return_code = EXIT_STATUS_DICT[self.worst_status]
 
-    def set_property(self, prop_name, prop_value, write_to_file=False):
+    def set_property(self, prop_name, prop_value):
         self.info("Setting property %s to %s" % (prop_name, prop_value))
         self.properties[prop_name] = prop_value
-        if write_to_file:
-            return self.dump_properties(prop_list=[prop_name],
-                                        file_name=prop_name)
         return self.properties[prop_name]
 
     def query_property(self, prop_name):
         return self.properties.get(prop_name)
 
     def query_is_nightly(self):
         """returns whether or not the script should run as a nightly build."""
         return bool(self.config.get('nightly_build'))
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -835,17 +835,17 @@ or run without that action (ie: --no-{ac
         # the same name.
         buildid = os.environ.get('MOZ_BUILD_DATE')
 
         if not buildid:
             self.info("Creating buildid through current time")
             buildid = generate_build_ID()
 
         if c.get('is_automation') or os.environ.get("TASK_ID"):
-            self.set_property('buildid', buildid, write_to_file=True)
+            self.set_property('buildid', buildid)
 
         self.buildid = buildid
         return self.buildid
 
     def _query_objdir(self):
         if self.objdir:
             return self.objdir
 
@@ -1099,17 +1099,17 @@ or run without that action (ie: --no-{ac
                                        build_props or 'None',
                                        err or 'No error'),
                              error_level)
                 if console_output:
                     self.info("Properties set from 'mach build'")
                     self.info(pprint.pformat(build_props))
             for key, prop in build_props.iteritems():
                 if prop != 'UNKNOWN':
-                    self.set_property(key, prop, write_to_file=True)
+                    self.set_property(key, prop)
         else:
             self.info("No mach_build_properties.json found - not importing properties.")
 
     def generate_build_props(self, console_output=True, halt_on_failure=False):
         """sets props found from mach build and, in addition, buildid,
         sourcestamp,  appVersion, and appName."""
 
         error_level = ERROR
@@ -1150,19 +1150,17 @@ or run without that action (ie: --no-{ac
         # dirs['abs_obj_dir'] can be different from env['MOZ_OBJDIR'] on
         # mac, and that confuses mach.
         del env['MOZ_OBJDIR']
         for prop in properties_needed:
             prop_val = self.get_output_from_command(
                 base_cmd + [prop['ini_name']], cwd=dirs['abs_obj_dir'],
                 halt_on_failure=halt_on_failure, env=env
             )
-            self.set_property(prop['prop_name'],
-                                       prop_val,
-                                       write_to_file=True)
+            self.set_property(prop['prop_name'], prop_val)
 
         if self.config.get('is_automation'):
             self.info("Verifying buildid from application.ini matches buildid "
                       "from automation")
             app_ini_buildid = self._query_build_prop_from_app_ini('BuildID')
             # it would be hard to imagine query_buildid evaluating to a falsey
             #  value (e.g. 0), but incase it does, force it to None
             automation_buildid = self.query_buildid() or None
@@ -1316,17 +1314,17 @@ or run without that action (ie: --no-{ac
                                         package_filename=package_filename,
                                         )
         upload_cmd = ['make', 'upload', 'AB_CD=multi']
         self.run_command(upload_cmd,
                          env=self.query_mach_build_env(multiLocale=False),
                          cwd=objdir, halt_on_failure=True,
                          output_parser=parser)
         for prop in parser.matches:
-            self.set_property(prop, parser.matches[prop], write_to_file=True)
+            self.set_property(prop, parser.matches[prop])
         upload_files_cmd = [
             'make',
             'echo-variable-UPLOAD_FILES',
             'AB_CD=multi',
         ]
         output = self.get_output_from_command(
             upload_files_cmd,
             cwd=objdir,
--- a/testing/mozharness/mozharness/mozilla/testing/testbase.py
+++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py
@@ -400,17 +400,17 @@ You can set this by specifying --test-ur
         if self.installer_path:
             file_name = self.installer_path
         dirs = self.query_abs_dirs()
         source = self.download_file(self.installer_url,
                                             file_name=file_name,
                                             parent_dir=dirs['abs_work_dir'],
                                             error_level=FATAL)
         self.installer_path = os.path.realpath(source)
-        self.set_property("build_url", self.installer_url, write_to_file=True)
+        self.set_property("build_url", self.installer_url)
 
     def _download_and_extract_symbols(self):
         dirs = self.query_abs_dirs()
         if self.config.get('download_symbols') == 'ondemand':
             self.symbols_url = self.query_symbols_url()
             self.symbols_path = self.symbols_url
             return
 
@@ -423,18 +423,17 @@ You can set this by specifying --test-ur
                 kwargs={'raise_on_failure': True},
                 sleeptime=20,
                 error_level=FATAL,
                 error_message="We can't proceed without downloading symbols.",
             )
             if not self.symbols_path:
                 self.symbols_path = os.path.join(dirs['abs_work_dir'], 'symbols')
 
-            self.set_property("symbols_url", self.symbols_url,
-                              write_to_file=True)
+            self.set_property("symbols_url", self.symbols_url)
             if self.symbols_url:
                 self.download_unpack(self.symbols_url, self.symbols_path)
 
     def download_and_extract(self, extract_dirs=None, suite_categories=None):
         """
         download and extract test zip / download installer
         """
         # Swap plain http for https when we're downloading from ftp
--- a/testing/mozharness/scripts/desktop_l10n.py
+++ b/testing/mozharness/scripts/desktop_l10n.py
@@ -469,33 +469,31 @@ class DesktopSingleLocale(LocalesMixin, 
         """marks current step as failed"""
         self.locales_property[locale] = FAILURE_STR
         prop_key = "%s_failure" % locale
         prop_value = self.query_property(prop_key)
         if prop_value:
             prop_value = "%s  %s" % (prop_value, message)
         else:
             prop_value = message
-        self.set_property(prop_key, prop_value, write_to_file=True)
+        self.set_property(prop_key, prop_value)
         BaseScript.add_failure(self, locale, message=message, **kwargs)
 
     def query_failed_locales(self):
         return [l for l, res in self.locales_property.items() if
                 res == FAILURE_STR]
 
     def summary(self):
         """generates a summary"""
         BaseScript.summary(self)
         # TODO we probably want to make this configurable on/off
         locales = self.query_locales()
         for locale in locales:
             self.locales_property.setdefault(locale, SUCCESS_STR)
-        self.set_property("locales",
-                          json.dumps(self.locales_property),
-                          write_to_file=True)
+        self.set_property("locales", json.dumps(self.locales_property))
 
     # Actions {{{2
     def pull(self):
         """pulls source code"""
         config = self.config
         dirs = self.query_abs_dirs()
         repos = []
         # replace dictionary for repos
--- a/testing/mozharness/scripts/mobile_l10n.py
+++ b/testing/mozharness/scripts/mobile_l10n.py
@@ -338,27 +338,26 @@ class MobileSingleLocale(LocalesMixin, R
     def add_failure(self, locale, message, **kwargs):
         self.locales_property[locale] = "Failed"
         prop_key = "%s_failure" % locale
         prop_value = self.query_property(prop_key)
         if prop_value:
             prop_value = "%s  %s" % (prop_value, message)
         else:
             prop_value = message
-        self.set_property(prop_key, prop_value, write_to_file=True)
+        self.set_property(prop_key, prop_value)
         MercurialScript.add_failure(self, locale, message=message, **kwargs)
 
     def summary(self):
         MercurialScript.summary(self)
         # TODO we probably want to make this configurable on/off
         locales = self.query_locales()
         for locale in locales:
             self.locales_property.setdefault(locale, "Success")
-        self.set_property("locales", json.dumps(self.locales_property),
-                          write_to_file=True)
+        self.set_property("locales", json.dumps(self.locales_property))
 
     # Actions {{{2
     def pull(self):
         c = self.config
         dirs = self.query_abs_dirs()
         repos = []
         replace_dict = {}
         if c.get("user_repo_override"):
@@ -552,17 +551,17 @@ class MobileSingleLocale(LocalesMixin, R
         self.info("Checking out tools")
         repos = [{
             'repo': self.config['tools_repo'],
             'vcs': "hg",
             'branch': "default",
             'dest': dirs['abs_tools_dir'],
         }]
         rev = self.vcs_checkout(**repos[0])
-        self.set_property("tools_revision", rev, write_to_file=True)
+        self.set_property("tools_revision", rev)
 
     def query_apkfile_path(self, locale):
 
         dirs = self.query_abs_dirs()
         apkdir = os.path.join(dirs['abs_objdir'], 'dist')
         r = r"(\.)" + re.escape(locale) + r"(\.*)"
 
         apks = []