Skip to content

Commit

Permalink
Merge branch 'microsoft:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
step-ci authored Nov 20, 2024
2 parents f412285 + 6e5a575 commit 1550740
Show file tree
Hide file tree
Showing 12,157 changed files with 250,404 additions and 50,226 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
72 changes: 71 additions & 1 deletion .github/policies/moderatorTriggers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ configuration:
then:
- addLabel:
label: Area-Matching
# Area-Publish-Pipeline
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[aA]rea[\s-][Pp]ublish(ing)?[\s-][pP]ipeline'
isRegex: True
then:
- addLabel:
label: Area-Publish-Pipeline
# Area-Rebuild-Pipeline
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[aA]rea[\s-][Rr]ebuild[\s-][pP]ipeline'
isRegex: True
then:
- addLabel:
label: Area-Rebuild-Pipeline
# Area-Scope
- if:
- commentContains:
Expand Down Expand Up @@ -156,6 +172,14 @@ configuration:
then:
- addLabel:
label: Error-Hash-Mismatch
# Error-Installer-Availability
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[Ee]rror[\s-][Ii]nstaller[\s-][Aa]vailability'
isRegex: True
then:
- addLabel:
label: Error-Installer-Availability
# Hardware
- if:
- commentContains:
Expand All @@ -180,6 +204,14 @@ configuration:
then:
- addLabel:
label: Highest-Version-Removal
# Icon
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[Ii]con'
isRegex: True
then:
- addLabel:
label: Icon
# In-PR
- if:
- commentContains:
Expand All @@ -188,6 +220,14 @@ configuration:
then:
- addLabel:
label: In-PR
# Installer-Error
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[iI]nstaller[\s-][Ee]rror'
isRegex: True
then:
- addLabel:
label: Installer-Error
# Installer-Issue
- if:
- commentContains:
Expand All @@ -198,10 +238,18 @@ configuration:
label: Installer-Issue
- addLabel:
label: Area-External
# Interactive-Only-Download
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[iI]nteractive[\s-][oO]nly[\s-][Dd]ownload'
isRegex: True
then:
- addLabel:
label: Interactive-Only-Download
# Interactive-Only-Installer
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+[iI]nteractive[\s-][oO]nly([\s-][iI]nstaller)?'
pattern: '\[[Pp]olicy\]\s+[iI]nteractive[\s-][oO]nly[\s-][iI]nstaller'
isRegex: True
then:
- addLabel:
Expand Down Expand Up @@ -254,6 +302,14 @@ configuration:
then:
- addLabel:
label: Manifest-Content-Incomplete
# Manifest-Singleton-Deprecated
- if:
- commentContains:
pattern: '\[[Pp]olicy\]\s+([Mm]anifest[\s-])?[Ss]ingleton[\s-][Dd]eprecated'
isRegex: True
then:
- addLabel:
label: Manifest-Singleton-Deprecated
# Moderator-Approved
- if:
- commentContains:
Expand Down Expand Up @@ -445,6 +501,10 @@ configuration:
label: Area-Manifest
- removeLabel:
label: Area-Matching
- removeLabel:
label: Area-Publish-Pipeline
- removeLabel:
label: Area-Rebuild-Pipeline
- removeLabel:
label: Area-Scope
- removeLabel:
Expand All @@ -461,16 +521,24 @@ configuration:
label: DSC
- removeLabel:
label: Error-Hash-Mismatch
- removeLabel:
label: Error-Installer-Availability
- removeLabel:
label: Hardware
- removeLabel:
label: Help-Wanted
- removeLabel:
label: Highest-Version-Removal
- removeLabel:
label: Icon
- removeLabel:
label: In-PR
- removeLabel:
label: Installer-Error
- removeLabel:
label: Installer-Issue
- removeLabel:
label: Interactive-Only-Download
- removeLabel:
label: Interactive-Only-Installer
- removeLabel:
Expand All @@ -487,6 +555,8 @@ configuration:
label: Manifest-Content-Incomplete
- removeLabel:
label: Manifest-Metadata-Consistency
- removeLabel:
label: Manifest-Singleton-Deprecated
- removeLabel:
label: Manifest-Version-Deprecated
- removeLabel:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.msix
*.msixbundle

