On Wed, 05 Mar 2025 18:26:53 +0800,
Efraim Flashner wrote:
>
> [1  <text/plain; utf-8 (quoted-printable)>]
> On Wed, Mar 05, 2025 at 01:07:46AM +0800, Hilton Chain wrote:
> > On Thu, 27 Feb 2025 22:26:59 +0800,
> > Hilton Chain wrote:
> > >
> > > Cargo workspace support!
> > >
> > > https://git.boiledscript.com/hako/guix/commits/branch/cargo
> >
> > I have continued to experiment on this branch (now based on rust-team), with
> > following changes:
> >
> > - Removed git checkout support for the importer, instead a warning of 
> > missing
> >   dependency is printed.
> >
> >   These dependencies are really rare.  They are likely to be Cargo 
> > workspaces
> >   and should be packaged separately.
> >
> >   Since these dependencies will be packaged, directory support for the build
> >   system is removed too.
>
> Does this part affect packaging git checkouts? We do that with some of
> the packages built using the cargo-build-system.

By removing support I meant removing my modification to the build system, so the
original support won't be lost :)

> > - For crates with a "src" "sys" suffix, importer adds TODO comments to their
> >   definitions.
>
> Yay! That'll probably catch almost all of them. Oh, there's also the
> rust-windows-<arch>-<compiler> packages.
>
> > - Phase 'check-for-pregenerated-files moved after 'configure, since most
> >   dependencies are origins and unpacked in configure phase.
> >
> >   Additionally the following command is invoked to print out all non-empty
> >   binary files under current directory:
> >   --8<---------------cut here---------------start------------->8---
> >   find . -type f ! -size 0 -exec grep -IL . {} ;
> >   --8<---------------cut here---------------end--------------->8---
> >   This command is pretty helpful, but doesn't perform well :(
> >   Quite a few seconds are added to the build time.
>
> This makes sense, since before we were checking each source
> individually, and now we're checking them as a group.
>
> Are all the binary files you've been finding executable? find has an
> '--executable' option.  I guess that wouldn't work for static libraries.

I want to filter out all binary files (not only exectuables) for more confidence
so unfortunately only ‘find’ can't do the work.

> > Now I think to move forward on this path we can replace all existing rust
> > packages to following definitions:
> > [...]
>
> Is it time for us to checkout the branch and start testing it out?

Yes, after sending this mail, it's ready to be worked on.

I added etc/teams/rust/rust-crates.tmpl in case multiple modules are wanted.
But I still hope you to try the one-module approach first :)

Changes in the build-system are prerequisites:
--8<---------------cut here---------------start------------->8---
73472f1231 import: crate: crate-name->package-name: Move to (guix build-system 
cargo).
aeafda08ec build/cargo: Set default value of arguments for build phases.
01a20bbaa4 build-system: cargo: Support installing Cargo workspace.
0b2252d75d build-system: cargo: Support packaging Cargo workspace.
36583841ba build/cargo: Print out all non-empty binary files.
62d8bc7f0f build/cargo: Pass ‘--offline’ to cargo.
--8<---------------cut here---------------end--------------->8---

Changes for the importer can be split out.  The importer is usable but needs
more work on code cleanup, tests, UI and documentation:
--8<---------------cut here---------------start------------->8---
7b60112785 import: crate: Add ‘--lockfile’ option.
1c224ea3f6 import: crate: Add Cargo.lock parser.
d0d93fb1af scripts: import: Skip existing definition for ‘--insert’ option.
bb82ade032 scripts: import: Pass "--insert" to importers.
5394933b8d scripts: import: Support expressions defined by 'define.
2c8c94fa61 scripts: import: Add two newlines for ‘--insert’ option.
cfc9183d14 scripts: import: Document argument for ‘--insert’ option in help 
message.
--8<---------------cut here---------------end--------------->8---

My current workflow uses these packages:
--8<---------------cut here---------------start------------->8---
guix shell rust rust:cargo cargo-audit cargo-license
--8<---------------cut here---------------end--------------->8---

1. Unpack package source then update lockfile:
--8<---------------cut here---------------start------------->8---
cargo generate-lockfile
--8<---------------cut here---------------end--------------->8---

2. For adding new packages check output of ‘cargo audit’ and ‘cargo license’.

3. Update module
--8<---------------cut here---------------start------------->8---
guix import --insert gnu/packages/rust-crates.scm crate --lockfile=<...> <...>
etc/teams/rust/cleanup-crates.sh
--8<---------------cut here---------------end--------------->8---

4. Check module diff, content of sources marked as TODO and output of
'check-for-pregenerated-files phase.

Reply via email to