refactor(layout): 源码迁入 src/,项目根迁到 SceneMarshal
This commit is contained in:
+15
-13
@@ -5,8 +5,8 @@
|
||||
|
||||
.DESCRIPTION
|
||||
默认(源码同步):
|
||||
打包 media/src → scp 到 N100 → 就地解包(不动 config.ini / 日志 / 缓存)
|
||||
→ 远端 git status 显示差异 → 容器内 compileall 语法检查。
|
||||
打包 src 与 scripts → scp 到 N100 → 就地解包
|
||||
(不动 config.ini / 日志 / 缓存)→ 远端 git status 显示差异 → 容器内 compileall。
|
||||
|
||||
-Commit:本地 commit + push → 远端 fetch + reset --hard origin/main → 语法检查。
|
||||
适合「阶段性成果」:远端 HEAD 跟上,git 历史干净。
|
||||
@@ -34,7 +34,7 @@ $OutputEncoding = [Console]::OutputEncoding = [Text.Encoding]::UTF8
|
||||
|
||||
$RepoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$Remote = 'ali@10.10.1.202'
|
||||
$RemoteRepo = '/home/ali/docker/tools/python'
|
||||
$RemoteRepo = '/home/ali/docker/tools/python/SceneMarshal'
|
||||
$SshOpts = @('-o', 'BatchMode=yes', '-o', 'ConnectTimeout=10')
|
||||
|
||||
function Assert-Agent {
|
||||
@@ -94,8 +94,8 @@ git reset --hard origin/main
|
||||
echo '=== 远端 HEAD ==='
|
||||
git log --oneline -1
|
||||
echo '=== 容器内语法检查 ==='
|
||||
docker exec -u 0 python find /python/media/src -name __pycache__ -type d -exec chown -R 1000:1000 {} + 2>/dev/null || true
|
||||
docker exec -u 1000:1000 -w /python/media/src python /python/media/bin/python -m compileall -q .
|
||||
docker exec -u 0 python find /python/SceneMarshal/src -name __pycache__ -type d -exec chown -R 1000:1000 {} + 2>/dev/null || true
|
||||
docker exec -u 1000:1000 -w /python/SceneMarshal python sh -c 'if [ -x .venv/bin/python ]; then exec .venv/bin/python -m compileall -q src scripts; else exec python3 -m compileall -q src scripts; fi'
|
||||
echo COMPILE_OK
|
||||
echo '=== 安装运维脚本 ==='
|
||||
install_tool() {
|
||||
@@ -113,9 +113,11 @@ install_tool "$RemoteRepo/scripts/media_archive.py" /usr/local/bin/media-archive
|
||||
}
|
||||
else {
|
||||
$tgz = Join-Path ([IO.Path]::GetTempPath()) 'SceneMarshal-sync.tgz'
|
||||
Write-Host '▶ 打包 media/src ...' -ForegroundColor Cyan
|
||||
Write-Host '▶ 打包 src / scripts ...' -ForegroundColor Cyan
|
||||
if (Test-Path -LiteralPath $tgz) { Remove-Item -LiteralPath $tgz -Force }
|
||||
& tar -czf $tgz -C $RepoRoot --exclude=__pycache__ --exclude='*.pyc' media/src scripts
|
||||
& tar -czf $tgz -C $RepoRoot --exclude=__pycache__ --exclude='*.pyc' `
|
||||
--exclude='config.ini' --exclude='*.log' --exclude='tmdb_data.json' `
|
||||
--exclude='preflight_cache.json' --exclude='*.lock' src scripts
|
||||
if ($LASTEXITCODE -ne 0) { throw '本地打包失败' }
|
||||
Write-Host (" {0} KB" -f [math]::Round((Get-Item -LiteralPath $tgz).Length / 1KB, 1)) -ForegroundColor DarkGray
|
||||
|
||||
@@ -125,19 +127,19 @@ install_tool "$RemoteRepo/scripts/media_archive.py" /usr/local/bin/media-archive
|
||||
|
||||
Invoke-RemoteScript @'
|
||||
set -euo pipefail
|
||||
REPO=/home/ali/docker/tools/python
|
||||
REPO=/home/ali/docker/tools/python/SceneMarshal
|
||||
cd "$REPO"
|
||||
TS=$(date +%Y%m%d-%H%M%S)
|
||||
mkdir -p /tmp/SceneMarshal-backup
|
||||
tar -czf "/tmp/SceneMarshal-backup/src-$TS.tar.gz" media/src
|
||||
tar -czf "/tmp/SceneMarshal-backup/src-$TS.tar.gz" src scripts
|
||||
tar -xzf /tmp/SceneMarshal-sync.tgz -C "$REPO"
|
||||
find media/src -name '*.py' -exec chmod 644 {} +
|
||||
find src scripts -name '*.py' -exec chmod 644 {} +
|
||||
echo "=== 远端相对仓库 HEAD 的变更 ==="
|
||||
CHANGED=$(git status --porcelain -- media/src | head -40 || true)
|
||||
CHANGED=$(git status --porcelain | head -40 || true)
|
||||
if [ -z "$CHANGED" ]; then echo "(无差异,远端已是最新)"; else echo "$CHANGED"; fi
|
||||
echo "=== 容器内语法检查 ==="
|
||||
docker exec -u 0 python find /python/media/src -name __pycache__ -type d -exec chown -R 1000:1000 {} + 2>/dev/null || true
|
||||
docker exec -u 1000:1000 -w /python/media/src python /python/media/bin/python -m compileall -q .
|
||||
docker exec -u 0 python find /python/SceneMarshal/src -name __pycache__ -type d -exec chown -R 1000:1000 {} + 2>/dev/null || true
|
||||
docker exec -u 1000:1000 -w /python/SceneMarshal python sh -c 'if [ -x .venv/bin/python ]; then exec .venv/bin/python -m compileall -q src scripts; else exec python3 -m compileall -q src scripts; fi'
|
||||
echo COMPILE_OK
|
||||
echo "=== 安装运维脚本 ==="
|
||||
install_tool() {
|
||||
|
||||
Reference in New Issue
Block a user