Auto merge of #26207 - servo:jdm-patch-36, r=Manishearth

Publish new UWP package

This fixes an issue where the latest UWP package is published at http://download.servo.org/nightly/uwp/servo-latest.0.0.0_Test.zip because the full filename contains "1.0.0.0" and we don't detect file extensions correctly.
This commit is contained in:
bors-servo 2020-04-17 19:30:04 -04:00 committed by GitHub
commit 66f14773c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 30 deletions

View file

@ -301,15 +301,14 @@ def with_rust_nightly():
) )
def appx_artifact(debug): appx_artifact = '/'.join([
return '/'.join([ 'repo',
'repo', 'support',
'support', 'hololens',
'hololens', 'AppPackages',
'AppPackages', 'ServoApp',
'ServoApp', 'FirefoxReality.zip',
'ServoApp_1.0.0.0_%sTest.zip' % ('Debug_' if debug else ''), ])
])
def windows_arm64(rdp=False): def windows_arm64(rdp=False):
@ -322,7 +321,7 @@ def windows_arm64(rdp=False):
"python mach build --dev --target=aarch64-uwp-windows-msvc", "python mach build --dev --target=aarch64-uwp-windows-msvc",
"python mach package --dev --target aarch64-uwp-windows-msvc --uwp=arm64", "python mach package --dev --target aarch64-uwp-windows-msvc --uwp=arm64",
) )
.with_artifacts(appx_artifact(debug=True)) .with_artifacts(appx_artifact)
.find_or_create("build.windows_uwp_arm64_dev." + CONFIG.tree_hash()) .find_or_create("build.windows_uwp_arm64_dev." + CONFIG.tree_hash())
) )
@ -338,7 +337,7 @@ def windows_uwp_x64(rdp=False):
"python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64", "python mach package --dev --target=x86_64-uwp-windows-msvc --uwp=x64",
"python mach test-tidy --force-cpp --no-wpt", "python mach test-tidy --force-cpp --no-wpt",
) )
.with_artifacts(appx_artifact(debug=True)) .with_artifacts(appx_artifact)
.find_or_create("build.windows_uwp_x64_dev." + CONFIG.tree_hash()) .find_or_create("build.windows_uwp_x64_dev." + CONFIG.tree_hash())
) )
@ -358,7 +357,7 @@ def uwp_nightly(rdp=False):
"mach package --release --target=x86_64-uwp-windows-msvc --uwp=x64 --uwp=arm64", "mach package --release --target=x86_64-uwp-windows-msvc --uwp=x64 --uwp=arm64",
"mach upload-nightly uwp --secret-from-taskcluster", "mach upload-nightly uwp --secret-from-taskcluster",
) )
.with_artifacts(appx_artifact(debug=False)) .with_artifacts(appx_artifact)
.with_max_run_time_minutes(3 * 60) .with_max_run_time_minutes(3 * 60)
.find_or_create("build.windows_uwp_nightlies." + CONFIG.tree_hash()) .find_or_create("build.windows_uwp_nightlies." + CONFIG.tree_hash())
) )

View file

