Bug 1136750 - Partial mar is generated but not uploaded - wrong filename. r=jlund
authorMassimo Gervasini <mgervasini@mozilla.com>
Wed, 11 Mar 2015 09:52:46 +0100 (2015-03-11)
changeset 3740 40a974d1324fc40d57b1d49d506afe01bb4a509f
parent 3738 1638197c5171055746ae7e63730cfca6a9449c30
child 3741 6b7d8d086e8a54c9be63de8e5922c6bfbf8e3a92
push id2943
push usermgervasini@mozilla.com
push dateWed, 11 Mar 2015 08:58:27 +0000 (2015-03-11)
reviewersjlund
bugs1136750
Bug 1136750 - Partial mar is generated but not uploaded - wrong filename. r=jlund
scripts/desktop_l10n.py
--- a/scripts/desktop_l10n.py
+++ b/scripts/desktop_l10n.py
@@ -719,17 +719,16 @@ class DesktopSingleLocale(LocalesMixin, 
             self.package_urls[locale] = {}
         self.package_urls[locale].update(parser.matches)
         if retval == SUCCESS:
             self.info('Upload successful (%s)' % (locale))
             ret = SUCCESS
         else:
             self.error('failed to upload %s' % (locale))
             ret = FAILURE
-            self.fatal('failed to upload -- REMOVEME')
         return ret
 
     def make_installers(self, locale):
         """wrapper for make installers-(locale)"""
         env = self.query_l10n_env()
         self._copy_mozconfig()
         env['L10NBASEDIR'] = self.l10n_dir
         dirs = self.query_abs_dirs()
@@ -824,17 +823,17 @@ class DesktopSingleLocale(LocalesMixin, 
                 generate = False
             else:
                 self.info('complete mar, does not exist: %s' % (complete_filename))
         elif mar_type == 'partial':
             if not self.has_partials():
                 self.info('partials are disabled: enable_partials == False')
                 generate = False
             else:
-                partial_filename = self._previous_mar_filename(locale)
+                partial_filename = self._query_partial_mar_filename(locale)
                 if os.path.exists(partial_filename):
                     self.info('partial mar, already exists: %s' % (partial_filename))
                     generate = False
                 else:
                     self.info('partial mar, does not exist: %s' % (partial_filename))
         else:
             self.fatal('unknown mar_type: %s' % mar_type)
         return generate
@@ -860,38 +859,31 @@ class DesktopSingleLocale(LocalesMixin, 
 
     def generate_partial_updates(self, locale):
         """create partial updates for locale"""
         # clean up any left overs from previous locales
         # remove current/ current.work/ previous/ directories
         self.info('creating partial update for locale: %s' % (locale))
         # and recreate current/ previous/
         self._create_mar_dirs()
-        # download mar and mbsdiff executables
+        # download mar and mbsdiff executables, we need them later...
         self.download_mar_tools()
-        # get the previous mar file
-        previous_marfile = self._get_previous_mar(locale)
-        # and unpack it
-        previous_mar_dir = self._previous_mar_dir()
-        result = self._unpack_mar(previous_marfile, previous_mar_dir)
-        if result != 0:
-            self.error('failed to unpack %s to %s' % (previous_marfile,
-                                                      previous_mar_dir))
-            return result
 
+        # unpack current mar file
         current_marfile = self._current_mar_filename(locale)
         current_mar_dir = self._current_mar_dir()
         result = self._unpack_mar(current_marfile, current_mar_dir)
-        if result != 0:
+        if result != SUCCESS:
             self.error('failed to unpack %s to %s' % (current_marfile,
                                                       current_mar_dir))
             return result
         # current mar file unpacked, remove it
         self.rmtree(current_marfile)
         # partial filename
+        previous_mar_dir = self._previous_mar_dir()
         previous_mar_buildid = self.get_buildid_from_mar_dir(previous_mar_dir)
         partial_filename = self._query_partial_mar_filename(locale)
         if locale not in self.package_urls:
             self.package_urls[locale] = {}
         self.package_urls[locale]['partial_filename'] = partial_filename
         self.package_urls[locale]['previous_buildid'] = previous_mar_buildid
         self._delete_pgc_files()
         result = self.do_incremental_update(previous_mar_dir, current_mar_dir,
@@ -913,17 +905,29 @@ class DesktopSingleLocale(LocalesMixin, 
 
             # append partialInfo
             self.partials[locale].append(partialInfo)
         return result
 
     def _partial_filename(self, locale):
         config = self.config
         version = self.query_version()
+        # download the previous partial, if needed
+        self._create_mar_dirs()
+        # download mar and mbsdiff executables
+        self.download_mar_tools()
+        # get the previous mar file
+        previous_marfile = self._get_previous_mar(locale)
+        # and unpack it
         previous_mar_dir = self._previous_mar_dir()
+        result = self._unpack_mar(previous_marfile, previous_mar_dir)
+        if result != SUCCESS:
+            self.error('failed to unpack %s to %s' % (previous_marfile,
+                                                      previous_mar_dir))
+            return result
         previous_mar_buildid = self.get_buildid_from_mar_dir(previous_mar_dir)
         current_mar_buildid = self._query_buildid()
         return config['partial_mar'] % {'version': version,
                                         'locale': locale,
                                         'from_buildid': current_mar_buildid,
                                         'to_buildid': previous_mar_buildid}
 
     def _query_objdir(self):