Bug 1872373 (rust-prost-build)

Summary: Review Request: rust-prost-build - Protocol Buffers implementation for the Rust Language
Product: [Fedora] Fedora Reporter: Peter Robinson <pbrobinson>
Component: Package ReviewAssignee: Robert-André Mauchin 🐧 <eclipseo>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: eclipseo, package-review
Target Milestone: ---Flags: eclipseo: fedora-review+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-09-11 16:33:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1872372    
Bug Blocks: 1862796    

Description Peter Robinson 2020-08-25 15:26:15 UTC
SPEC: https://pbrobinson.fedorapeople.org/rust-prost-build.spec
SRPM: https://pbrobinson.fedorapeople.org/rust-prost-build-0.6.1-1.fc32.src.rpm

Description:
Protocol Buffers implementation for the Rust Language

FAS: pbrobinson

Comment 1 Robert-André Mauchin 🐧 2020-08-25 21:53:47 UTC
I've got this error at the end of the build:


RPM build errors:
error: Arch dependent binaries in noarch package
    Arch dependent binaries in noarch package

Comment 2 Robert-André Mauchin 🐧 2020-08-25 22:02:50 UTC
 - You shouldn't bundle protobuf and shouldn't install it in a noarch package


ll builddir/build/BUILDROOT/rust-prost-build-0.6.1-1.fc34.x86_64/usr/share/cargo/registry/prost-build-0.6.1/third-party/protobuf/
total 28472
-rw-r--r--. 1 mockbuild mock     1732 Jun 13  2019 LICENSE
drwxr-xr-x. 1 mockbuild mock       12 Aug 25 23:48 include
-rwxr-xr-x. 1 mockbuild mock  4974596 Jan 12  2020 protoc-linux-aarch_64
-rwxr-xr-x. 1 mockbuild mock  4684564 Aug 25 23:50 protoc-linux-x86_32
-rwxr-xr-x. 1 mockbuild mock  5068568 Aug 25 23:50 protoc-linux-x86_64
-rwxr-xr-x. 1 mockbuild mock 11773784 Jan 12  2020 protoc-osx-x86_64
-rwxr-xr-x. 1 mockbuild mock  2639360 Jan 12  2020 protoc-win32.exe

Comment 3 Robert-André Mauchin 🐧 2020-08-25 22:04:19 UTC
Also the protobuf code is BSD and we can't ship precompiled binary

Comment 4 Robert-André Mauchin 🐧 2020-08-25 22:35:22 UTC
The build.rs is helpful:

//! Finds the appropriate `protoc` binary and Protobuf include directory for this host, and outputs
//! build directives so that the main `prost-build` crate can use them.
//!
//! The following locations are checked for `protoc` in decreasing priority:
//!
//!     1. The `PROTOC` environment variable.
//!     2. The bundled `protoc`.
//!     3. The `protoc` on the `PATH`.
//!
//! If no `protoc` binary is available in these locations, the build fails.
//!
//! The following locations are checked for the Protobuf include directory in decreasing priority:
//!
//!     1. The `PROTOC_INCLUDE` environment variable.
//!     2. The bundled Protobuf include directory.

You should BR protobuf-compiler and protobuf-devel then define

export PROTOC=%{_bindir}/protoc
export PROTOC_INCLUDE=%{_includedir}

Not sure if the devel package should also Requires: protobuf-compiler to work correctly.

You also need to exclude third_party in the Cargo.toml

# prost-build-fix-metadata.diff
============================================================================
--- prost-build-0.6.1/Cargo.toml        1970-01-01T00:00:00+00:00
+++ prost-build-0.6.1/Cargo.toml        2020-08-25T22:22:26.646471+00:00
@@ -20,6 +20,7 @@
 readme = "README.md"
 license = "Apache-2.0"
 repository = "https://github.com/danburkert/prost"
+exclude = ["/third-party"]
 [dependencies.bytes]
 version = "0.5"
 

============================================================================

 And:

Source:         %{crates_source}
# Initial patched metadata
# - exclude /third-party from install
Patch0:         prost-build-fix-metadata.diff

Comment 5 Robert-André Mauchin 🐧 2020-08-25 23:29:24 UTC
It should:

 Requires: protobuf-compiler

to work correctly.

And the crate depending on this one should also specify

export PROTOC=%{_bindir}/protoc

Comment 7 Peter Robinson 2020-09-08 07:59:08 UTC
Robert I think the latest update fixes everything.

Comment 8 Robert-André Mauchin 🐧 2020-09-08 17:39:32 UTC
 - always add a comment above patch to explain what changes you made:

# Fix XXXX
Patch1:         prost-build-fix-metadata.diff

Package approved.

Comment 9 Gwyn Ciesla 2020-09-08 18:33:54 UTC
(fedscm-admin):  The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-prost-build