Skip to content

Make dependencies.py generate fail on cargo-deny error - #1366

Merged
kevinjqliu merged 2 commits into
apache:mainfrom
kevinjqliu:kevinjqliu/show-script-error
May 22, 2025
Merged

kevinjqliu merged 2 commits into
apache:mainfrom
kevinjqliu:kevinjqliu/show-script-error

Conversation

@kevinjqliu

@kevinjqliu kevinjqliu commented May 22, 2025 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

What changes are included in this PR?

DEPENDENCIES.rust.tsv files were accidentally removed as part of the 0.5.0 prep PR (#1345). It was added back and updated in the follow up PR (#1363).

I realized this happened because I did not install cargo-deny in my env and the dependency generation script did not error.

This PR changes generation script (python3 ./scripts/dependencies.py generate) to error when the underlying subprocess call (cargo deny) errors.

I also ran uvx ruff format scripts/dependencies.py to format the script

Are these changes tested?

Yes, manually

I was also able to install cargo-deny and confirm #1363 changes are all correct

cargo install --locked cargo-deny

@kevinjqliu kevinjqliu changed the title Kevinjqliu/show script error Make dependencies.py generate fail on cargo-deny error May 22, 2025
@kevinjqliu
kevinjqliu requested review from Fokko and liurenjie1024 May 22, 2025 04:03
Comment thread scripts/dependencies.py
Comment on lines +25 to +31
"crates/catalog/glue",
"crates/catalog/hms",
"crates/catalog/memory",
"crates/catalog/rest",
"crates/catalog/sql",

"crates/integrations/datafusion",

"bindings/python"
"bindings/python",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could use following codes to list all dirs:

cargo metadata --no-deps --format-version 1 | jq -r '.packages[] | .manifest_path | rtrimstr("/Cargo.toml")'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May we just need to call cargo metadata --no-deps --format-version 1 and process left parts with python.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was considering cargo metadata and find . -name Cargo.toml -exec dirname {} \; but landed with the python solution. cargo metadata skips the python binding subdir, find and the python solution is more future proof

LMK what you think!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually i prefer this PR as is right now and moved the change to #1370 since we need to regenerate the license after adding the new directories

@Fokko Fokko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kevinjqliu
kevinjqliu merged commit 6797654 into apache:main May 22, 2025
@kevinjqliu
kevinjqliu deleted the kevinjqliu/show-script-error branch May 22, 2025 21:54
kevinjqliu added a commit that referenced this pull request May 22, 2025
…1370)

## Which issue does this PR close?

<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->

- Depends on #1366

## What changes are included in this PR?

<!--
Provide a summary of the modifications in this PR. List the main changes
such as new features, bug fixes, refactoring, or any other updates.
-->
Instead of hardcoding a few repos to check in `dependencies.py`, lets
walk down all subdirectories and get all with `Cargo.toml` file. This is
more future proof in case we add new crates.

We also need to regenerate license for 0.5.0 
```
python3 ../scripts/dependencies.py check
python3 ../scripts/dependencies.py generate
```
which added 7 new files:
```
crates/catalog/s3tables/DEPENDENCIES.rust.tsv
crates/examples/DEPENDENCIES.rust.tsv
crates/integration_tests/DEPENDENCIES.rust.tsv
crates/integrations/cache-moka/DEPENDENCIES.rust.tsv
crates/integrations/cli/DEPENDENCIES.rust.tsv
crates/sqllogictest/DEPENDENCIES.rust.tsv
crates/test_utils/DEPENDENCIES.rust.tsv
```

## Are these changes tested?

<!--
Specify what test covers (unit test, integration test, etc.).

If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
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.

3 participants