{common} Commonize logic in a single script#1634
Conversation
…litate maintenance Signed-off-by: okjesus <1612729+okjesus@users.noreply.github.com>
|
Hi @okjesus, Thanks for the contribution. I appreciate the help. I notice that the commit doesn't follow the Developer Certificate of Origin. It would be important to identify who is making the contribution. You can find a link to the DCO in https://github.com/ros/meta-ros/blob/master/CONTRIBUTING.md It appears as if this contribution may have been generated with generative AI. I am open to accepting those contributions, but we would need to follow the policies of both OSRF and the Linux Foundation:
This would be the first submission using GenAI, so it may take a few revisions before we are comfortable to merge it. The scripts themselves don't change very frequently. Creating a common include file would help prevent them from diverging. However, I'm not able to see what problem this solves. Can you provide an explanation of how you came upon this problem and what this solves? Thanks, |
|
Thank you very much @robwoolley for the feedback!
I thought I complied with the DCO since the commit message contains the
I can guarantee you that Gen AI was not used to produce this code. Even the examples were typed by me; and the style may divulge that I am not a native English speaker.
I agree that they don't change very frequently but it doesn't mean there is nothing we can improve.
Overall in terms of programming this check the following boxes:
I believe those are good programming practices that are good to implement whenever we can (of course there are exceptions). Finally, it all started because of this comment: # Keep this block in sync with the one in ros-generate-recipes.sh .What better way to keep those instructions in sync than to create functions? To be totally transparent, this is not even the problem I wanted to solve in the first place.
The parsing of the recipes failed, so I wanted to fix it. But after seeing that those where generated, I checked the script used to generate them (at least this is what I believe at the moment) and ended up seeing the comment # Keep this block in sync with the one in ros-generate-recipes.sh .and thought And to avoid forgetting about that, I created the PR and continued to check the I don't mind if the PR gets rejected if it doesn't comply with the rules established by the community, I don't want to be disruptive. Please let me know if you see any issue in the explanation above. Sorry again for the inconvenience 🙇 . |
Reason for changes
1) Keep this block in sync
In
ros-generate-cache.shandros-generate-recipes.sh, some instructions were identical with instructions to keep them in sync like the one below:# Keep this block in sync with the one in ros-generate-recipes.sh .This commit brings those instructions into a single
ros-generate-common.shscript included in both scripts.Benefit(s):
2)
SCRIPT_NAMESCRIPT_NAMEwas set in bothros-generate-cache.shandros-generate-recipes.shwith the respective name of the script.This commit assign
SCRIPT_NAMEdynamically.Benefit(s):
SCRIPT_NAME.