On Wed, Jan 18, 2023 at 4:48 PM David Howells <dhowe...@redhat.com> wrote:
>
> Hi,
>
> Does anyone know how to package a rust project as an rpm on Fedora 37,
> specifically stgit-2?

Looking at the upstream project, it doesn't look too bad. Should be
relatively straightforward to package for Fedora, with one caveat.

> stgit, of which I make heavy use, has been rewritten in rust but I can't
> manage to build it.
>
>         https://github.com/stacked-git/stgit
>
> I've found rust2rpm to create a specfile, but that doesn't any insert
> BuildRequires for "dnf builddep" to pick up.

Rust packaging uses dynamically generated BuildRequires, similar to
modern Python packaging. "dnf builddep" does not work for packages
that use this feature, unless you take additional steps (I think
running "rpmbuild -br" first). However, recommend *in the strongest
possible way I can* to use *mock* for building Rust packages.
Everything else is a way towards pain.

> Running "rpmbuild -bb" shows a bunch of unsatisfied deps, but I can't find all
> of them as prepackaged rpms.

As I mentioned, please do not build Rust packages on your host OS. Use
mock. It supports building packages that use dynamic BuildRequires
OOTB.

> The git-repository crate that stgit depends on, if I download it with crate
> install, it can't be installed as it doesn't have an executable in it.  I
> think the problem is that it's just a library.

You will need to package missing dependencies - like the
git-repository crate - separately (as rust-git-repository).
Running "cargo install" does not work for library-only crates. And I
don't know running "cargo install git-repository" would help you?
Package builds do not have internet access.

I haven't looked at all of them individually, but at a glance, almost
all dependencies of stgit should already be packaged for fedora:
https://github.com/stacked-git/stgit/blob/master/Cargo.toml#L19-L47

Only the git-repository crate is not packaged yet, as far as I can
see. Other than that, the only problem I see straight away is that we
don't have clap v4 in Fedora yet (because clap v4 started to use
features of cargo that our tools do not support yet).
Looking back at the history of stgit, it seems that all releases of it
already use clap v4, so that will be a problem until I have time to
fix our tools for https://bugzilla.redhat.com/show_bug.cgi?id=2152697
.

Fabio
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to