swap order of cp in buildroot/bin/build_example #27386
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Since fe56f5d#diff-ba8daaa49132ee3b4bb63ec9a5d62bd56649e76a0bf90c24e8dbed8219bace15 the script build_all_examples has been 'faking it'.
The change in buildroot/bin/build_example was innocent looking enough
was replaced with
But on running the updated code you got weird results for eg:
This is wrong. This example has BOARD_ANET_ET4 which is a env:Anet_ET4_no_bootloader
Digging into this I removed the redirecting of error to null and was presented with this error
Ie you cannot use it in one line like that
So what it is really doing is: It copies the
$BASE/config/default"/*.h
but since its on the same command it refuses to copy over"$SUB"/*.h
as its the same files names.This results in the build_all_examples script building the default config over and over while telling you its building the example configs.
So I purpose we simply swap the two operators
cp "$SUB"/*.h "$BASE/config/default"/*.h Marlin/ 2>/dev/null
So now it will copy the new configs over and only if a file is missing will it copy over the default file.
Note: I do not know if this will work on all OS's implementing bash.
This change was tested and found to work as desired on Ubuntu 24.04.1 LTS
Other operating systems may need another option like simply having two lines.
Requirements
Marlin
Benefits
build_all_examples script works as expected
Configurations
All example configs.
Related Issues
fe56f5d#diff-ba8daaa49132ee3b4bb63ec9a5d62bd56649e76a0bf90c24e8dbed8219bace15