-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add osbuild patches for live-artifacts
- Loading branch information
Showing
6 changed files
with
972 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/0001-util-osrelease.py-improve-whitespace-and-quote-strip.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
From 106e632a410e7391e1d667f5aa7062776ed19179 Mon Sep 17 00:00:00 2001 | ||
From: Renata Ravanelli <[email protected]> | ||
Date: Tue, 12 Nov 2024 15:12:52 -0300 | ||
Subject: [PATCH 1/3] util/osrelease.py: improve whitespace and quote stripping | ||
|
||
- Enhanced the value stripping logic in osrelease parsing | ||
to handle leading and trailing spaces, newlines, tabs, | ||
and both single and double quotes. | ||
- This ensures cleaner and more accurate key-value assignments. | ||
|
||
Signed-off-by: Renata Ravanelli <[email protected]> | ||
(cherry picked from commit 066f1ea89fbda6e886a5d88119586c0f09b0a234) | ||
--- | ||
osbuild/util/osrelease.py | 2 +- | ||
1 file changed, 1 insertion(+), 1 deletion(-) | ||
|
||
diff --git a/osbuild/util/osrelease.py b/osbuild/util/osrelease.py | ||
index b8d56e73..a2b61d26 100644 | ||
--- a/osbuild/util/osrelease.py | ||
+++ b/osbuild/util/osrelease.py | ||
@@ -33,7 +33,7 @@ def parse_files(*paths): | ||
if line[0] == "#": | ||
continue | ||
key, value = line.split("=", 1) | ||
- osrelease[key] = value.strip('"') | ||
+ osrelease[key] = value.strip(" \n\t'\"") | ||
|
||
return osrelease | ||
|
||
-- | ||
2.47.0 | ||
|
59 changes: 59 additions & 0 deletions
59
src/0002-util-chroot-Add-support-for-custom-directory-bind-mo.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
From f5f269eb31100c22390d35fd658bdd236a0a880e Mon Sep 17 00:00:00 2001 | ||
From: Renata Ravanelli <[email protected]> | ||
Date: Thu, 31 Oct 2024 14:13:50 -0300 | ||
Subject: [PATCH 2/3] util/chroot: Add support for custom directory bind mounts | ||
|
||
- Add optional bind_mounts parameter to __init__ method; | ||
- Enhanced methods to accept an optional `bind_mounts`. | ||
This allows for more flexible for configurations when setting | ||
up bind mounts. | ||
|
||
Signed-off-by: Renata Ravanelli <[email protected]> | ||
(cherry picked from commit 9b5fbadee6b170455d62c57eb315e20d57173110) | ||
--- | ||
osbuild/util/chroot.py | 14 +++++++++++++- | ||
1 file changed, 13 insertions(+), 1 deletion(-) | ||
|
||
diff --git a/osbuild/util/chroot.py b/osbuild/util/chroot.py | ||
index da14bf44..4090456b 100644 | ||
--- a/osbuild/util/chroot.py | ||
+++ b/osbuild/util/chroot.py | ||
@@ -12,8 +12,9 @@ class Chroot: | ||
This mounts /proc, /dev, and /sys. | ||
""" | ||
|
||
- def __init__(self, root: str): | ||
+ def __init__(self, root: str, bind_mounts=None): | ||
self.root = root | ||
+ self._bind_mounts = bind_mounts or [] | ||
|
||
def __enter__(self): | ||
for d in ["/proc", "/dev", "/sys"]: | ||
@@ -33,6 +34,13 @@ class Chroot: | ||
"sysfs", f"{self.root}/sys"], | ||
check=True) | ||
|
||
+ for d in self._bind_mounts: | ||
+ target_path = os.path.join(self.root, d.lstrip("/")) | ||
+ if not os.path.exists(target_path): | ||
+ print(f"Making missing chroot directory: {d}") | ||
+ os.makedirs(target_path) | ||
+ subprocess.run(["mount", "--rbind", d, target_path], check=True) | ||
+ | ||
return self | ||
|
||
def __exit__(self, exc_type, exc_value, tracebk): | ||
@@ -43,6 +51,10 @@ class Chroot: | ||
if failed_umounts: | ||
print(f"Error unmounting paths from chroot: {failed_umounts}") | ||
|
||
+ for d in self._bind_mounts[::-1]: | ||
+ target_path = os.path.join(self.root, d.lstrip("/")) | ||
+ if subprocess.run(["umount", "--lazy", target_path], check=False).returncode != 0: | ||
+ print(f"Error unmounting paths from chroot: {d}") | ||
def run(self, cmd, **kwargs): | ||
cmd = ["chroot", self.root] + cmd | ||
# pylint: disable=subprocess-run-check | ||
-- | ||
2.47.0 | ||
|
Oops, something went wrong.