32 lines
986 B
Python
32 lines
986 B
Python
#
|
||
# Erminig - Rentre la nouvelle version d'un soft dans la base de données
|
||
# Copyright (C) 2025 L0m1g
|
||
# Sous licence DOUARN - Voir le fichier LICENCE pour les détails
|
||
#
|
||
# Ce fichier fait partie du projet Erminig.
|
||
# Libre comme l’air, stable comme un menhir, et salé comme le beurre.
|
||
#
|
||
|
||
from erminig.models import versions
|
||
from erminig.controllers.govel.pakva import Pakva
|
||
|
||
|
||
def handle_new_version(db, upstream_id, name, version, url):
|
||
"""
|
||
Gère l'arrivée d'une nouvelle version :
|
||
- Insère en base si absente
|
||
- Crée ou met à jour le fichier Pakva correspondant
|
||
"""
|
||
inserted = versions.insert_version_if_new(db, upstream_id, version, url)
|
||
if not inserted:
|
||
return False
|
||
|
||
pakva = Pakva(name, version, url)
|
||
if pakva.path.exists():
|
||
pakva.update_version(version, url, reset_revision=True)
|
||
print(f"[PAKVA] Mis à jour pour {name}")
|
||
else:
|
||
pakva.save()
|
||
print(f"[PAKVA] Créé pour {name}")
|
||
|
||
return True
|