From 737dab1a8d7d1d667f92f1572d47ab3776a30cdb Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 2 Jan 2023 14:52:49 +0100 Subject: [PATCH 1/2] ukify: Handle directories in path_is_readable() --- src/ukify/ukify.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index ad2f8a2c71..e1ee7106c1 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -69,7 +69,10 @@ def path_is_readable(s: str | None) -> pathlib.Path | None: if s is None: return None p = pathlib.Path(s) - p.open().close() + try: + p.open().close() + except IsADirectoryError: + pass return p From 4f312ba07bdd4816629b20f84ba8c8946cc54c61 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Mon, 2 Jan 2023 14:53:47 +0100 Subject: [PATCH 2/2] ukify: Require specifying --tools for each tools directory Instead of consuming N arguments as tools directories, let's always only consume one argument per specification of --tools. This avoids issues where the linux image and initrd are interpreted as tools directories. --- src/ukify/ukify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py index e1ee7106c1..2493de2a40 100755 --- a/src/ukify/ukify.py +++ b/src/ukify/ukify.py @@ -687,7 +687,7 @@ usage: ukify [options…] linux initrd… p.add_argument('--tools', type=pathlib.Path, - nargs='+', + action='append', help='Directories to search for tools (systemd-measure, llvm-objcopy, ...)') p.add_argument('--output', '-o',