@ -70,7 +70,7 @@ PACKAGES = {
r'target\release\msi\Servo.zip', r'target\release\msi\Servo.zip',
], ],
'uwp': [ 'uwp': [
r'support\hololens\AppPackages\ServoApp\ServoApp_1.0.0.0_Test.zip', r'support\hololens\AppPackages\ServoApp\FirefoxReality.zip',
], ],
} }
@ -627,8 +627,8 @@ class PackageCommands(CommandBase):
nightly_dir = 'nightly/{}'.format(platform) nightly_dir = 'nightly/{}'.format(platform)
filename = nightly_filename(package, timestamp) filename = nightly_filename(package, timestamp)
package_upload_key = '{}/{}'.format(nightly_dir, filename) package_upload_key = '{}/{}'.format(nightly_dir, filename)
extension = path.basename(package).partition('.')[2] extension = path.splitext(path.basename(package))[1]
latest_upload_key = '{}/servo-latest.{}'.format(nightly_dir, extension) latest_upload_key = '{}/servo-latest{}'.format(nightly_dir, extension)
s3.upload_file(package, BUCKET, package_upload_key) s3.upload_file(package, BUCKET, package_upload_key)
copy_source = { copy_source = {
@ -743,7 +743,7 @@ class PackageCommands(CommandBase):
return 0 return 0
def setup_uwp_signing(ms_app_store): def setup_uwp_signing(ms_app_store, publisher):
# App package needs to be signed. If we find a certificate that has been installed # App package needs to be signed. If we find a certificate that has been installed
# already, we use it. Otherwise we create and install a temporary certificate. # already, we use it. Otherwise we create and install a temporary certificate.
@ -766,11 +766,6 @@ def setup_uwp_signing(ms_app_store):
run_powershell_cmd('Import-PfxCertificate -FilePath .\servo.pfx -CertStoreLocation Cert:\CurrentUser\My') run_powershell_cmd('Import-PfxCertificate -FilePath .\servo.pfx -CertStoreLocation Cert:\CurrentUser\My')
os.remove("servo.pfx") os.remove("servo.pfx")
# Parse appxmanifest to find the publisher name
manifest_file = path.join(os.getcwd(), 'support', 'hololens', 'ServoApp', 'Package.appxmanifest')
manifest = xml.etree.ElementTree.parse(manifest_file)
namespace = "{http://schemas.microsoft.com/appx/manifest/foundation/windows10}"
publisher = manifest.getroot().find(namespace + "Identity").attrib["Publisher"]
# Powershell command that lists all certificates for publisher # Powershell command that lists all certificates for publisher
cmd = '(dir cert: -Recurse | Where-Object {$_.Issuer -eq "' + publisher + '"}).Thumbprint' cmd = '(dir cert: -Recurse | Where-Object {$_.Issuer -eq "' + publisher + '"}).Thumbprint'
certs = list(set(run_powershell_cmd(cmd).splitlines())) certs = list(set(run_powershell_cmd(cmd).splitlines()))
@ -806,6 +801,14 @@ def build_uwp(platforms, dev, msbuild_dir, ms_app_store):
else: else:
Configuration = "Release" Configuration = "Release"
# Parse appxmanifest to find the publisher name and version
manifest_file = path.join(os.getcwd(), 'support', 'hololens', 'ServoApp', 'Package.appxmanifest')
manifest = xml.etree.ElementTree.parse(manifest_file)
namespace = "{http://schemas.microsoft.com/appx/manifest/foundation/windows10}"
identity = manifest.getroot().find(namespace + "Identity")
publisher = identity.attrib["Publisher"]
version = identity.attrib["Version"]
msbuild = path.join(msbuild_dir, "msbuild.exe") msbuild = path.join(msbuild_dir, "msbuild.exe")
build_file_template = path.join('support', 'hololens', 'package.msbuild') build_file_template = path.join('support', 'hololens', 'package.msbuild')
with open(build_file_template) as f: with open(build_file_template) as f:
@ -820,14 +823,16 @@ def build_uwp(platforms, dev, msbuild_dir, ms_app_store):
) )
build_file.close() build_file.close()
# Generate an appxbundle. # Generate an appxbundle.
msbuild_args = setup_uwp_signing(ms_app_store) msbuild_args = setup_uwp_signing(ms_app_store, publisher)
subprocess.check_call([msbuild, "/m", build_file.name] + msbuild_args) subprocess.check_call([msbuild, "/m", build_file.name] + msbuild_args)
os.unlink(build_file.name) os.unlink(build_file.name)
print("Creating ZIP") # Don't bother creating an archive that contains unsigned app packages.
out_dir = path.join(os.getcwd(), 'support', 'hololens', 'AppPackages', 'ServoApp') if not ms_app_store:
name = 'ServoApp_1.0.0.0_%sTest' % ('Debug_' if dev else '') print("Creating ZIP")
artifacts_dir = path.join(out_dir, name) out_dir = path.join(os.getcwd(), 'support', 'hololens', 'AppPackages', 'ServoApp')
zip_path = path.join(out_dir, name + ".zip") name = 'ServoApp_%s_%sTest' % (version, 'Debug_' if dev else '')
archive_deterministically(artifacts_dir, zip_path, prepend_path='servo/') artifacts_dir = path.join(out_dir, name)
print("Packaged Servo into " + zip_path) zip_path = path.join(out_dir, "FirefoxReality.zip")
archive_deterministically(artifacts_dir, zip_path, prepend_path='servo/')
print("Packaged Servo into " + zip_path)

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap mp uap5"> <Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap5="http://schemas.microsoft.com/appx/manifest/uap/windows10/5" IgnorableNamespaces="uap mp uap5">
<Identity Name="MozillaFoundation.FirefoxReality" Publisher="CN=Allizom" Version="1.0.0.0" /> <Identity Name="MozillaFoundation.FirefoxReality" Publisher="CN=Allizom" Version="1.1.0.0" />
<mp:PhoneIdentity PhoneProductId="1d265729-8836-4bd3-9992-4cb111d1068b" PhonePublisherId="00000000-0000-0000-0000-000000000000" /> <mp:PhoneIdentity PhoneProductId="1d265729-8836-4bd3-9992-4cb111d1068b" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
<Properties> <Properties>
<DisplayName>Firefox Reality</DisplayName> <DisplayName>Firefox Reality</DisplayName>