Miscellaneous fixes from reviewing package-maintainer-docs/pull-request/53 which imported a new version of this template to package-maintainer-docs. See individual commits for fix descriptions. Has some overlap with #19, feel free to mix and match.
5 new commits added
Use `version: ~` in antora.yml
Fix intendation in build.sh error branch
Fix the Linux docker branch of build.sh
Replace deprecated backticks with supported $()
Fix quotes in build.sh
This looks great. I've rebased my changes on top of yours in https://pagure.io/fedora-docs/template/pull-request/19. I think we should merge this one and then mine.
Looks good, and I've only one comment: The use of a null value (~) for version has some side effects on the UI. The version key is currently used in the component version selector (that thing at the bottom of the left panel), and doesn't look great for unversioned components (see https://phunk.me/K8BYGY.png) In this example, the first component is using ~, and the second : master.
~
version
master
One way to fix this is to modify our UI theme to use the display_version key instead, which conveniently fallback to default if version has a null value (see https://phunk.me/BV0JPV.png)
display_version
default
The quoting on line 9 of build.sh doesn't look right to me.
Why so? It works correctly for all output of $(uname -s) I can think of. (But I was testing with $(echo foo bar) and such, to generate test cases.)
$(uname -s)
$(echo foo bar)
Probably this change could be dropped with no harm, the inner quotes only help if uname -s returns a string with inner whitespace:
uname -s
This works:
$ if [ "$(expr substr "$(echo Linux with suffix)" 1 5)" == "Linux" ]; then echo "hit"; fi hit
This does not:
$ if [ "$(expr substr $(echo Linux with suffix) 1 5)" == "Linux" ]; then echo "hit"; fi expr: syntax error: unexpected argument ”1”
Looks good, and I've only one comment: The use of a null value (~) for version has some side effects on the UI. The version key is currently used in the component version selector (that thing at the bottom of the left panel), and doesn't look great for unversioned components (see https://phunk.me/K8BYGY.png) In this example, the first component is using ~, and the second : master. One way to fix this is to modify our UI theme to use the display_version key instead, which conveniently fallback to default if version has a null value (see https://phunk.me/BV0JPV.png)
Thank you for noticing this, I was completetly unaware of this issue. What do you suggest? Just applying your suggested fix to the UI theme, or leaving version: master for now?
version: master
I tried to go and submit a pull request to the UI theme myself, but I have problems working with that repository.
Maybe we can rename master to main for now and fix the theme after.
main
It is just that $(uname -s) is technically unquoted and something clever could still cause problems. For example:
if [ "$(expr substr "$(echo O'Linux with suffix)" 1 5)" == "Linux" ]; then echo matched; fi
That said, I cannot really imagine uname returning something that would cause problems.
My personal preference would have been to use grep instead of test and expr. That is:
if echo "O'Linux with suffix" | grep -q -i ^linux; then echo matched; fi
In this specific case, that would be:
if uname -s | grep -q -i ^linux; then echo matched; fi
Just my 2¢.
I would be more inclined to just leave it as it is, and limit the number of changes we would have to make to all sub repos. master is still a valid (but deprecated) value in 3.0.0, so I don't think we need to rush it. I'll make a PR on the UI repo and see if we can get it merged before this one.
edit: https://pagure.io/fedora-docs/fedora-docs-ui/pull-request/55
rebased onto e43e08ab20c541459f176b17b51cf4d29873c3ef
It is just that $(uname -s) is technically unquoted and something clever could still cause problems. For example: if [ "$(expr substr "$(echo O'Linux with suffix)" 1 5)" == "Linux" ]; then echo matched; fi That said, I cannot really imagine uname returning something that would cause problems. My personal preference would have been to use grep instead of test and expr. That is: if echo "O'Linux with suffix" | grep -q -i ^linux; then echo matched; fi In this specific case, that would be: if uname -s | grep -q -i ^linux; then echo matched; fi Just my 2¢.
Agreed, even the original one was probably good for all cases that can be encountered. But, since we started with this, I went ahead and changed all the if [ $(uname) == "Something" ]'s to use pipe and grep.
if [ $(uname) == "Something" ]
I'll make a PR on the UI repo and see if we can get it merged before this one. edit: https://pagure.io/fedora-docs/fedora-docs-ui/pull-request/55
I'll make a PR on the UI repo and see if we can get it merged before this one.
PR has been merged, deployed on staging environment, and soon to be on prod. It's all good on my side :thumbsup:
Pull-Request has been merged by darknao
Thank you everybody!
Miscellaneous fixes from reviewing package-maintainer-docs/pull-request/53
which imported a new version of this template to package-maintainer-docs.
See individual commits for fix descriptions.
Has some overlap with #19, feel free to mix and match.