77 lines
2.4 KiB
PowerShell
77 lines
2.4 KiB
PowerShell
#requires -Version 5
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$rootDir = Resolve-Path (Join-Path $scriptDir "..")
|
|
Set-Location $rootDir
|
|
|
|
$baselineTag = if ($env:OPENRGB_BASELINE_TAG) { $env:OPENRGB_BASELINE_TAG } else { "upstream-openrgb-1.0rc3" }
|
|
$upstreamRemote = if ($env:OPENRGB_UPSTREAM_REMOTE) { $env:OPENRGB_UPSTREAM_REMOTE } else { "upstream" }
|
|
|
|
if ($env:OPENRGB_FETCH_UPSTREAM -eq "1") {
|
|
Write-Host "[INFO] Fetch upstream remote '$upstreamRemote'..."
|
|
git fetch $upstreamRemote --tags --prune | Out-Null
|
|
}
|
|
|
|
if (-not (git cat-file -e "${baselineTag}^{commit}" 2>$null)) {
|
|
Write-Error "[ERROR] Baseline tag '$baselineTag' ontbreekt in repository."
|
|
exit 1
|
|
}
|
|
|
|
$remotes = git remote
|
|
if ($remotes -notcontains $upstreamRemote) {
|
|
Write-Error "[ERROR] Remote '$upstreamRemote' ontbreekt. Voeg upstream toe of zet OPENRGB_UPSTREAM_REMOTE."
|
|
exit 1
|
|
}
|
|
|
|
$changedFiles = git diff --name-only "${baselineTag}..HEAD"
|
|
if (-not $changedFiles) {
|
|
Write-Host "[INFO] Geen verschillen t.o.v. baseline '$baselineTag'."
|
|
exit 0
|
|
}
|
|
|
|
$unexpected = @()
|
|
foreach ($file in $changedFiles) {
|
|
$allowed = $false
|
|
if ($file -in @(
|
|
".dockerignore",
|
|
".env.example",
|
|
".gitignore",
|
|
"Dockerfile",
|
|
"README.md",
|
|
"startup/main_FreeBSD_Linux_MacOS.cpp"
|
|
)) {
|
|
$allowed = $true
|
|
}
|
|
|
|
if (-not $allowed) {
|
|
switch -Wildcard ($file) {
|
|
"docs/*" { $allowed = $true }
|
|
"lumaops/*" { $allowed = $true }
|
|
"docker/*" { $allowed = $true }
|
|
"scripts/*" { $allowed = $true }
|
|
"docker-compose*.yml" { $allowed = $true }
|
|
"docker-compose*.yaml" { $allowed = $true }
|
|
".github/*" { $allowed = $true }
|
|
}
|
|
}
|
|
|
|
if (-not $allowed) {
|
|
$unexpected += $file
|
|
}
|
|
}
|
|
|
|
if ($unexpected.Count -gt 0) {
|
|
Write-Host "[ERROR] Verandering gevonden buiten de geautoriseerde fork-patchset:"
|
|
foreach ($file in $unexpected) {
|
|
Write-Host " - $file"
|
|
}
|
|
Write-Host "[HINT] Voeg uitzonderingen alleen expliciet toe indien technisch noodzakelijk."
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "[OK] Alleen geautoriseerde wijzigingen t.o.v. baseline '$baselineTag'."
|
|
Write-Host "[OK] Upstream-patchgrens blijft schoon."
|