builder: use a consistent build version to avoid conflicts

This commit is contained in:
Davide Cavalca 2023-07-20 11:42:05 -07:00
parent 85c1d1750f
commit e35b149784
3 changed files with 29 additions and 12 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ merged_installer_data.json
fedora-*.zip fedora-*.zip
fedora-*.raw.zst fedora-*.raw.zst
fedora-*.json fedora-*.json
buildver

View File

@ -28,31 +28,37 @@ for e in tree.getroot().iter("release-version"):
if not RELEASE: if not RELEASE:
fail("Could not parse release from config.xml") fail("Could not parse release from config.xml")
TODAY = date.today().strftime("%Y%m%d") if os.path.exists("buildver"):
with open("buildver", "r") as f:
BUILDVER = f.read().strip()
else:
BUILDVER = date.today().strftime("%Y%m%d%H%m")
with open("buildver", "w") as f:
f.write(BUILDVER)
# TODO: should be a class using abc # TODO: should be a class using abc
TARGETS = { TARGETS = {
"kde": { "kde": {
"profile": "Workstation-KDE", "profile": "Workstation-KDE",
"name": f"Fedora Linux {RELEASE.capitalize()} with KDE Plasma ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} with KDE Plasma ({BUILDVER})",
"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.capitalize()} with GNOME ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} with GNOME ({BUILDVER})",
"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.capitalize()} Server ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} Server ({BUILDVER})",
"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.capitalize()} Minimal ({TODAY})", "name": f"Fedora Linux {RELEASE.capitalize()} Minimal ({BUILDVER})",
"os_name": "Fedora Linux Minimal", "os_name": "Fedora Linux Minimal",
"id": "minimal", "id": "minimal",
}, },
@ -126,11 +132,11 @@ def packageBuild(target):
# TODO: rewrite in python instead of shelling out # TODO: rewrite in python instead of shelling out
runCommand(["./make-asahi-installer-package.sh"]) runCommand(["./make-asahi-installer-package.sh"])
base = f"fedora-{RELEASE}-{target['id']}-{TODAY}" base = f"fedora-{RELEASE}-{target['id']}-{BUILDVER}"
os.rename(f"fedora-{RELEASE}-{TODAY}.zip", f"{base}.zip") os.rename(f"fedora-{RELEASE}-{BUILDVER}.zip", f"{base}.zip")
os.rename(f"fedora-{RELEASE}-{TODAY}.logs.zip", f"{base}.logs.zip") os.rename(f"fedora-{RELEASE}-{BUILDVER}.logs.zip", f"{base}.logs.zip")
os.rename(f"fedora-{RELEASE}-{TODAY}.raw.zst", f"{base}.raw.zst") os.rename(f"fedora-{RELEASE}-{BUILDVER}.raw.zst", f"{base}.raw.zst")
os.rename(f"fedora-{RELEASE}-{TODAY}.json", f"{base}.json") os.rename(f"fedora-{RELEASE}-{BUILDVER}.json", f"{base}.json")
with open(f"{base}.json", "r") as f: with open(f"{base}.json", "r") as f:
data = json.load(f) data = json.load(f)
@ -154,12 +160,15 @@ def packageBuild(target):
def uploadToS3(source, destination): def uploadToS3(source, destination):
if S3_BUCKET is None:
fail("S3_BUCKET is not set")
s3 = boto3.client("s3") s3 = boto3.client("s3")
s3.upload_file(source, S3_BUCKET, destination) s3.upload_file(source, S3_BUCKET, destination)
def packageUpload(target): def packageUpload(target):
base = f"fedora-{RELEASE}-{target['id']}-{TODAY}" base = f"fedora-{RELEASE}-{target['id']}-{BUILDVER}"
package = f"{base}.zip" package = f"{base}.zip"
logs_package = f"{base}.logs.zip" logs_package = f"{base}.logs.zip"
image = f"{base}.raw.zst" image = f"{base}.raw.zst"
@ -172,6 +181,9 @@ def packageUpload(target):
def getManifest(): def getManifest():
if S3_BUCKET is None:
fail("S3_BUCKET is not set")
s3 = boto3.resource("s3") s3 = boto3.resource("s3")
obj = s3.Object(S3_BUCKET, MANIFEST) obj = s3.Object(S3_BUCKET, MANIFEST)
data = io.BytesIO() data = io.BytesIO()

View File

@ -16,7 +16,11 @@ requireCommands() {
} }
release='rawhide' release='rawhide'
date=$(date +%Y%m%d) if [ -f buildver ]; then
date="$(cat buildver)"
else
date=$(date +%Y%m%d%H%m)
fi
image="${1:-outdir/Fedora-Asahi-Remix.aarch64-0.0.0.raw}" image="${1:-outdir/Fedora-Asahi-Remix.aarch64-0.0.0.raw}"
package="${2:-fedora-${release}-${date}}" package="${2:-fedora-${release}-${date}}"