Bug 1853087 - Review Request: rust-libcryptsetup-rs-sys - low level Rust bindings for libcryptsetup
Summary: Review Request: rust-libcryptsetup-rs-sys - low level Rust bindings for libcr...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: Package Review
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Robert-André Mauchin 🐧
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-07-01 22:18 UTC by John Baublitz
Modified: 2020-07-07 14:30 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-07 14:30:58 UTC
Type: ---
Embargoed:
zebob.m: fedora-review+


Attachments (Terms of Use)

Description John Baublitz 2020-07-01 22:18:52 UTC
Spec URL: https://copr-be.cloud.fedoraproject.org/results/jbaublitz/rust-libcryptsetup-rs-sys/fedora-rawhide-x86_64/01515990-rust-libcryptsetup-rs-sys/rust-libcryptsetup-rs-sys.spec
SRPM URL: https://copr-be.cloud.fedoraproject.org/results/jbaublitz/rust-libcryptsetup-rs-sys/fedora-rawhide-x86_64/01515990-rust-libcryptsetup-rs-sys/rust-libcryptsetup-rs-sys-0.1.3-1.fc33.src.rpm
Description: Low level bindings
Fedora Account System Username: jbaublitz

Koji build: https://koji.fedoraproject.org/koji/taskinfo?taskID=46443422

The only failure was on 32 bit architectures which should not impact rawhide. I've filed a bug about this issue here: https://github.com/rust-lang/rust-bindgen/issues/1823.

I'm the upstream maintainer and this is my first package submission so I'm looking for a sponsor.

Comment 1 Robert-André Mauchin 🐧 2020-07-02 16:56:53 UTC
 - Package must include LICENSE and should include README.md

%files          devel
%license LICENSE
%doc README.md
%{cargo_registry}/%{crate}-%{version_no_tilde}/

If not provided by the crate, please ask upstream to include the LICENSE within their crate.

 - devel should depend on libs + use pkgconfig in the auto-BR part:

BuildRequires:	cryptsetup-libs
BuildRequires:	cryptsetup-devel

 → 

%generate_buildrequires
%cargo_generate_buildrequires
echo 'pkgconfig(libcryptsetup)'


 - Package devel should also Requires pkgconfig(libcryptsetup) (When the package is installed, it is to be used in building a project thus requiring the libraries).


%package        devel
Summary:        %{summary}
BuildArch:      noarch
Requires:       pkgconfig(libcryptsetup)

Comment 2 John Baublitz 2020-07-02 20:34:32 UTC
Hi Robert-André, thanks for looking into this. I'm not entirely clear on all of the feedback here.

I checked and see that the LICENSE and README.md files are missing from the crate so that I can take care of upstream for sure.

With regards to the comment "devel should depend on libs + use pkgconfig in the auto-BR part" can you clarify a little bit? Do you mean add this line:

echo 'pkgconfig(libcryptsetup)'

and remove this line:

BuildRequires:	cryptsetup-devel

Will pkgconfig pull in the dependency on cryptsetup-devel? That's needed for the header file from which bindgen generates the bindings.

With regards to the comment "Package devel should also Requires pkgconfig(libcryptsetup) (When the package is installed, it is to be used in building a project thus requiring the libraries)", is this necessary so that applications that use the library pull in the proper runtime dependencies? Will this propagate to applications that pull in this library as a crate dependency?

Thanks for your help!

