Skip to content
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

clippy: make the cargo wrapper work in bash #171

Merged
merged 1 commit into from
Jun 3, 2024
Merged

Conversation

kdudka
Copy link
Member

@kdudka kdudka commented Jun 3, 2024

It turned out that the last change was not properly tested.
The previously used syntax is not recognized by bash:

[...]
cd ./librsvg && \
PKG_CONFIG_ALLOW_CROSS=1 \
PKG_CONFIG='/usr/bin/pkg-config' \
CARGO_TARGET_DIR=/builddir/build/BUILD/librsvg-2.50.7/target \
cargo --locked build --verbose  --release \
&& cd /builddir/build/BUILD/librsvg-2.50.7 && /bin/sh ./libtool  --tag=CC   --mode=link gcc  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=forma
/usr/bin/cargo: line 5: ${@[i]}: bad substitution
[...]

This commit fixes it. Moreover, the invocation of cargo_original was
wrong because the wrapper path was passed as the first command-line arg
by mistake:

[...]
cd ./librsvg &&                     \
PKG_CONFIG_ALLOW_CROSS=1                        \
PKG_CONFIG='/usr/bin/x86_64-redhat-linux-gnu-pkg-config'                        \
CARGO_TARGET_DIR=/builddir/build/BUILD/librsvg-2.50.7/target                    \
cargo --locked build --verbose  --release \
&& cd /builddir/build/BUILD/librsvg-2.50.7 && /bin/sh ./libtool  --tag=CC   --mode=link gcc  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=forma
+ /usr/bin/cargo_original /usr/bin/cargo --locked clippy --verbose --release --message-format=json
error: running `/usr/bin/cargo` requires `-Zscript`
+ break
+ exec /usr/bin/cargo_original --locked build --verbose --release
[...]

Related: https://issues.redhat.com/browse/OSH-30

@kdudka kdudka requested review from hanchuntao and lzaoral June 3, 2024 13:32
@kdudka kdudka self-assigned this Jun 3, 2024
@kdudka kdudka marked this pull request as draft June 3, 2024 13:38
It turned out that the last change was not properly tested.
The previously used syntax is not recognized by bash:
```
[...]
cd ./librsvg && \
PKG_CONFIG_ALLOW_CROSS=1 \
PKG_CONFIG='/usr/bin/pkg-config' \
CARGO_TARGET_DIR=/builddir/build/BUILD/librsvg-2.50.7/target \
cargo --locked build --verbose  --release \
&& cd /builddir/build/BUILD/librsvg-2.50.7 && /bin/sh ./libtool  --tag=CC   --mode=link gcc  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection  -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -o librsvg_c_api.la _rsvg_dummy.lo && mv /builddir/build/BUILD/librsvg-2.50.7/target/release/librsvg_c_api.a .libs/librsvg_c_api.a
/usr/bin/cargo: line 5: ${@[i]}: bad substitution
[...]
```

This commit fixes it.  Moreover, the invocation of `cargo_original` was
wrong because the wrapper path was passed as the first command-line arg
by mistake:
```
[...]
cd ./librsvg &&                     \
PKG_CONFIG_ALLOW_CROSS=1                        \
PKG_CONFIG='/usr/bin/x86_64-redhat-linux-gnu-pkg-config'                        \
CARGO_TARGET_DIR=/builddir/build/BUILD/librsvg-2.50.7/target                    \
cargo --locked build --verbose  --release \
&& cd /builddir/build/BUILD/librsvg-2.50.7 && /bin/sh ./libtool  --tag=CC   --mode=link gcc  -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=forma
+ /usr/bin/cargo_original /usr/bin/cargo --locked clippy --verbose --release --message-format=json
error: running `/usr/bin/cargo` requires `-Zscript`
+ break
+ exec /usr/bin/cargo_original --locked build --verbose --release
[...]
```

Related: https://issues.redhat.com/browse/OSH-30
@kdudka kdudka marked this pull request as ready for review June 3, 2024 13:55
@kdudka kdudka requested a review from lzaoral June 3, 2024 14:06
@kdudka kdudka merged commit a059ab9 into csutils:main Jun 3, 2024
34 of 36 checks passed
@kdudka kdudka deleted the clippy branch June 3, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants