From e14f1665402a4e01a1778833c27568a07d48acfb Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Thu, 2 Nov 2023 14:19:21 -0600 Subject: [PATCH 1/3] feat(system-update): Allow switching between branches via rebase When a branch file (/etc/ublue-update/branch) exists, read the chosen branch from the file and perform a rebase. Especially useful paired with Steam's branch selection via the Steam Deck UI in Bazzite. Could also be used in other projects to switch between branches being used for development on the fly. --- .../etc/ublue-update.d/system/00-system-update.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/files/etc/ublue-update.d/system/00-system-update.py b/files/etc/ublue-update.d/system/00-system-update.py index 8eedd09..aa44a4b 100755 --- a/files/etc/ublue-update.d/system/00-system-update.py +++ b/files/etc/ublue-update.d/system/00-system-update.py @@ -3,6 +3,8 @@ from subprocess import run from json import loads, load from json.decoder import JSONDecodeError +from pathlib import Path + import os @@ -22,6 +24,18 @@ def check_for_rebase(): print("uBlue image info file does not exist") return False, "" + # Branch away from the default tag when one is set + branch_file = Path("/etc/ublue-update/branch") + if branch_file.exists(): + with branch_file.open() as f: + branch = f.readline() + branch_file.unlink() + if branch: + return ( + True, + f"{default_image_ref[0]}:{default_image_ref[1]}:{default_image_ref[2]}:{branch}", + ) + status_cmd = [ "rpm-ostree", "status", From 5111b0643b146712117de9cae015f79296ee1646 Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Thu, 2 Nov 2023 15:19:31 -0600 Subject: [PATCH 2/3] fix(flake8): Ignore W503 and W504 These are disabled by default. Overriding ignore here re-enabled them. --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 71b8f58..52fc9f9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,4 +23,4 @@ install_requires = [flake8] max-line-length = 90 -ignore = E501 +ignore = E501,W503,W504 From 0ce9e3748e12282ad540ad795afe5ee010a3fdcf Mon Sep 17 00:00:00 2001 From: RJ Trujillo Date: Thu, 2 Nov 2023 16:37:21 -0600 Subject: [PATCH 3/3] chore(system-update): Use /var instead of /etc --- files/etc/ublue-update.d/system/00-system-update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/etc/ublue-update.d/system/00-system-update.py b/files/etc/ublue-update.d/system/00-system-update.py index aa44a4b..eb3e399 100755 --- a/files/etc/ublue-update.d/system/00-system-update.py +++ b/files/etc/ublue-update.d/system/00-system-update.py @@ -25,7 +25,7 @@ def check_for_rebase(): return False, "" # Branch away from the default tag when one is set - branch_file = Path("/etc/ublue-update/branch") + branch_file = Path("/var/ublue-update/branch") if branch_file.exists(): with branch_file.open() as f: branch = f.readline()