Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions classes/cargo_bin.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ cargo_bin_do_install() {
if [ -d "$tgt" ]; then
for example in "$tgt/"*; do
if [ -f "$example" ] && [ -x "$example" ]; then
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! It'd be simpler and clearer to exclude those files with a bash regex match instead:

Suggested change
if [ -f "$example" ] && [ -x "$example" ]; then
if [[ -f "$example" && -x "$example" && ! "$example" =~ '-[[:xdigit:]]{16}$' ]]; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! I'll revise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i did some experimenting with your change here, and unfortunately it did not filter as i expected. Looking through the documentation i found this:
https://docs.yoctoproject.org/bitbake/2.4/bitbake-user-manual/bitbake-user-manual-metadata.html#shell-functions
that section includes the sentence You should not use Bash-specific script (bashisms).

I do agree that this should be simplified, and i'm exploring some other options

install -d "${CARGO_INSTALL_DIR}"
install -m755 "$example" "${CARGO_INSTALL_DIR}"
files_installed="$files_installed $example"
# check if this is a suffixed-file from cargo
shortername=${example%%-[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]}
if [ "$shortername" = "$example" ]
then
install -d "${CARGO_INSTALL_DIR}"
install -m755 "$example" "${CARGO_INSTALL_DIR}"
files_installed="$files_installed $example"
fi
fi
done
fi
Expand Down