ukify: Allow passing multiple directories to --tools

This commit is contained in:
Daan De Meyer 2022-12-19 15:36:07 +01:00
parent 9c29d87bee
commit 22ad038ac6
2 changed files with 10 additions and 8 deletions

View file

@ -221,11 +221,11 @@
</varlistentry>
<varlistentry>
<term><option>--tools=<replaceable>DIR</replaceable></option></term>
<term><option>--tools=<replaceable>DIRS</replaceable></option></term>
<listitem><para>Specify a directory with helper tools. <command>ukify</command> will look for helper
tools in that directory first, and if not found, try to load them from <varname>$PATH</varname> in
the usual fashion.</para></listitem>
<listitem><para>Specify one or more directories with helper tools. <command>ukify</command> will look
for helper tools in those directories first, and if not found, try to load them from
<varname>$PATH</varname> in the usual fashion.</para></listitem>
</varlistentry>
<varlistentry>

View file

@ -321,9 +321,10 @@ def check_inputs(opts):
def find_tool(name, fallback=None, opts=None):
if opts and opts.tools:
tool = opts.tools / name
if tool.exists():
return tool
for d in opts.tools:
tool = d / name
if tool.exists():
return tool
return fallback or name
@ -656,7 +657,8 @@ usage: ukify [options…] linux initrd…
p.add_argument('--tools',
type=pathlib.Path,
help='a directory with systemd-measure and other tools')
nargs='+',
help='Directories to search for tools (systemd-measure, llvm-objcopy, ...)')
p.add_argument('--output', '-o',
type=pathlib.Path,