Bug 1230060 - Don't fail to read an install manifest containing non-actionable items. r=gps
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 03 Dec 2015 16:54:09 +0900
changeset 309911 f6f6ce771a59a7ab787e706073621a2b2459fb4d
parent 309910 2f7417fcd286bedc1ed3daf7a5c680120e72ffef
child 309912 fa84e8d2340b304f6584438e5b2145f304ccbfed
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1230060
milestone45.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 1230060 - Don't fail to read an install manifest containing non-actionable items. r=gps Future improvements to process_install_manifest's --track option will require adding data in the tracking dump that uses an install manifest form, and I don't want e.g. switching branches or bisection to require to clobber in order to do the right thing, so this change future-proofs the install manifest reader.
python/mozbuild/mozpack/manifests.py
--- a/python/mozbuild/mozpack/manifests.py
+++ b/python/mozbuild/mozpack/manifests.py
@@ -80,16 +80,18 @@ class InstallManifest(object):
     Version 3 added support for pattern entries.
     Version 4 added preprocessed file support.
     """
 
     CURRENT_VERSION = 4
 
     FIELD_SEPARATOR = '\x1f'
 
+    # Negative values are reserved for non-actionable items, that is, metadata
+    # that doesn't describe files in the destination.
     SYMLINK = 1
     COPY = 2
     REQUIRED_EXISTS = 3
     OPTIONAL_EXISTS = 4
     PATTERN_SYMLINK = 5
     PATTERN_COPY = 6
     PREPROCESS = 7
 
@@ -158,18 +160,21 @@ class InstallManifest(object):
             if record_type == self.PREPROCESS:
                 dest, source, deps, marker, defines, warnings = fields[1:]
 
                 self.add_preprocess(source, dest, deps, marker,
                     self._decode_field_entry(defines),
                     silence_missing_directive_warnings=bool(int(warnings)))
                 continue
 
-            raise UnreadableInstallManifest('Unknown record type: %d' %
-                record_type)
+            # Don't fail for non-actionable items, allowing
+            # forward-compatibility with those we will add in the future.
+            if record_type >= 0:
+                raise UnreadableInstallManifest('Unknown record type: %d' %
+                    record_type)
 
     def __len__(self):
         return len(self._dests)
 
     def __contains__(self, item):
         return item in self._dests
 
     def __eq__(self, other):