Add logic to check for package dependencies in validate.py (#9276)
Blue committed
Dec 7, 2022 at 18:20 UTC
f6b71473720923c777190754aee16cb1f7897d71
1 file changed
+5
-1
distributions/validate.py
+5
-1
@@ -22,16 +22,20 @@ def download_and_get_manifest(url: str):
22
def validate_package_url(url: str, family_name: str, platform: str):
23
manifest = download_and_get_manifest(url)
24
identity = manifest.find('.//{http://schemas.microsoft.com/appx/manifest/foundation/windows10}Identity')
25
-
25
+ dependencies = manifest.find('.//{http://schemas.microsoft.com/appx/manifest/foundation/windows10}PackageDependency')
26
if identity is not None:
27
# Check the architecture if the package isn't bundled
28
assert platform == identity.attrib['ProcessorArchitecture']
29
else:
30
# Only check the package name for bundles
31
identity = manifest.find('.//{http://schemas.microsoft.com/appx/2013/bundle}Identity')
32
+ dependencies = manifest.find('.//{http://schemas.microsoft.com/appx/2013/bundle}PackageDependency')
33
34
assert identity.attrib['Name'] in family_name
35
36
+ # Packages uploaded to the CDN shouldn't have dependencies since they can't be installed automatically on Server SKU's.
37
+ assert dependencies is None
38
+
39
def validate_distro(distro: dict):
40
if distro['Amd64PackageUrl'] is not None:
41
validate_package_url(distro['Amd64PackageUrl'], distro['PackageFamilyName'], 'x64')