🔧 FIX: Keine Changes-Marker nach dem Klonen + korrekte Berechtigungen (755/644)
docker-build-and-push / build (push) Successful in 19s

This commit is contained in:
KI-Sparringpartner
2026-08-03 16:00:06 +02:00
parent 8b8218853d
commit e1b4b37359
2 changed files with 47 additions and 59 deletions
+31 -19
View File
@@ -1,8 +1,33 @@
import subprocess
import os
import shutil
from pathlib import Path
def set_permissions(path: str):
"""Setzt korrekte POSIX-Berechtigungen für ein Verzeichnis."""
try:
# Ordner = 755 (rwxr-xr-x)
os.chmod(str(path), 0o755)
# Rekursiv alle Teildateien bearbeiten
for root, dirs, files in os.walk(str(path)):
for d in dirs:
full_path = os.path.join(root, d)
try:
os.chmod(full_path, 0o755)
except Exception:
pass
for f in files:
full_path = os.path.join(root, f)
try:
os.chmod(full_path, 0o644)
except Exception:
pass
except Exception as e:
print(f"Warnung bei Berechtigungen: {e}")
def clone_repo(repo_url: str, target_dir: Path, token: str = None):
"""Klont ein Repository in den Zielordner."""
if not target_dir.exists():
@@ -18,36 +43,23 @@ def clone_repo(repo_url: str, target_dir: Path, token: str = None):
text=True
)
# ✅ BERECHTIGUNGEN SETZEN NACH DEM KLOONEN!
# ✅ BERECHTIGUNGEN NACH DEM KLOONEN SETZEN!
if result.returncode == 0:
try:
os.chmod(str(target_dir), 0o755)
for root, dirs, files in os.walk(str(target_dir)):
for d in dirs:
os.chmod(os.path.join(root, d), 0o755)
for f in files:
os.chmod(os.path.join(root, f), 0o644)
except Exception as e:
print(f"Warnung bei Berechtigungen: {e}")
set_permissions(str(target_dir))
return {"success": result.returncode == 0, "output": result.stdout, "error": result.stderr}
def unsubscribe_repo(target_dir: Path):
"""Loescht ein abonniertes Projekt."""
import shutil
def unsubscribe_repo(project_name: str, projects_dir: Path):
"""Loeschen eines abonnierten Projekts inklusive Berechtigungen."""
target_dir = projects_dir / project_name
if not target_dir.exists():
return {"success": False, "error": "Projekt nicht gefunden"}
try:
# ✅ ALLE CHANGES MARKIERUNG LÖSCHEN
changes_marker = target_dir / ".gitea-changes.marker"
if changes_marker.exists():
changes_marker.unlink()
shutil.rmtree(str(target_dir))
return {"success": True, "message": f"{target_dir.name} erfolgreich geloescht"}
return {"success": True, "message": f"{project_name} erfolgreich geloescht"}
except Exception as e:
return {"success": False, "error": str(e)}