Comment 3 Robert-André Mauchin 🐧 2020-07-03 10:50:46 UTC
(In reply to John Baublitz from comment #2)
> Hi Robert-André, thanks for looking into this. I'm not entirely clear on all
> of the feedback here.
> 
> I checked and see that the LICENSE and README.md files are missing from the
> crate so that I can take care of upstream for sure.
> 
Yes please ask upstream.

> With regards to the comment "devel should depend on libs + use pkgconfig in
> the auto-BR part" can you clarify a little bit? Do you mean add this line:
> 
> echo 'pkgconfig(libcryptsetup)'
> 
> and remove this line:
> 
> BuildRequires:	cryptsetup-devel
> 
Remove:

BuildRequires:	cryptsetup-libs
BuildRequires:	cryptsetup-devel

Add:

echo 'pkgconfig(libcryptsetup)'

below:

%generate_buildrequires
%cargo_generate_buildrequires



> Will pkgconfig pull in the dependency on cryptsetup-devel? That's needed for
> the header file from which bindgen generates the bindings.
> 

Yes, pkgconfig(libcryptsetup) == cryptsetup-devel

> With regards to the comment "Package devel should also Requires
> pkgconfig(libcryptsetup) (When the package is installed, it is to be used in
> building a project thus requiring the libraries)", is this necessary so that
> applications that use the library pull in the proper runtime dependencies?
> 

Rust binary are statically linked, so the only time we need to install a crate is as a dependency for building a binary. So when you depend on your crate, it needs to pull the pkgconfig(libcryptsetup) to build the project.

> Will this propagate to applications that pull in this library as a crate
> dependency?

Only at the building stage, the final binary packaged won't need the dependency.

> Thanks for your help!

Comment 4 John Baublitz 2020-07-03 18:54:21 UTC
Hi Robert-André, this makes a lot more sense. Thank you for the clarification. I'll make the requested changes to the spec file as well. I just have one last question for future reference. The addition of this package is to support building a Rust application that takes advantage of libcryptsetup functionality. While it makes sense that the devel package for the bindings should require libcryptsetup-devel to be installed if this package is installed, should the runtime dependency on libcryptsetup be handled by the application I mentioned? I've dealt with Rust builds outside of Fedora packaging quite a lot and there's not really a good way to ensure through cargo that external dependencies are installed for bindings to execute properly and so the best you can usually do is check that a runtime application is installed in the application code because, like you mentioned, only static linking is supported at the crate level. However, with Fedora packaging there's a way to enforce non-Rust dependencies. Does that responsibility fall on the application RPM to enforce? I can't imagine there's a way to enforce this from a library as these RPMs seem to only be used in service of building a final application executable from the documents I've read.

Comment 5 Robert-André Mauchin 🐧 2020-07-03 20:10:21 UTC
(In reply to John Baublitz from comment #4)
> Hi Robert-André, this makes a lot more sense. Thank you for the
> clarification. I'll make the requested changes to the spec file as well. I
> just have one last question for future reference. The addition of this
> package is to support building a Rust application that takes advantage of
> libcryptsetup functionality. While it makes sense that the devel package for
> the bindings should require libcryptsetup-devel to be installed if this
> package is installed, should the runtime dependency on libcryptsetup be
> handled by the application I mentioned? I've dealt with Rust builds outside
> of Fedora packaging quite a lot and there's not really a good way to ensure
> through cargo that external dependencies are installed for bindings to
> execute properly and so the best you can usually do is check that a runtime
> application is installed in the application code because, like you
> mentioned, only static linking is supported at the crate level. However,
> with Fedora packaging there's a way to enforce non-Rust dependencies. Does
> that responsibility fall on the application RPM to enforce? I can't imagine
> there's a way to enforce this from a library as these RPMs seem to only be
> used in service of building a final application executable from the
> documents I've read.

That should be automatically handled, for example I have a crate rust-zstd-sys and the final binary RPM I build with it depends on libzstd.so.1()(64bit)

Comment 6 Robert-André Mauchin 🐧 2020-07-03 20:22:05 UTC
(In reply to John Baublitz from comment #0)
 
> The only failure was on 32 bit architectures which should not impact
> rawhide. I've filed a bug about this issue here:
> https://github.com/rust-lang/rust-bindgen/issues/1823

Rawhide package are built on all supported arches, even 32 bits one (i686 and armv7hl)

Comment 7 John Baublitz 2020-07-03 23:15:54 UTC
(In reply to Robert-André Mauchin 🐧 from comment #6)
> (In reply to John Baublitz from comment #0)
>  
> > The only failure was on 32 bit architectures which should not impact
> > rawhide. I've filed a bug about this issue here:
> > https://github.com/rust-lang/rust-bindgen/issues/1823
> 
> Rawhide package are built on all supported arches, even 32 bits one (i686
> and armv7hl)

I did some research and was able to make some code changes that satisfy the koji build requirements for 32 bit architectures with help from bindgen upstream.

The code that I used for the koji build will be merged shortly and the PR is here: https://github.com/stratis-storage/libcryptsetup-rs/pull/87

The koji build is here: https://koji.fedoraproject.org/koji/taskinfo?taskID=46530487

I'll upload the new source RPM and spec file for a second review once I merge the above PR and upload the new version to crates.io. Thanks!

Comment 9 Robert-André Mauchin 🐧 2020-07-04 17:42:57 UTC
Package approved. You still need to seek a sponsor: https://fedoraproject.org/wiki/How_to_get_sponsored_into_the_packager_group

Comment 10 Gwyn Ciesla 2020-07-06 18:45:42 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-libcryptsetup-rs-sys


Note You need to log in before you can comment on or make changes to this bug.