Skip to content

Commit

Permalink
intermediate: support colon seperated tool paths
Browse files Browse the repository at this point in the history
Make it possible to define tools with more than one directory containing
executables by handling colons in path as separator.
  • Loading branch information
rhubert committed Nov 23, 2023
1 parent 8f7a9eb commit 4852d33
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 6 deletions.
9 changes: 5 additions & 4 deletions doc/manual/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1619,10 +1619,11 @@ consuming recipes. Example::
fingerprintScript: |
bob-libc-version gcc

The ``path`` attribute is always needed. The ``libs`` attribute, if present,
must be a list of paths to needed shared libraries. Any path that is specified
must be relative. If the recipe makes use of existing host binaries and wants
to provide them as tool you should create symlinks to the host paths.
The ``path`` attribute is always needed. It might be a single path or a colon
separated list of paths. The ``libs`` attribute, if present, must be a list of
paths to needed shared libraries. Any path that is specified must be relative.
If the recipe makes use of existing host binaries and wants to provide them as
tool you should create symlinks to the host paths.

The ``netAccess`` attribute allows the tool to request network access during
build/package step execution even if the recipe has not requested it (see
Expand Down
4 changes: 2 additions & 2 deletions pym/bob/intermediate.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ def getPaths(self):
The returned list is intended to be passed as PATH environment variable.
The paths are sorted by name.
"""
return sorted([ os.path.join(tool.getStep().getExecPath(self), tool.getPath())
for tool in self.getTools().values() ])
return sorted([ os.path.join(tool.getStep().getExecPath(self), p)
for tool in self.getTools().values() for p in tool.getPath().split(':') ])

def getLibraryPaths(self):
"""Get sorted list of library paths of used tools.
Expand Down
10 changes: 10 additions & 0 deletions test/black-box/tools-paths/recipes/root.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root: True

depends:
- name: tools
use: [tools]

packageTools: [foo_bar]
packageScript: |
foo.sh
bar.sh
16 changes: 16 additions & 0 deletions test/black-box/tools-paths/recipes/tools.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
packageScript: |
mkdir -p foo bar
for i in foo bar; do
pushd $i
cat > $i.sh << EOF
#!/bin/bash
echo "Hello $i"
EOF
chmod +x $i.sh
popd
done
provideTools:
foo_bar:
path: "foo:bar"

6 changes: 6 additions & 0 deletions test/black-box/tools-paths/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -e
. ../../test-lib.sh 2>/dev/null || { echo "Must run in script directory!" ; exit 1 ; }

# Tests the different aspects of tool remapping for dependencies.

exec_blackbox_test

0 comments on commit 4852d33

Please sign in to comment.