Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions build/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,20 @@ goes into the manifest and hashed, so the manifest cannot claim a checksum the
published file does not have. That also means this cannot be run before the
installer is there: for the archive, before the release has reached it.

Each template names the manifest version twice, in `ManifestVersion` and in the
`$schema` comment. winget-pkgs flags a submission that uses a version it has
deprecated, so the version has to be raised now and then, in all six lines.
Raise it only to a version the latest `wingetcreate` release knows:
`wingetcreate submit` validates the manifests first, rejects a newer version,
and then opens no pull request.

### `winget/test-winget-manifests.ps1`

Tests the renderer: that the values land where they belong, that no placeholder
survives into a file that would be submitted verbatim, that the output is UTF-8
without a BOM and with LF endings, and that a malformed version, checksum or
date, or an unknown installer source, is refused.
survives into a file that would be submitted verbatim, that each `$schema`
comment names the type and version of the manifest under it, that the output is
UTF-8 without a BOM and with LF endings, and that a malformed version, checksum
or date, or an unknown installer source, is refused.

### `winget/validate_manifests.py`

Expand Down
4 changes: 2 additions & 2 deletions build/windows/winget/Apache.Thrift.installer.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.12.0.schema.json
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.28.0.schema.json

PackageIdentifier: Apache.Thrift
PackageVersion: __VERSION__
Expand Down Expand Up @@ -48,4 +48,4 @@ Installers:
# read as a YAML number and rejected by the schema as not a string.
InstallerSha256: '__INSTALLER_SHA256__'
ManifestType: installer
ManifestVersion: 1.12.0
ManifestVersion: 1.28.0
4 changes: 2 additions & 2 deletions build/windows/winget/Apache.Thrift.locale.en-US.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.12.0.schema.json
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.28.0.schema.json

PackageIdentifier: Apache.Thrift
PackageVersion: __VERSION__
Expand Down Expand Up @@ -56,4 +56,4 @@ Documentations:
- DocumentLabel: Tutorial
DocumentUrl: https://thrift.apache.org/tutorial/
ManifestType: defaultLocale
ManifestVersion: 1.12.0
ManifestVersion: 1.28.0
4 changes: 2 additions & 2 deletions build/windows/winget/Apache.Thrift.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
# specific language governing permissions and limitations
# under the License.

# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.12.0.schema.json
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.28.0.schema.json

PackageIdentifier: Apache.Thrift
PackageVersion: __VERSION__
DefaultLocale: en-US
ManifestType: version
ManifestVersion: 1.12.0
ManifestVersion: 1.28.0
18 changes: 18 additions & 0 deletions build/windows/winget/test-winget-manifests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,24 @@ try {
Assert-True "$name holds no placeholders" ($content -notmatch '__[A-Z0-9_]+__')
}

# WinGet checks the $schema comment against the manifest under it: the
# type and version it names have to be the ManifestType and the
# ManifestVersion, and the three manifests have to share that version. A
# new manifest version has to reach all six lines.
$manifestVersions = foreach ($name in $names) {
$content = Get-Content -LiteralPath (Join-Path $targetDir $name) -Raw
$header = [regex]::Match($content, '\$schema=https://aka\.ms/winget-manifest\.(\w+)\.(\d+\.\d+\.\d+)\.schema\.json')
$type = [regex]::Match($content, '(?m)^ManifestType: (\w+)\s*$')
$manifestVersion = [regex]::Match($content, '(?m)^ManifestVersion: (\d+\.\d+\.\d+)\s*$')
Assert-True "$name names its own type and version in the schema comment" `
($header.Success -and $type.Success -and $manifestVersion.Success -and
($header.Groups[1].Value -eq $type.Groups[1].Value) -and
($header.Groups[2].Value -eq $manifestVersion.Groups[1].Value)) $content
$manifestVersion.Groups[1].Value
}
Assert-True 'the manifests share one manifest version' `
(@($manifestVersions | Select-Object -Unique).Count -eq 1) ($manifestVersions -join ', ')

Assert-True 'the version reaches every manifest' `
(($installer -match "PackageVersion: $([regex]::Escape($version))") -and
($locale -match "PackageVersion: $([regex]::Escape($version))") -and
Expand Down
Loading