# Visual Studio cache files
# files ending in .cache can be ignored
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ Please check the [overview](doc/README.md) for detailed topics. Common topics fo
* [Requesting a new package](doc/Issues.md#Request-a-New-Package)
* [Requesting a new package version](doc/Issues.md#Request-a-New-Package-Version)

## Repology
[Repology](https://repology.org/), the packaging hub monitors package repositories comparing package versions and other information.

[![Repository status](https://repology.org/badge/repository-big/winget.svg)](https://repology.org/repository/winget)

# Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
Expand Down
127 changes: 127 additions & 0 deletions Tools/CheckDisplayVersions.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<#
.SYNOPSIS
Checks for DisplayVersions to be unique within each package
.DESCRIPTION
This script intends to help ensure that all DisplayVersions in the repository
are unique within each package. Each package version can have multiple DisplayVersion
but each DisplayVersion should only belong to one package version. This script
will not build out the Version Range in the same way that WinGet does; as such
it may not be entirely accurate. However, it should catch a majority of cases.
It will parse through each of the manifest files and then iterate over each
DisplayVersion within a package to check for uniqueness.
.EXAMPLE
PS C:\Projects\winget-pkgs> Get-Help .\Tools\CheckDisplayVersion.ps1 -Full
Show this script's help
.EXAMPLE
PS C:\Projects\winget-pkgs> .\Tools\CheckDisplayVersion.ps1
Run the script to output potential issues with DisplayVersions
.NOTES
Please file an issue if you run into errors with this script:
https://github.com/microsoft/winget-pkgs/issues
.LINK
https://github.com/microsoft/winget-pkgs/blob/master/Tools/CheckDisplayVersion.ps1
#>
#Requires -Version 5

[CmdletBinding()]
param (
# No Parameters
)

$ProgressPreference = 'SilentlyContinue'

# Installs `powershell-yaml` as a dependency for parsing yaml content
if (-not(Get-Module -ListAvailable -Name powershell-yaml)) {
try {
Write-Verbose "PowerShell module 'powershell-yaml' was not found. Attempting to install it. . ."
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser
Install-Module -Name powershell-yaml -Force -Repository PSGallery -Scope CurrentUser
} catch {
# If there was an exception while installing, pass it as an InternalException for further debugging
throw [UnmetDependencyException]::new("'powershell-yaml' unable to be installed successfully", $_.Exception)
} finally {
# Double check that it was installed properly
if (-not(Get-Module -ListAvailable -Name powershell-yaml)) {
throw [UnmetDependencyException]::new("'powershell-yaml' is not found")
}
Write-Verbose "PowerShell module 'powershell-yaml' was installed successfully"
}
}

# Set the root folder where manifests should be loaded from
if (Test-Path -Path "$PSScriptRoot\..\manifests") {
$ManifestsFolder = (Resolve-Path "$PSScriptRoot\..\manifests").Path
} else {
$ManifestsFolder = (Resolve-Path '.\').Path
}

Write-Verbose "Fetching list of installer manifests from $ManifestsFolder . . ."
$installerManifests = Get-ChildItem $ManifestsFolder -Recurse -Filter '*.installer.yaml'
Write-Verbose "Found $($installerManifests.Count) installer manifests"
Write-Verbose 'Filtering manifests for DisplayVersion. . .'
$manifestsWithDisplayVersions = $installerManifests.Where({ $_ | Get-Content -Raw | Select-String 'DisplayVersion' })
Write-Verbose "$($manifestsWithDisplayVersions.Count) manifests contain displayVersions"
$currentManifestFolder = ''
Write-Verbose 'Parsing manifest contents. . .'
$displayVersionsByManifest = $manifestsWithDisplayVersions | ForEach-Object {
$processingFolder = ($_.FullName | Select-String '\\[a-z0-9]\\').Matches.Value[1]
if ($processingFolder -ne $currentManifestFolder) {
$currentManifestFolder = $processingFolder
Write-Verbose "Processing ../manifests/$processingFolder/*"
}
Write-Debug "Processing $($_.FullName)"
$YamlContent = $_ | Get-Content | ConvertFrom-Yaml
$rootEntries = $YamlContent.AppsAndFeaturesEntries.DisplayVersion
$installerEntries = $YamlContent.Installers.AppsAndFeaturesEntries.DisplayVersion
return @{
Package = $YamlContent.PackageIdentifier
Version = $YamlContent.PackageVersion
DisplayVersions = @($rootEntries; $installerEntries).Where({ $_ }) | Select-Object -Unique
}
}

Write-Verbose 'Creating list of unique packages. . .'
$allPackages = $displayVersionsByManifest.Package | Select-Object -Unique
Write-Verbose "$($allPackages.Count) unique packages found"

Write-Verbose 'Checking for DisplayVersions that are associated with multiple package versions. . .'
$currentStart = ''
$versionsWithOverlap = $allPackages | ForEach-Object {
if ($currentStart -ne $_[0]) {
$currentStart = $_.ToLower()[0]
Write-Verbose "Processing packages beginning with $currentStart"
}
Write-Debug "Checking package $_"
$package = $_
$allDisplayVersions = $displayVersionsByManifest.Where({ $_.Package -eq $package }).DisplayVersions
$uniqueDisplayVersions = $allDisplayVersions | Select-Object -Unique
if ($allDisplayVersions.count -ne $uniqueDisplayVersions.count) {
Write-Debug "Overlapping DisplayVersions found for $package"
$overlappingDisplayVersions = (Compare-Object -ReferenceObject $allDisplayVersions -DifferenceObject $uniqueDisplayVersions).InputObject
$packageVersionsWithOverlap = $overlappingDisplayVersions | ForEach-Object {
$overlappedVersion = $_
return $displayVersionsByManifest.Where({ $_.Package -eq $package -and $_.DisplayVersions -match $overlappedVersion }).Version
}
return [PSCustomObject]@{
Package = $package
DisplayVersions = @($overlappingDisplayVersions)
PackageVersions = @($packageVersionsWithOverlap)
}
} else {
return $null
}
}
$versionsWithOverlap = $versionsWithOverlap.Where({ $_ })
Write-Verbose "Found $($versionsWithOverlap.count) monikers with multiple packages"


if ($versionsWithOverlap.Count -gt 0) {
Write-Output $versionsWithOverlap
exit 1
}

class UnmetDependencyException : Exception {
UnmetDependencyException([string] $message) : base($message) {}
UnmetDependencyException([string] $message, [Exception] $exception) : base($message, $exception) {}
}
10 changes: 9 additions & 1 deletion Tools/PRTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ Param(
[Switch] $KeepBranch = $false,
[Switch] $Prerelease = $false,
[Switch] $EnableExperimentalFeatures = $false,
[string] $WinGetVersion = $null
[string] $WinGetVersion = $null,
[string] $WinGetOptions,
[scriptblock] $Script = $null,
[string] $MapFolder = $pwd,
[switch] $Clean
)

$PullRequest = $PullRequest.TrimStart('#')
Expand Down Expand Up @@ -51,6 +55,10 @@ $params = @{
Prerelease = $Prerelease
EnableExperimentalFeatures = $EnableExperimentalFeatures
WinGetVersion = $WinGetVersion
WinGetOptions = $WinGetOptions
Script = $Script
MapFolder = $MapFolder
Clean = $Clean
}
& $sandboxTestPath @params

Expand Down
Loading

0 comments on commit 1550740

Please sign in to comment.