-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build scripts: Use file name for grep directly #2397
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, micro-optimizations. :)
Meta: Both the PR title and the commit title could use some context in order for git log --oneline
to be any useful. A shortened file name might do? build scripts: Use file name for grep directly
f895363
to
d89e327
Compare
Code Style: Do not use cat | grep due to performance reasons: https://bencane.com/2013/08/19/grepping-a-file-without-using-cat-and-grep-other-tricks/ Found by Codacy
d89e327
to
3a63033
Compare
Changed some more in mac/deploy_mac.sh and changed the commit name too |
s) | ||
cert_name=$OPTARG | ||
if [[ -z "$cert_name" ]]; then | ||
echo "Please add the name of the certificate to use: -s \"<name>\"" | ||
fi | ||
# shift 2 | ||
;; | ||
h) | ||
echo "Usage: -s <cert name> for signing mac build" | ||
exit 0 | ||
h) | ||
echo "Usage: -s <cert name> for signing mac build" | ||
exit 0 | ||
;; | ||
*) | ||
exit 1 | ||
;; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When working on style in this script anyway, then I'll add this here as well: ;)
I'd indent like described in this style guide (but with 4 spaces instead of 2, similar to what we do for if/while etc.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fancy automating it?
https://github.com/lovesegfault/beautysh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means there will be some border cases this Python program won't be able to process. But in tests with large Linux system Bash scripts, its error-free score was ~99%.
Still sounds scary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concerning indentation: I think this should be in #2402
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's now in the mentioned PR anyway (as own commit)
Should be merged after upcoming release |
@@ -73,7 +73,7 @@ build_installer_image() | |||
local dmgbuild_bin="$(python -c 'import site; print(site.USER_BASE)')/bin/dmgbuild" | |||
|
|||
# Get Jamulus version | |||
local app_version="$(cat "${project_path}" | sed -nE 's/^VERSION *= *(.*)$/\1/p')" | |||
local app_version="$(grep -oP 'VERSION = \K\w[^\s\\]*' Jamulus.pro)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change from sed -nE
to grep -oP
breaks on Mac. See https://github.com/jamulussoftware/jamulus/runs/5247842643?check_suite_focus=true#step:6:1652
I've filed #2421 to fix this.
CHANGELOG: Build: Improve grep usage in scripts #2421 |
Really sorry that you needed to fix my PRs @hoffie but thanks for finding the bugs. |
Short description of changes
Code Style: Do not use cat | grep due to performance reasons: https://bencane.com/2013/08/19/grepping-a-file-without-using-cat-and-grep-other-tricks/
Found by Codacy
Context: Fixes an issue?
No. Just code style
Does this change need documentation? What needs to be documented and how?
No
Status of this Pull Request
Waiting on CI
What is missing until this pull request can be merged?
Reviewing.
Checklist