Compare commits

...
3 Commits
Author SHA1 Message Date
Gabriel20xx f1c5648c5c Sync shared snapshot from 170076e
Docker / Docker Build & Push (push) Successful in 1m20s
2026-09-01 11:21:47 +02:00
Gabriel20xx ad3b6a2297 Sync shared snapshot from 43d77dd 2026-09-01 11:18:01 +02:00
Gabriel20xx 8d6437800c Sync shared snapshot from 43d77dd 2026-09-01 09:57:08 +02:00
2 changed files with 59 additions and 31 deletions

No files matched your search

@@ -2,6 +2,7 @@ import io
import json
import unittest
import urllib.error
from email.message import Message
from unittest.mock import patch
from shared_backend.authclient import (
@@ -37,7 +38,7 @@ def _fake_http_error(status: int, payload: dict) -> urllib.error.HTTPError:
url="http://authguard.example/api/session/validate",
code=status,
msg="error",
hdrs=None,
hdrs=Message(),
fp=io.BytesIO(body),
)
+57 -30
View File
@@ -12,20 +12,44 @@ if ($Push -and -not $Commit) {
throw 'The -Push switch requires -Commit so that only generated synchronization changes are pushed.'
}
function New-ConsumerProject {
param(
[Parameter(Mandatory = $true)]
[string]$Path,
[string]$Destination = 'shared'
)
return [pscustomobject]@{ Path = $Path; Destination = $Destination }
}
# Destination defaults to 'shared' (the snapshot folder name most consumers
# use). The engine/media-backend family below mounts the same snapshot at
# 'engine' instead - historically a git submodule, converted to this same
# vendored-copy pattern for consistency and to drop the private-submodule
# checkout auth dependency in CI.
$consumerProjects = @(
'Original/AutoCode',
'Original/SimpleCollection',
'Original/CollabTable',
'Original/GameStream',
'Original/SyncServer',
'Original/UnraidMonitor',
'Original/PubliSafe',
'Forks/Bitmagnet',
'Forks/Heretic',
'Original/InfiniteVideo',
'Forks/MegaBasterd',
'Forks/HordeWorker',
'Original/OutdoorGames'
New-ConsumerProject 'Original/MediaDesktop'
New-ConsumerProject 'Original/AutoCode'
New-ConsumerProject 'Original/SimpleCollection'
New-ConsumerProject 'Original/CollabTable'
New-ConsumerProject 'Original/GameStream'
New-ConsumerProject 'Original/SyncServer'
New-ConsumerProject 'Original/UnraidMonitor'
New-ConsumerProject 'Original/PubliSafe'
New-ConsumerProject 'Forks/Bitmagnet'
New-ConsumerProject 'Forks/Heretic'
New-ConsumerProject 'Original/InfiniteVideo'
New-ConsumerProject 'Forks/MegaBasterd'
New-ConsumerProject 'Forks/HordeWorker'
New-ConsumerProject 'Original/OutdoorGames'
New-ConsumerProject 'Original/KioskDisplay' -Destination 'engine'
New-ConsumerProject 'Original/MediaAnalyzer' -Destination 'engine'
New-ConsumerProject 'Original/MediaTools' -Destination 'engine'
New-ConsumerProject 'Original/MediaViewer' -Destination 'engine'
New-ConsumerProject 'Central/MediaServant' -Destination 'engine'
New-ConsumerProject 'Central/ModerationHub' -Destination 'engine'
New-ConsumerProject 'Central/ProjectConfigurator' -Destination 'engine'
)
function Invoke-GitText {
@@ -216,7 +240,9 @@ Write-Host "Synchronizing $($sourceFiles.Count) tracked shared files from $sourc
$failures = New-Object 'System.Collections.Generic.List[string]'
foreach ($relativeProject in $consumerProjects) {
foreach ($consumerProject in $consumerProjects) {
$relativeProject = $consumerProject.Path
$destination = $consumerProject.Destination
$projectRoot = Join-Path $workspaceRoot ($relativeProject -replace '/', '\')
if (-not (Test-Path -LiteralPath $projectRoot -PathType Container)) {
$failures.Add("${relativeProject}: project directory not found")
@@ -225,19 +251,20 @@ foreach ($relativeProject in $consumerProjects) {
try {
$projectRoot = Resolve-FullPath $projectRoot
$destinationRoot = Join-Path $projectRoot 'shared'
$destinationRoot = Join-Path $projectRoot $destination
$isLegacyEligible = $destination -eq 'shared'
$legacyDirectoryName = ('Shared' + 'Code')
$projectDirectories = @(Get-ChildItem -LiteralPath $projectRoot -Directory -Force)
$destinationEntry = $projectDirectories | Where-Object { $_.Name -ceq 'shared' }
$legacyEntry = $projectDirectories | Where-Object { $_.Name -ceq $legacyDirectoryName }
$destinationEntry = $projectDirectories | Where-Object { $_.Name -ceq $destination }
$legacyEntry = if ($isLegacyEligible) { $projectDirectories | Where-Object { $_.Name -ceq $legacyDirectoryName } } else { $null }
if ($null -ne $destinationEntry -and $null -ne $legacyEntry) {
throw "Both shared and the legacy shared snapshot directory exist. Remove the legacy directory before synchronizing."
throw "Both $destination and the legacy shared snapshot directory exist. Remove the legacy directory before synchronizing."
}
$dirtyshared = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', 'shared'))
$dirtyLegacy = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $legacyDirectoryName))
if (($dirtyshared.Count -gt 0 -or $dirtyLegacy.Count -gt 0) -and -not $Force) {
throw "shared has local changes. Commit them or rerun with -Force."
$dirtyDestination = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $destination))
$dirtyLegacy = if ($isLegacyEligible) { @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('status', '--porcelain', '--', $legacyDirectoryName)) } else { @() }
if (($dirtyDestination.Count -gt 0 -or $dirtyLegacy.Count -gt 0) -and -not $Force) {
throw "$destination has local changes. Commit them or rerun with -Force."
}
if ($null -ne $legacyEntry) {
@@ -248,11 +275,11 @@ foreach ($relativeProject in $consumerProjects) {
New-Item -ItemType Directory -Force -Path $destinationRoot | Out-Null
$existingSharedFiles = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('ls-files', '--', 'shared') | Where-Object { $_ -like 'shared/*' })
foreach ($existingSharedFile in $existingSharedFiles) {
$relativeSharedFile = $existingSharedFile.Substring('shared/'.Length).Replace('\', '/')
if (-not $sourceFileSet.ContainsKey($relativeSharedFile)) {
$stalePath = Join-Path $destinationRoot ($relativeSharedFile -replace '/', '\')
$existingDestinationFiles = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('ls-files', '--', $destination) | Where-Object { $_ -like "$destination/*" })
foreach ($existingDestinationFile in $existingDestinationFiles) {
$relativeDestinationFile = $existingDestinationFile.Substring("$destination/".Length).Replace('\', '/')
if (-not $sourceFileSet.ContainsKey($relativeDestinationFile)) {
$stalePath = Join-Path $destinationRoot ($relativeDestinationFile -replace '/', '\')
if (Test-Path -LiteralPath $stalePath -PathType Leaf) {
Remove-Item -LiteralPath $stalePath -Force
}
@@ -315,15 +342,15 @@ foreach ($relativeProject in $consumerProjects) {
}
}
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', 'shared')
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', $destination)
foreach ($lockFile in $lockFiles) {
$null = Invoke-GitText -WorkingDirectory $projectRoot -Arguments @('add', '--', $lockFile)
}
$targetPaths = @('shared') + $lockFiles
$targetPaths = @($destination) + $lockFiles
$stagedChanges = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments (@('diff', '--cached', '--name-only', '--') + $targetPaths))
if ($Commit -and $stagedChanges.Count -gt 0) {
$commitMessage = "Sync shared snapshot from $sourceCommit"
$commitMessage = "Sync $destination snapshot from $sourceCommit"
$commitArguments = @('commit', '--only', '-m', $commitMessage, '--') + $targetPaths
$commitOutput = @(Invoke-GitText -WorkingDirectory $projectRoot -Arguments $commitArguments)
$commitOutput | ForEach-Object { Write-Host " $_" }