azuresphere_imagemetadata 0.2.2__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {azuresphere_imagemetadata-0.2.2/src/azuresphere_imagemetadata.egg-info → azuresphere_imagemetadata-0.3.0}/PKG-INFO +2 -2
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/pyproject.toml +2 -2
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/image_manifest.py +102 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/abi.py +6 -1
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0/src/azuresphere_imagemetadata.egg-info}/PKG-INFO +2 -2
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata.egg-info/SOURCES.txt +1 -0
- azuresphere_imagemetadata-0.3.0/src/azuresphere_imagemetadata.egg-info/requires.txt +1 -0
- azuresphere_imagemetadata-0.3.0/tests/test_manifest.py +95 -0
- azuresphere_imagemetadata-0.2.2/src/azuresphere_imagemetadata.egg-info/requires.txt +0 -1
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/MANIFEST.in +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/setup.cfg +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/LICENSE +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/README.md +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/__init__.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/certificates/app_test_sign.pfx +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/certificates/tp_app_test_sign.cer +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/exceptions.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/guid_utils.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/image.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/image_metadata.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_headers/__init__.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_headers/image_metadata.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_headers/image_metadata_section.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/__init__.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/compression.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/debug.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/identity.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/image_policy.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/internal/__init__.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/internal/capabilities.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/internal/onebl.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/metadata.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/metadata_id.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/not_implemented.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/required_offset.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/revocation.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/signature.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/temporary_image.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/metadata_sections/utils.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/signing/__init__.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/signing/app_development.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/signing/der_encoded.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/signing/signer.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata/signing/signing_info.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata.egg-info/dependency_links.txt +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/src/azuresphere_imagemetadata.egg-info/top_level.txt +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_certificate_files_match.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_compression.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_dotnet_app.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_exceptions.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_guid.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_knownset_recovery_files.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_latest_recovery_files.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_package_version.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_parse_application.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_parse_capability.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_serialization.py +0 -0
- {azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_signing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: azuresphere_imagemetadata
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A library for parsing and composing image metadata for azure sphere devices
|
|
5
5
|
Author-email: Microsoft <azspheremfrsamplesup@microsoft.com>
|
|
6
6
|
License: Copyright (c) Microsoft Corporation.
|
|
@@ -30,7 +30,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
31
31
|
Requires-Python: >=3.8
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
|
-
Requires-Dist: cryptography
|
|
33
|
+
Requires-Dist: cryptography>=49.0.0
|
|
34
34
|
|
|
35
35
|
# Microsoft Azure Sphere Image Metadata for Python
|
|
36
36
|
|
|
@@ -9,7 +9,7 @@ addopts = ["-ra -vv", "--import-mode=importlib"]
|
|
|
9
9
|
|
|
10
10
|
[project]
|
|
11
11
|
name = "azuresphere_imagemetadata"
|
|
12
|
-
version = "0.
|
|
12
|
+
version = "0.3.0"
|
|
13
13
|
authors = [{ name = "Microsoft", email = "azspheremfrsamplesup@microsoft.com" }]
|
|
14
14
|
keywords = ["azure", "sphere", "device", "image", "metadata"]
|
|
15
15
|
readme = { file = "src/azuresphere_imagemetadata/README.md", content-type = "text/markdown" }
|
|
@@ -20,7 +20,7 @@ classifiers = [
|
|
|
20
20
|
"Programming Language :: Python :: 3",
|
|
21
21
|
"Operating System :: OS Independent",
|
|
22
22
|
]
|
|
23
|
-
dependencies = ["cryptography >=
|
|
23
|
+
dependencies = ["cryptography >= 49.0.0"]
|
|
24
24
|
requires-python = ">=3.8"
|
|
25
25
|
|
|
26
26
|
[tool.ruff]
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# --------------------------------------------------------------------------------------------
|
|
5
5
|
|
|
6
6
|
import struct
|
|
7
|
+
import time
|
|
7
8
|
from datetime import datetime, timezone
|
|
8
9
|
|
|
9
10
|
from .guid_utils import format_guid_as_string, to_guid
|
|
@@ -99,6 +100,17 @@ class ManifestHeader:
|
|
|
99
100
|
"""
|
|
100
101
|
return 16
|
|
101
102
|
|
|
103
|
+
def __eq__(self, value):
|
|
104
|
+
if not isinstance(value, ManifestHeader):
|
|
105
|
+
return False
|
|
106
|
+
return (
|
|
107
|
+
self.version == value.version
|
|
108
|
+
and self.image_count == value.image_count
|
|
109
|
+
and self.manifest_header_size == value.manifest_header_size
|
|
110
|
+
and self.manifest_entry_size == value.manifest_entry_size
|
|
111
|
+
and self.build_date == value.build_date
|
|
112
|
+
)
|
|
113
|
+
|
|
102
114
|
def deserialize(self, data):
|
|
103
115
|
"""
|
|
104
116
|
Deserializes the ManifestHeader from the provided data.
|
|
@@ -113,6 +125,17 @@ class ManifestHeader:
|
|
|
113
125
|
self.manifest_entry_size = struct.unpack("<H", data[6:8])[0]
|
|
114
126
|
self.build_date = struct.unpack("<Q", data[8:16])[0]
|
|
115
127
|
|
|
128
|
+
def serialize(self) -> bytearray:
|
|
129
|
+
"""Serializes the ManifestHeader into bytes."""
|
|
130
|
+
return struct.pack(
|
|
131
|
+
"<HHHHQ",
|
|
132
|
+
self.version,
|
|
133
|
+
self.image_count,
|
|
134
|
+
self.manifest_header_size,
|
|
135
|
+
self.manifest_entry_size,
|
|
136
|
+
self.build_date,
|
|
137
|
+
)
|
|
138
|
+
|
|
116
139
|
def __str__(self):
|
|
117
140
|
LOCAL_TIMEZONE = datetime.now(timezone.utc).astimezone().tzinfo
|
|
118
141
|
local = datetime.fromtimestamp(self.build_date, LOCAL_TIMEZONE)
|
|
@@ -123,6 +146,7 @@ class ManifestEntry:
|
|
|
123
146
|
"""Manifest entry"""
|
|
124
147
|
|
|
125
148
|
UID_SIZE = 16
|
|
149
|
+
"""Number of bytes in a UID field"""
|
|
126
150
|
|
|
127
151
|
def __init__(self, data):
|
|
128
152
|
self.image_uid_raw = None
|
|
@@ -150,6 +174,20 @@ class ManifestEntry:
|
|
|
150
174
|
"""
|
|
151
175
|
return format_guid_as_string(to_guid(self.component_uid_raw))
|
|
152
176
|
|
|
177
|
+
@staticmethod
|
|
178
|
+
def size():
|
|
179
|
+
"""
|
|
180
|
+
Returns the size of the ManifestEntry in bytes.
|
|
181
|
+
"""
|
|
182
|
+
return (
|
|
183
|
+
ManifestEntry.UID_SIZE * 2
|
|
184
|
+
+ 2
|
|
185
|
+
+ 2
|
|
186
|
+
+ 4
|
|
187
|
+
+ 4
|
|
188
|
+
+ ManifestHeader.MAX_COUNT_ABI_IDENTITIES * ABIIdentity.size() * 2
|
|
189
|
+
) # = 76
|
|
190
|
+
|
|
153
191
|
def deserialize(self, data):
|
|
154
192
|
"""
|
|
155
193
|
Deserializes the ManifestEntry from the provided data.
|
|
@@ -176,6 +214,38 @@ class ManifestEntry:
|
|
|
176
214
|
self.depends += [ABIIdentity(data[offset : offset + ABIIdentity.size()])]
|
|
177
215
|
offset += ABIIdentity.size()
|
|
178
216
|
|
|
217
|
+
def serialize(self) -> bytearray:
|
|
218
|
+
"""
|
|
219
|
+
Serializes the ManifestEntry into bytes.
|
|
220
|
+
"""
|
|
221
|
+
_MAX = ManifestHeader.MAX_COUNT_ABI_IDENTITIES
|
|
222
|
+
_ZERO = b"\x00" * ABIIdentity.size() # zero ABIIdentity used as padding
|
|
223
|
+
|
|
224
|
+
out = bytearray(self.image_uid_raw)
|
|
225
|
+
out += self.component_uid_raw
|
|
226
|
+
out += struct.pack(
|
|
227
|
+
"<HHII",
|
|
228
|
+
self.image_type,
|
|
229
|
+
self.partition_type,
|
|
230
|
+
self.image_file_size,
|
|
231
|
+
self.uncompressed_image_size,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
if len(self.provides) > _MAX:
|
|
235
|
+
raise ValueError(
|
|
236
|
+
f"Too many provides entries: {len(self.provides)}. Maximum is {_MAX}."
|
|
237
|
+
)
|
|
238
|
+
if len(self.depends) > _MAX:
|
|
239
|
+
raise ValueError(
|
|
240
|
+
f"Too many depends entries: {len(self.depends)}. Maximum is {_MAX}."
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
for i in range(0, _MAX):
|
|
244
|
+
out += self.provides[i].serialize() if i < len(self.provides) else _ZERO
|
|
245
|
+
for i in range(0, _MAX):
|
|
246
|
+
out += self.depends[i].serialize() if i < len(self.depends) else _ZERO
|
|
247
|
+
return out
|
|
248
|
+
|
|
179
249
|
def __str__(self):
|
|
180
250
|
provides_string = ", ".join([str(p) for p in self.provides])
|
|
181
251
|
depends_string = ", ".join([str(d) for d in self.depends])
|
|
@@ -197,6 +267,13 @@ class ImageManifest:
|
|
|
197
267
|
if data is not None:
|
|
198
268
|
self.deserialize(data)
|
|
199
269
|
|
|
270
|
+
@staticmethod
|
|
271
|
+
def empty() -> "ImageManifest":
|
|
272
|
+
"""
|
|
273
|
+
Create an empty manifest. It contains no data and no entries.
|
|
274
|
+
"""
|
|
275
|
+
return ImageManifest(data=None)
|
|
276
|
+
|
|
200
277
|
def deserialize(self, data):
|
|
201
278
|
"""
|
|
202
279
|
Deserializes the ImageManifest from the provided data.
|
|
@@ -211,6 +288,31 @@ class ImageManifest:
|
|
|
211
288
|
self.entries.append(entry)
|
|
212
289
|
offset += self.header.manifest_entry_size
|
|
213
290
|
|
|
291
|
+
def serialize(self) -> bytearray:
|
|
292
|
+
"""
|
|
293
|
+
Serializes the ImageManifest into bytes.
|
|
294
|
+
"""
|
|
295
|
+
# Build and serialize the header
|
|
296
|
+
self.header = self.build_header()
|
|
297
|
+
data = self.header.serialize()
|
|
298
|
+
|
|
299
|
+
for entry in self.entries:
|
|
300
|
+
data += entry.serialize()
|
|
301
|
+
return data
|
|
302
|
+
|
|
303
|
+
def build_header(self) -> ManifestHeader:
|
|
304
|
+
"""
|
|
305
|
+
Builds a manifest header based on the current entries for serialization.
|
|
306
|
+
"""
|
|
307
|
+
hdr = ManifestHeader(data=None)
|
|
308
|
+
hdr.image_count = len(self.entries)
|
|
309
|
+
hdr.build_date = (
|
|
310
|
+
self.header.build_date if self.header is not None else int(time.time())
|
|
311
|
+
)
|
|
312
|
+
hdr.manifest_header_size = ManifestHeader.size()
|
|
313
|
+
hdr.manifest_entry_size = ManifestEntry.size()
|
|
314
|
+
return hdr
|
|
315
|
+
|
|
214
316
|
def __str__(self):
|
|
215
317
|
out_lines = []
|
|
216
318
|
out_lines.append(str(self.header))
|
|
@@ -35,7 +35,12 @@ class ABIIdentity:
|
|
|
35
35
|
# uint32_t type
|
|
36
36
|
|
|
37
37
|
def __init__(self, data):
|
|
38
|
-
|
|
38
|
+
if data is not None:
|
|
39
|
+
self.deserialize(data)
|
|
40
|
+
else:
|
|
41
|
+
# Initialize to a valid "empty" identity so serialize()/__str__() work.
|
|
42
|
+
self.version = 0
|
|
43
|
+
self.type = ABIDependsType.NoDependency
|
|
39
44
|
|
|
40
45
|
@staticmethod
|
|
41
46
|
def size():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: azuresphere_imagemetadata
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: A library for parsing and composing image metadata for azure sphere devices
|
|
5
5
|
Author-email: Microsoft <azspheremfrsamplesup@microsoft.com>
|
|
6
6
|
License: Copyright (c) Microsoft Corporation.
|
|
@@ -30,7 +30,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
30
30
|
Classifier: Operating System :: OS Independent
|
|
31
31
|
Requires-Python: >=3.8
|
|
32
32
|
Description-Content-Type: text/markdown
|
|
33
|
-
Requires-Dist: cryptography
|
|
33
|
+
Requires-Dist: cryptography>=49.0.0
|
|
34
34
|
|
|
35
35
|
# Microsoft Azure Sphere Image Metadata for Python
|
|
36
36
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cryptography>=49.0.0
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# --------------------------------------------------------------------------------------------
|
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
# Licensed under the MIT License. See LICENSE in the project root for license information.
|
|
4
|
+
# --------------------------------------------------------------------------------------------
|
|
5
|
+
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
import uuid
|
|
9
|
+
from azuresphere_imagemetadata.image import CompressedImage, Image
|
|
10
|
+
from azuresphere_imagemetadata.image_manifest import ABIIdentity, ImageManifest, ManifestEntry, ManifestHeader
|
|
11
|
+
from azuresphere_imagemetadata.metadata_sections.identity import ImageType
|
|
12
|
+
|
|
13
|
+
MANIFEST_PATH = os.path.join(
|
|
14
|
+
".", "tests", "test_files", "manifest", "bsu-mt3620"
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
SoftwareImage = Image | CompressedImage
|
|
18
|
+
"""A SoftwareImage is either a CompressedImage or an Image"""
|
|
19
|
+
|
|
20
|
+
def _get_image_from_file(path: str) -> SoftwareImage:
|
|
21
|
+
"""Helper function to get an Image or CompressedImage from a file path."""
|
|
22
|
+
raw = Path(path).read_bytes()
|
|
23
|
+
image = Image(raw)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def test_manifest_header_serialization(test_logger):
|
|
29
|
+
"""Synthetic test of the serialization of ManifestHeader."""
|
|
30
|
+
|
|
31
|
+
# Build a ManifestHeader
|
|
32
|
+
# TODO: Maybe the const should be set automatically in the constructor?
|
|
33
|
+
synthetic_header = ManifestHeader(data=None)
|
|
34
|
+
synthetic_header.image_count = 5
|
|
35
|
+
synthetic_header.build_date = 1234567890
|
|
36
|
+
synthetic_header.manifest_header_size = ManifestHeader.size()
|
|
37
|
+
synthetic_header.manifest_entry_size = ManifestEntry.size()
|
|
38
|
+
|
|
39
|
+
ser = synthetic_header.serialize()
|
|
40
|
+
assert len(ser) == ManifestHeader.size()
|
|
41
|
+
des = ManifestHeader(ser)
|
|
42
|
+
assert des == synthetic_header
|
|
43
|
+
|
|
44
|
+
def test_manifest_entry_serialization(test_logger):
|
|
45
|
+
"""Synthetic test of the serialization of ManifestEntry."""
|
|
46
|
+
|
|
47
|
+
# Build a ManifestEntry
|
|
48
|
+
synthetic_entry = ManifestEntry(data=None)
|
|
49
|
+
synthetic_entry.image_uid_raw = uuid.uuid4().bytes_le
|
|
50
|
+
synthetic_entry.component_uid_raw = uuid.uuid4().bytes_le
|
|
51
|
+
synthetic_entry.image_type = ImageType.Policy
|
|
52
|
+
synthetic_entry.uncompressed_image_size = 12345432
|
|
53
|
+
abi_identity = ABIIdentity(data=None)
|
|
54
|
+
abi_identity.version = 17
|
|
55
|
+
abi_identity.type = 1
|
|
56
|
+
synthetic_entry.provides = [abi_identity]
|
|
57
|
+
|
|
58
|
+
ser = synthetic_entry.serialize()
|
|
59
|
+
assert len(ser) == ManifestEntry.size()
|
|
60
|
+
des = ManifestEntry(ser)
|
|
61
|
+
|
|
62
|
+
assert des.image_uid == synthetic_entry.image_uid
|
|
63
|
+
assert des.component_uid == synthetic_entry.component_uid
|
|
64
|
+
assert des.image_type == synthetic_entry.image_type
|
|
65
|
+
assert des.uncompressed_image_size == synthetic_entry.uncompressed_image_size
|
|
66
|
+
test_logger.info(f"Finishing test_manifest_entry_serialization")
|
|
67
|
+
|
|
68
|
+
def test_manifest_serialization(test_logger):
|
|
69
|
+
"""Verify a real manifest blob round-trips through serialization.
|
|
70
|
+
|
|
71
|
+
This checks the parsed manifest matches the original bytes and structure.
|
|
72
|
+
"""
|
|
73
|
+
logger = test_logger()
|
|
74
|
+
logger.info("Beginning test_manifest_serialization")
|
|
75
|
+
|
|
76
|
+
with open(MANIFEST_PATH, "rb") as f:
|
|
77
|
+
raw = f.read()
|
|
78
|
+
image = Image(raw)
|
|
79
|
+
data = image.metadata.image_data
|
|
80
|
+
manifest = ImageManifest(data)
|
|
81
|
+
|
|
82
|
+
ser = manifest.serialize()
|
|
83
|
+
assert len(ser) == len(data)
|
|
84
|
+
des = ImageManifest(ser)
|
|
85
|
+
|
|
86
|
+
assert ser == data
|
|
87
|
+
assert des.header == manifest.header
|
|
88
|
+
assert len(des.entries) == len(manifest.entries)
|
|
89
|
+
|
|
90
|
+
def test_manifest_dotnet_output(test_runner):
|
|
91
|
+
"""Compare Python manifest output against the dotnet tool's output.
|
|
92
|
+
|
|
93
|
+
This validates the Python implementation stays aligned with dotnet.
|
|
94
|
+
"""
|
|
95
|
+
test_runner.py_dotnet_diff_manifest(MANIFEST_PATH)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
cryptography<49,>=41.0.2
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_compression.py
RENAMED
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_dotnet_app.py
RENAMED
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_package_version.py
RENAMED
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_parse_application.py
RENAMED
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_parse_capability.py
RENAMED
|
File without changes
|
{azuresphere_imagemetadata-0.2.2 → azuresphere_imagemetadata-0.3.0}/tests/test_serialization.py
RENAMED
|
File without changes
|
|
File without changes
|