Lines Matching refs:self

73     def __init__(self):  argument
74 self.version = None
75 self.manifest_len = None
76 self.metadata_signature_len = None
77 self.size = None
79 def ReadFromPayload(self, payload_file, hasher=None): argument
97 magic = common.Read(payload_file, len(self._MAGIC), hasher=hasher)
98 if magic != self._MAGIC:
101 self.version = _ReadInt(payload_file, self._VERSION_SIZE, True,
103 self.manifest_len = _ReadInt(payload_file, self._MANIFEST_LEN_SIZE, True,
105 self.size = (len(self._MAGIC) + self._VERSION_SIZE +
106 self._MANIFEST_LEN_SIZE)
107 self.metadata_signature_len = 0
109 if self.version == common.BRILLO_MAJOR_PAYLOAD_VERSION:
110 self.size += self._METADATA_SIGNATURE_LEN_SIZE
111 self.metadata_signature_len = _ReadInt(
112 payload_file, self._METADATA_SIGNATURE_LEN_SIZE, True,
115 def __init__(self, payload_file, payload_file_offset=0): argument
122 self.payload_file = payload_file
123 self.payload_file_offset = payload_file_offset
124 self.manifest_hasher = None
125 self.is_init = False
126 self.header = None
127 self.manifest = None
128 self.data_offset = None
129 self.metadata_signature = None
130 self.metadata_size = None
132 def _ReadHeader(self): argument
141 header = self._PayloadHeader()
142 header.ReadFromPayload(self.payload_file, self.manifest_hasher)
145 def _ReadManifest(self): argument
154 if not self.header:
157 return common.Read(self.payload_file, self.header.manifest_len,
158 hasher=self.manifest_hasher)
160 def _ReadMetadataSignature(self): argument
170 if not self.header:
174 self.payload_file, self.header.metadata_signature_len,
175 offset=self.payload_file_offset + self.header.size +
176 self.header.manifest_len)
178 def ReadDataBlob(self, offset, length): argument
191 return common.Read(self.payload_file, length,
192 offset=self.payload_file_offset + self.data_offset +
195 def Init(self): argument
204 if self.is_init:
207 self.manifest_hasher = hashlib.sha256()
210 self.payload_file.seek(self.payload_file_offset)
211 self.header = self._ReadHeader()
214 manifest_raw = self._ReadManifest()
215 self.manifest = update_metadata_pb2.DeltaArchiveManifest()
216 self.manifest.ParseFromString(manifest_raw)
219 metadata_signature_raw = self._ReadMetadataSignature()
221 self.metadata_signature = update_metadata_pb2.Signatures()
222 self.metadata_signature.ParseFromString(metadata_signature_raw)
224 self.metadata_size = self.header.size + self.header.manifest_len
225 self.data_offset = self.metadata_size + self.header.metadata_signature_len
227 self.is_init = True
229 def Describe(self): argument
248 if self.manifest.HasField('old_image_info'):
249 _DescribeImageInfo('Old Image', self.manifest.old_image_info)
251 if self.manifest.HasField('new_image_info'):
252 _DescribeImageInfo('New Image', self.manifest.new_image_info)
254 def _AssertInit(self): argument
256 if not self.is_init:
259 def ResetFile(self): argument
261 self.payload_file.seek(self.payload_file_offset + self.data_offset)
263 def IsDelta(self): argument
265 self._AssertInit()
267 for partition in self.manifest.partitions))
269 def IsFull(self): argument
271 return not self.IsDelta()
273 def Check(self, pubkey_file_name=None, metadata_sig_file=None, argument
293 self._AssertInit()
297 self, assert_type=assert_type, block_size=block_size,
305 def Apply(self, new_parts, old_parts=None, bsdiff_in_place=True, argument
323 self._AssertInit()
327 self, bsdiff_in_place=bsdiff_in_place, bspatch_path=bspatch_path,