builder: parse release from config.xml

This commit is contained in:
Davide Cavalca 2023-07-14 12:55:24 -07:00
parent 9b185dae8a
commit d6d00d25da

View File

@ -10,6 +10,7 @@ import sys
import requests import requests
from datetime import date from datetime import date
import shutil import shutil
import xml.etree.ElementTree as ET
def fail(message): def fail(message):
@ -17,10 +18,14 @@ def fail(message):
sys.exit(1) sys.exit(1)
RELEASE = os.getenv("FEDORA_RELEASE") tree = ET.parse("config.xml")
for e in tree.getroot().iter("release-version"):
RELEASE = e.text
break
if not RELEASE: if not RELEASE:
fail("FEDORA_RELEASE is not defined in your environment, aborting") fail("Could not parse release from config.xml")
TODAY = date.today().strftime("%Y%m%d") TODAY = date.today().strftime("%Y%m%d")
@ -28,25 +33,25 @@ TODAY = date.today().strftime("%Y%m%d")
TARGETS = { TARGETS = {
"kde": { "kde": {
"profile": "Workstation-KDE", "profile": "Workstation-KDE",
"name": f"Fedora Linux {RELEASE} with KDE Plasma ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} with KDE Plasma ({TODAY})",
"os_name": "Fedora Linux with KDE Plasma", "os_name": "Fedora Linux with KDE Plasma",
"id": "kde", "id": "kde",
}, },
"gnome": { "gnome": {
"profile": "Workstation-GNOME", "profile": "Workstation-GNOME",
"name": f"Fedora Linux {RELEASE} with GNOME ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} with GNOME ({TODAY})",
"os_name": "Fedora Linux with GNOME", "os_name": "Fedora Linux with GNOME",
"id": "gnome", "id": "gnome",
}, },
"server": { "server": {
"profile": "Server", "profile": "Server",
"name": f"Fedora Linux {RELEASE} Server ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} Server ({TODAY})",
"os_name": "Fedora Linux Server", "os_name": "Fedora Linux Server",
"id": "server", "id": "server",
}, },
"minimal": { "minimal": {
"profile": "Minimal", "profile": "Minimal",
"name": f"Fedora Linux {RELEASE} Minimal ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} Minimal ({TODAY})",
"os_name": "Fedora Linux Minimal", "os_name": "Fedora Linux Minimal",
"id": "minimal", "id": "minimal",
}, },