Feature request: Support non-binary AUR package using crates.io as source #12

Open
opened 2026-03-01 09:11:03 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @nick42d on GitHub (Aug 3, 2024).

G'day,

Thanks for the crate!

I was wondering if you'd be open to the option of supporting crates.io as a source (e.g https://wiki.archlinux.org/title/Rust_package_guidelines#Source). In this case, I wouldn't need a binary build, I'd just be using cargo-aur to generate the PKGBUILD.

Let me know your thoughts on this, I'd be happy to have a go at contributing.

Originally created by @nick42d on GitHub (Aug 3, 2024). G'day, Thanks for the crate! I was wondering if you'd be open to the option of supporting crates.io as a source (e.g https://wiki.archlinux.org/title/Rust_package_guidelines#Source). In this case, I wouldn't need a binary build, I'd just be using cargo-aur to generate the PKGBUILD. Let me know your thoughts on this, I'd be happy to have a go at contributing.
Author
Owner

@fosskers commented on GitHub (Aug 3, 2024):

This is a good idea. Let's move forward with it.

The current default is to produce a -bin package after compiling everything, so we'd either have to:

  • Add a new flag to do what you're suggesting
  • Change the default behaviour to do what you're suggesting, and have the -bin behaviour behind a flag (a breaking change).
  • Completely overhaul the CLI to give no preference to one style or the other (e.g. cargo aur bin, cargo aur ?) (also a breaking change)
@fosskers commented on GitHub (Aug 3, 2024): This is a good idea. Let's move forward with it. The current default is to produce a `-bin` package after compiling everything, so we'd either have to: - Add a new flag to do what you're suggesting - Change the default behaviour to do what you're suggesting, and have the `-bin` behaviour behind a flag (a breaking change). - Completely overhaul the CLI to give no preference to one style or the other (e.g. `cargo aur bin`, `cargo aur ?`) (also a breaking change)
Author
Owner

@nick42d commented on GitHub (Aug 3, 2024):

I see what you mean about the commands. I see no need to change the existing defaults from what you've set, am happy for this to be a new flag. In terms of an overhall, this could also be a good opportunity to upgrade to clap from gumdrop. Guessing this is possible without a breaking change to the flags.

@nick42d commented on GitHub (Aug 3, 2024): I see what you mean about the commands. I see no need to change the existing defaults from what you've set, am happy for this to be a new flag. In terms of an overhall, this could also be a good opportunity to upgrade to `clap` from `gumdrop`. Guessing this is possible without a breaking change to the flags.
Author
Owner

@fosskers commented on GitHub (Aug 4, 2024):

Now then: what should the new flag be callled? Off the top of my head:

  • --plain
  • --source
  • --from-crate
  • --no-bin
@fosskers commented on GitHub (Aug 4, 2024): Now then: what should the new flag be callled? Off the top of my head: - `--plain` - `--source` - `--from-crate` - `--no-bin`
Author
Owner

@nick42d commented on GitHub (Aug 5, 2024):

Took some time to think about this. Combining the two suggestions of --source and --no-bin, we could do;

New flag --source [SourceType] where [SourceType] is project or crates-io. (Default: project = current behaviour)

  • This flag would determine where the source code is sourced from.

New flag --no-bin. (Default: false = current behaviour)

  • This flag prevents binary build and creates a PKGBUILD that builds from a tarball.

This would allow two new combination --source crates-io which would pull the crates.io version and build it into a binary, --source project --no-bin which would publish based off a github/gitlab tarball. This would also allow for different --source options in future e.g url if we are hosting somewhere other than github/gitlab.

I also wanted to note that to calculate the checksums for the crates.io build, we'll need to actually download the crate. Do you have a preference on how this is implemented, we could use curl, makepkg itself but it's a bit awkward since it needs a pkgbuild first, or a rust library like libcurl or reqwest.

@nick42d commented on GitHub (Aug 5, 2024): Took some time to think about this. Combining the two suggestions of --source and --no-bin, we could do; New flag `--source [SourceType]` where `[SourceType]` is `project` or `crates-io`. (Default: project = current behaviour) - This flag would determine where the source code is sourced from. New flag `--no-bin`. (Default: false = current behaviour) - This flag prevents binary build and creates a PKGBUILD that builds from a tarball. This would allow two new combination `--source crates-io` which would pull the crates.io version and build it into a binary, `--source project --no-bin` which would publish based off a github/gitlab tarball. This would also allow for different `--source` options in future e.g `url` if we are hosting somewhere other than github/gitlab. I also wanted to note that to calculate the checksums for the crates.io build, we'll need to actually download the crate. Do you have a preference on how this is implemented, we could use curl, makepkg itself but it's a bit awkward since it needs a pkgbuild first, or a rust library like libcurl or reqwest.
Author
Owner

@fosskers commented on GitHub (Aug 6, 2024):

These are good suggestions. Let's move forward with both of them.

I also wanted to note that to calculate the checksums for the crates.io build, we'll need to actually download the crate. Do you have a preference on how this is implemented

Let's be a good Unix tool and just call curl (or wget) via Rust's Command type. That will minimize Rust dependencies within cargo-aur itself.

@fosskers commented on GitHub (Aug 6, 2024): These are good suggestions. Let's move forward with both of them. > I also wanted to note that to calculate the checksums for the crates.io build, we'll need to actually download the crate. Do you have a preference on how this is implemented Let's be a good Unix tool and just call `curl` (or `wget`) via Rust's `Command` type. That will minimize Rust dependencies within `cargo-aur` itself.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cargo-aur#12