Re: Help packaging a "C" library written in Rust

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 07, 2022 at 02:40:51PM -0400, Stefan Hajnoczi wrote:
> On Wed, Sep 07, 2022 at 02:30:23PM +0100, Richard W.M. Jones wrote:
> > On Wed, Sep 07, 2022 at 08:50:24AM -0400, Stefan Hajnoczi wrote:
> > > On Wed, Sep 07, 2022 at 10:05:55AM +0100, Richard W.M. Jones wrote:
> > > > 
> > > > https://gitlab.com/libblkio/libblkio
> > > > 
> > > > This is a library that offers a C API.  It happens to be implemented
> > > > in Rust, but it's not a "Crate" or anything like that.
> > > > 
> > > > I wrote a spec file for it assuming it's a C library and it works fine
> > > > when building locally:
> > > > 
> > > > https://bugzilla.redhat.com/show_bug.cgi?id=2124697
> > > > 
> > > > However it turns out that it downloads stuff during the build and
> > > > therefore won't build in Koji.  Apart from reading the Rust packaging
> > > > guidelines which don't seem applicable here (as this is not a Rust
> > > > Crate), that's as far as I've got on this one.
> > > > 
> > > > Has anyone packaged anything like this for Fedora?
> > > 
> > > I'm a relative packaging newbie but I intended to package libblkio by
> > > following the Rust packaging guidelines for the blkio and virtio-driver
> > > crates in the libblkio.git repo. These crates live in libblkio.git but
> > > may eventually move into their own repos. They are already published on
> > > crates.io:
> > > https://crates.io/crates/blkio
> > > https://crates.io/crates/virtio-driver
> > 
> > Interesting.  I wonder if packaging blkio & libblkio separately
> > conflicts with the usual requirement for 1 source == 1 package?
> > Of course that could be split upstream.
> 
> I'm afraid I don't know what the 1 source == 1 package requirement is.
> Can you explain?

In the normal packaging world, one upstream project generates one
source tarball which generates one source RPM generates one or more
binary sub-packages.  Can't actually find this written down in the
packaging guidelines at the moment.

As for the rest, I've no idea, best to let the Fedora Rust developers
speak about this.

> My understanding is Rust library crates are packaged from crates.io
> releases, not from upstream repos where the code is developed and
> tagged. For each crates.io crate there is a rust-$name source package
> that builds a package containing the crate's source code.
> 
> The crates involved in libblkio are:
> 1. libblkio itself is not a Rust library crate. It's a top-level crate
>    that produces a shared library.
> 2. blkio is a Rust library crate published on crates.io.
> 3. virtio-driver is a Rust library crate published on crates.io. blkio
>    depends on it.
> 4. A bunch of external Rust library crate dependencies.
> 
> libblkio's source repository happens to contain local copies of the
> blkio and virtio-driver crates, but they the source rpm for libblkio
> should not include it. Instead it should depend on rust-blkio which
> depends on rust-virtio-driver.
> 
> (If we follow the no-vendoring approach.)
> 
> > 
> > > Then I would treat libblkio itself (the top-level crate that builds the
> > > C library) like a Rust application rather than a Rust crate, because we
> > > need to package the .so instead of shipping the crate source code.
> > > 
> > > I was expecting to package all external dependency crates that are not
> > > yet available in Fedora. I haven't checked which ones are missing yet.
> > 
> > The missing ones are:
> > 
> >   concat-idents
> >   io-uring
> >   memfd
> > 
> > And these ones seem to be required but are presumably not used:
> > 
> >   winapi
> >   winapi-i686-pc-windows-gnu
> >   winapi-x86_64-pc-windows-gnu
> 
> Yes, they are definitely not required because libblkio is currently
> Linux-only.
> 
> > 
> > Anyway have a look at the bug because I've got a package that actually
> > builds now in Koji, by using all the existing rust packages where they
> > exist + bundling the 6 packages above.
> > 
> >   https://bugzilla.redhat.com/show_bug.cgi?id=2124697
> 
> Awesome, thank you so much for setting this up!
> 
> > Also it fails to build on i686 which might indicate a bug.  If it's
> > not intended to work on i686 then we are allowed to add ExcludesArch.
> 
> I will investigate the i686 issue.
> 
> Stefan

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux