-
Notifications
You must be signed in to change notification settings - Fork 344
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
[#5626] feat (gvfs-fuse): Set up a submodule project for the Gvfs-fuse #5627
base: main
Are you sure you want to change the base?
Conversation
clients/gvfs-fuse/build.gradle.kts
Outdated
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.
I think you need use a Gradle for Rust plugin to compile this module, just like client-python.
maybe we can use the Gradle Rust plugin to install Rust compile tools in the temp dir.
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.
I tried some rust plugins. I can't found a good one
suggest to do some auto check like |
clients/gvfs-fuse/check_rust_env.sh
Outdated
exit 1 | ||
fi | ||
|
||
export PATH="$HOME/.cargo/bin:$PATH" |
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.
What if I run this script several times?
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.
If successful, the install branch can be skipped
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.
I'd suggest we don't do this in the script.
Most of the software installer scripts avoid doing this.
It may and may not be desirable for the user.
if ! command -v cargo &> /dev/null; then | ||
echo "Rust is not installed. Installing Rust..." | ||
|
||
if command -v curl &> /dev/null; then | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | ||
elif command -v wget &> /dev/null; then | ||
wget -qO- https://sh.rustup.rs | sh -s -- -y | ||
else | ||
echo "Error: Neither curl nor wget is available. Please install one of them to proceed." | ||
exit 1 | ||
fi | ||
|
||
export PATH="$HOME/.cargo/bin:$PATH" | ||
if command -v cargo &> /dev/null; then | ||
echo "Rust has been installed successfully." | ||
else | ||
echo "Error: Rust installation failed. Please check your setup." | ||
exit 1 | ||
fi | ||
else | ||
echo "Rust is already installed: $(cargo --version)" | ||
fi |
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.
I'd do this to 1) return early if possible 2) save some of the nested if- tests.
if command -v cargo &> /dev/null; then
echo "Rust is already installed: $(cargo --version)"
exit 0
fi
echo "Rust is not installed. Installing Rust..."
# the rest of the install and check
# ...
if ! command -v cargo &> /dev/null; then
echo "Error: Rust installation failed. Please check your setup."
exit 1
fi
echo "Rust has been installed successfully."
exit 0
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.
The cargo
command does not run after running the rust installation command. Unless you set the PATH
environment variable or restart the bash session.
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.
well ... we are assuming that cargo is installed in a specific directory, i.e. $HOME/.cargo/bin
, any way...
The only difference is that we manually invoke the binary (with full path) or let the "polluted" shell to find it. Right?
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.
Yes, the cargo
install script will add logic to modify the PATH
inn the .profile. If we restart the shell session, it will automatically add this environment variable.
Is modifying the PATH not allowed?
@FANNG1 can you please help to review? |
path = "src/main.rs" | ||
|
||
[dependencies] | ||
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } |
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.
please replace the package according to the alphabetical order
[package] | ||
name = "filesystem-fuse" | ||
version = "0.8.0-incubating-SNAPSHOT" | ||
edition = "2021" |
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.
What is the usage of this "edition", shall we remove this?
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.
The version specify the minimum Rust compiler version required for this project.
|
||
set -e | ||
|
||
if ! command -v cargo &> /dev/null; then |
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.
Instead of installing rust env automaticlly, I suggest to provide a separate tool to setup dev environments manually.
If there is no rust env in the machine, don't build it
suggest adding basic check for code style and common errors in ci
|
name = "filesystem-fuse" | ||
version = "0.8.0-incubating-SNAPSHOT" | ||
edition = "2021" | ||
rust-version = "1.75" |
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.
also add homepage, repository, license ?
path = "src/main.rs" | ||
|
||
[dependencies] | ||
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] } |
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.
There are many fuse implement in RUST, why you choose fuse3?
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.
seems fuser is more popular
# under the License. | ||
|
||
[package] | ||
name = "filesystem-fuse" |
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.
Do we plan to publish our lib to crates? If yes, maybe use a more meaningful name and add gravitino to the name?
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.
We may probably push the lib in future, but for now we don't have such requirement.
@FANNG1 can you please help to review again? If there's no blocking issue, I think we can improve the building command in the following PRs, what do you think? |
Seems there're some basic issues to be addressed,
|
What changes were proposed in this pull request?
Set up a submodule project for the Gvfs-fuse, layout the rust module environment for gvfs-fuse
Why are the changes needed?
Fix: #5626
Does this PR introduce any user-facing change?
No
How was this patch tested?
No