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

[#5626] feat (gvfs-fuse): Set up a submodule project for the Gvfs-fuse #5627

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

diqiu50
Copy link
Contributor

@diqiu50 diqiu50 commented Nov 20, 2024

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

settings.gradle.kts Outdated Show resolved Hide resolved
Copy link
Member

@xunliu xunliu Nov 20, 2024

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.

Copy link
Contributor Author

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

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 20, 2024

suggest to do some auto check like cargo-machete cargo-sort cargo clippy cargo fmt, you could refer https://github.com/apache/iceberg-rust/blob/main/.github/workflows/ci.yml#L55-L68

exit 1
fi

export PATH="$HOME/.cargo/bin:$PATH"
Copy link

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?

Copy link
Contributor Author

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

Copy link

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.

clients/gvfs-fuse/check_rust_env.sh Outdated Show resolved Hide resolved
clients/gvfs-fuse/build.gradle.kts Outdated Show resolved Hide resolved
Comment on lines +24 to +45
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
Copy link

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

Copy link
Contributor Author

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.

Copy link

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?

Copy link
Contributor Author

@diqiu50 diqiu50 Nov 22, 2024

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?

@jerryshao
Copy link
Contributor

@FANNG1 can you please help to review?

path = "src/main.rs"

[dependencies]
fuse3 = { version = "0.8.1", "features" = ["tokio-runtime", "unprivileged"] }
Copy link
Contributor

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 21, 2024

suggest adding basic check for code style and common errors in ci

        cargo  fmt --all -- --check
        cargo  clippy --all-targets --all-features --workspace -- -D warnings

name = "filesystem-fuse"
version = "0.8.0-incubating-SNAPSHOT"
edition = "2021"
rust-version = "1.75"
Copy link
Contributor

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"] }
Copy link
Contributor

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?

Copy link
Contributor

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"
Copy link
Contributor

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?

Copy link
Contributor

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.

@jerryshao
Copy link
Contributor

@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?

@FANNG1
Copy link
Contributor

FANNG1 commented Nov 23, 2024

@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,

  1. Whether to build fuse-rust by default, I prefer not, because it's difficult for most persons.
  2. To enable code style and clippy check, I'm ok to add the check in this or next PR.
  3. Which rust fuse lib should we choose, if we doesn't have an answer for now, I prefer to remove the current fuse depedences.

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.

[Subtask] [gvfs-fuse] Set up a submodule project for the Gvfs-fuse.
6 participants