Bug 2283685

Summary: Review Request: rust-raw-cpuid - Library to parse the x86 CPUID instruction
Product: [Fedora] Fedora Reporter: Cristian Le <fedora>
Component: Package ReviewAssignee: Fabio Valentini <decathorpe>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: decathorpe, package-review, pemensik
Target Milestone: ---Keywords: AutomationTriaged
Target Release: ---Flags: decathorpe: fedora-review+
Hardware: All   
OS: Linux   
URL: https://crates.io/crates/raw-cpuid
Whiteboard:
Fixed In Version: rust-raw-cpuid-11.1.0-1.fc41 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-12 16:18:24 UTC Type: ---
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: 2283688    
Bug Blocks: 2283679    
Attachments:
Description Flags
The .spec file difference from Copr build 7716360 to 7801811 none

Description Cristian Le 2024-05-28 20:03:39 UTC
Spec URL: https://github.com/LecrisUT/rust-metris-rpmspec/raw/18bb026c3e9d3de4cfbc75fe92babea0b3506a81/rust-raw-cpuid/rust-raw-cpuid.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/packit/LecrisUT-rust-metris-rpmspec-main/fedora-rawhide-x86_64/07500438-rust-raw-cpuid/rust-raw-cpuid-11.0.2-1.fc41.src.rpm
Description: Dependency for `rust-quanta` -> `rust-metrics-exporter-prometheus` -> `atuin`
Fedora Account System Username: lecris

rust2rpm.toml: (patched with `rust2rpm -p` to remove `cli` and `display` features+dependencies)
```toml
[package]
summary = "Library to parse the x86 CPUID instruction"
cargo-install-bin = false

[features]
hide = [
    "cli",
    "display",
]

[scripts.prep]
post = [
    "# Remove unused cli files",
    "rm -r src/bin",
]
```

(will remove `cargo-install-bin` at next review)

Comment 1 Cristian Le 2024-07-05 13:30:11 UTC
Spec URL: https://github.com/LecrisUT/rust-metris-rpmspec/raw/83dda26784f2c9cbe603473e461adaec238ddb34/rust-raw-cpuid/rust-raw-cpuid.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/packit/LecrisUT-rust-metris-rpmspec-main/fedora-rawhide-x86_64/07711190-rust-raw-cpuid/rust-raw-cpuid-11.0.2-1.fc41.src.rpm

rust2rpm.toml:
```toml
[package]
summary = "Library to parse the x86 CPUID instruction"
cargo-install-bin = false
cargo-toml-patch-comments = [
    "- Remove clashing binary package",
    "- Remove cli and display features",
]

[features]
hide = [
    "cli",
    "display",
]

[scripts.prep]
post = [
    "# Remove unused cli files",
    "rm -r src/bin",
]
```

raw-cpuid-fix-metadata.diff
```
--- raw-cpuid-11.0.2/Cargo.toml	1970-01-01T00:00:01+00:00
+++ raw-cpuid-11.0.2/Cargo.toml	2024-05-28T18:01:14.469960+00:00
@@ -32,11 +32,6 @@
 license = "MIT"
 repository = "https://github.com/gz/rust-cpuid"
 
-[[bin]]
-name = "cpuid"
-path = "src/bin/cpuid.rs"
-required-features = ["cli"]
-
 [[example]]
 name = "serialize_deserialize"
 path = "examples/serialize_deserialize.rs"
@@ -44,11 +39,6 @@
 
 [dependencies.bitflags]
 version = "2.0"
-
-[dependencies.clap]
-version = "4.2"
-features = ["derive"]
-optional = true
 
 [dependencies.serde]
 version = "1.0"
@@ -63,21 +53,9 @@
 version = "1.0"
 optional = true
 
-[dependencies.termimad]
-version = "0.25"
-optional = true
-
 [features]
-cli = [
-    "display",
-    "clap",
-]
-display = [
-    "std",
-    "termimad",
-    "serde_json",
-    "serialize",
-]
+cli = []
+display = []
 serialize = [
     "serde",
     "serde_derive",
```

Comment 2 Fedora Review Service 2024-07-06 06:06:00 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7712626
(failed)

Build log:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07712626-rust-raw-cpuid/builder-live.log.gz

Please make sure the package builds successfully at least for Fedora Rawhide.

- If the build failed for unrelated reasons (e.g. temporary network
  unavailability), please ignore it.
- If the build failed because of missing BuildRequires, please make sure they
  are listed in the "Depends On" field


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 3 Cristian Le 2024-07-06 09:27:34 UTC
[fedora-review-service-build]

Comment 4 Fedora Review Service 2024-07-06 10:46:53 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7712855
(failed)

Build log:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07712855-rust-raw-cpuid/builder-live.log.gz

Please make sure the package builds successfully at least for Fedora Rawhide.

- If the build failed for unrelated reasons (e.g. temporary network
  unavailability), please ignore it.
- If the build failed because of missing BuildRequires, please make sure they
  are listed in the "Depends On" field


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 5 Cristian Le 2024-07-07 09:59:41 UTC
[fedora-review-service-build]

Comment 6 Fedora Review Service 2024-07-07 22:58:28 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7715800
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07715800-rust-raw-cpuid/fedora-review/review.txt

Please take a look if any issues were found.


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 7 Fedora Review Service 2024-07-08 02:34:58 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7716231
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07716231-rust-raw-cpuid/fedora-review/review.txt

Please take a look if any issues were found.


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 8 Fedora Review Service 2024-07-08 05:36:44 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7716360
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07716360-rust-raw-cpuid/fedora-review/review.txt

Please take a look if any issues were found.


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 9 Fabio Valentini 2024-07-09 14:47:47 UTC
Some comments:

1. Rather than needing to make manual adjustments after dropping the binary, I would recommend to patch in "package.autobins = false".

2. If you're removing functionality for "cli" and "display", don't keep empty dummy features for them. Just remove them entirely.

3. The test suite fails to compile on non-x86 architectures, but the crate itself does (though looks like with most functionality disabled):

https://koji.fedoraproject.org/koji/taskinfo?taskID=120239066

You will either need to use the `package.supported-arches = ["x86_64", "i686"]` setting in rust2rpm.toml or wrap the %cargo_test macro like this:

```
%ifarch x86_64 %{ix86}
%cargo_test
%endif
```

Comment 10 Cristian Le 2024-07-09 15:10:31 UTC
Thanks for the tips and checking the other arch. I am leaning towards the `package.supported-arches` approach. The part that has me uncertain is that looking at other projects [1] only around ~50% (engineering estimate) have a `target_arch` filter. The tests that are failing are on example tests as well. Looking more through the project, there seems to be some minimal support for M2 arm architectures. But for now `quanta` has the `target_arch` filter, and I'm inclined to go the easy way out for now.

[1]: https://sourcegraph.com/search?q=context:global+file:Cargo%5C.toml%24+%22raw-cpuid+%3D%22&patternType=keyword&sm=0

Comment 11 Fabio Valentini 2024-07-11 10:44:45 UTC
Hm. Yeah, setting "supported-arches" would be the easiest solution for now. It can always be expanded to more architectures later and / or only tests that are x86-specific skipped.

Comment 12 Cristian Le 2024-07-28 21:05:54 UTC
Package got bumped, although nothing particularly notable.
I was expecting that `package.supported-arches` would make the package `ExclusiveArch`. But I guess it's even even without?

---

Spec URL: https://github.com/LecrisUT/rust-metris-rpmspec/raw/9f18f4d0039627a5fdb0e27c47d59c442cc60c23/rust-raw-cpuid/rust-raw-cpuid.spec
SRPM URL: https://download.copr.fedorainfracloud.org/results/packit/LecrisUT-rust-metris-rpmspec-main/fedora-rawhide-x86_64/07799292-rust-raw-cpuid/rust-raw-cpuid-11.1.0-1.fc41.src.rpm

rust2rpm.toml:
```toml
[package]
summary = "Library to parse the x86 CPUID instruction"
cargo-install-bin = false
cargo-toml-patch-comments = [
    "- Remove clashing binary package",
    "- Remove cli and display features",
]
supported-arches = ["x86_64", "i686"]

[features]
enable = [
    "std",
    "serialize",
]
```

raw-cpuid-fix-metadata.diff
```
--- raw-cpuid-11.1.0/Cargo.toml	1970-01-01T00:00:01+00:00
+++ raw-cpuid-11.1.0/Cargo.toml	2024-07-28T20:44:37.764571+00:00
@@ -31,11 +31,7 @@
 ]
 license = "MIT"
 repository = "https://github.com/gz/rust-cpuid"
-
-[[bin]]
-name = "cpuid"
-path = "src/bin/cpuid.rs"
-required-features = ["cli"]
+autobins = false
 
 [[example]]
 name = "serialize_deserialize"
@@ -44,11 +40,6 @@
 
 [dependencies.bitflags]
 version = "2.0"
-
-[dependencies.clap]
-version = "4.2"
-features = ["derive"]
-optional = true
 
 [dependencies.serde]
 version = "1.0"
@@ -61,10 +52,6 @@
 
 [dependencies.serde_json]
 version = "1.0"
-optional = true
-
-[dependencies.termimad]
-version = "0.25"
 optional = true
 
 [dev-dependencies.core_affinity]
@@ -82,16 +69,6 @@
 version = "1.0"
 
 [features]
-cli = [
-    "display",
-    "clap",
-]
-display = [
-    "std",
-    "termimad",
-    "serde_json",
-    "serialize",
-]
 serialize = [
     "serde",
     "serde_derive",
```

Comment 13 Fedora Review Service 2024-07-29 17:15:30 UTC
Created attachment 2040725 [details]
The .spec file difference from Copr build 7716360 to 7801811

Comment 14 Fedora Review Service 2024-07-29 17:15:33 UTC
Copr build:
https://copr.fedorainfracloud.org/coprs/build/7801811
(succeeded)

Review template:
https://download.copr.fedorainfracloud.org/results/@fedora-review/fedora-review-2283685-rust-raw-cpuid/fedora-rawhide-x86_64/07801811-rust-raw-cpuid/fedora-review/review.txt

Please take a look if any issues were found.


---
This comment was created by the fedora-review-service
https://github.com/FrostyX/fedora-review-service

If you want to trigger a new Copr build, add a comment containing new
Spec and SRPM URLs or [fedora-review-service-build] string.

Comment 15 Petr Menšík 2024-08-03 21:38:50 UTC
I have played with my own package and made it a bit different way. Unfortunately purely manual hacking:
https://github.com/pemensik/rust-cpuid/commit/45d2e8fd73770669bf3e31272c51e8abcc34a24e

I have not found nice way to skip bin target directly from rust2rpm. I were able to prepare working version automatically:

$ cat rust2rpm.toml 
[package]
summary = "Rust library to parse the x86 CPUID instruction"
cargo-install-bin = false
supported-arches = ["x86_64", "i686"]

[features]
enable-all = false
enable = ["std", "serialize"]
hide = ["cli"]
disable-default = true

$ rust2rpm raw-cpuid && sed -e 's/ cli,/ /g' -i *.spec

I have not found decent way to supress cli by rust2rpm.toml. I think some feature request would be nice to make it easier.

Comment 16 Fabio Valentini 2024-08-12 11:48:09 UTC
> I was expecting that `package.supported-arches` would make the package `ExclusiveArch`. But I guess it's even even without?

No, this would make the package noarch but only available on some architectures, leading to broken dependencies in dependent packages.

Comment 17 Fabio Valentini 2024-08-12 12:11:05 UTC
Thank you for the changes, package looks good to me now.

===

Package was generated with rust2rpm, simplifying the review.

✅ package contains only permissible content
✅ package builds and installs without errors on rawhide
✅ test suite is run and all unit tests pass
✅ latest version of the crate is packaged
✅ license matches upstream specification and is acceptable for Fedora
✅ license file is included with %license in %files
✅ package complies with Rust Packaging Guidelines

Package APPROVED.

===

Recommended post-import rust-sig tasks:

- set up package on release-monitoring.org:
  project: $crate
  homepage: https://crates.io/crates/$crate
  backend: crates.io
  version scheme: semantic
  version filter: alpha;beta;rc;pre
  distro: Fedora
  Package: rust-$crate

- add @rust-sig with "commit" access as package co-maintainer
  (should happen automatically)

- set bugzilla assignee overrides to @rust-sig (optional)

- track package in koschei for all built branches
  (should happen automatically once rust-sig is co-maintainer)

Comment 18 Cristian Le 2024-08-12 12:56:22 UTC
Thank you for the review, Fabio

Comment 19 Fedora Admin user for bugzilla script actions 2024-08-12 12:56:33 UTC
The Pagure repository was created at https://src.fedoraproject.org/rpms/rust-raw-cpuid

Comment 21 Fedora Update System 2024-08-12 13:21:14 UTC
FEDORA-2024-b7da022eed (rust-raw-cpuid-11.1.0-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-b7da022eed

Comment 22 Fedora Update System 2024-08-12 13:35:19 UTC
FEDORA-2024-5e86a0dcc7 (rust-raw-cpuid-11.1.0-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-5e86a0dcc7

Comment 23 Fedora Update System 2024-08-12 13:35:19 UTC
FEDORA-2024-9b7e62ab2c (rust-raw-cpuid-11.1.0-1.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-9b7e62ab2c

Comment 24 Fedora Update System 2024-08-12 16:18:24 UTC
FEDORA-2024-b7da022eed (rust-raw-cpuid-11.1.0-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 25 Fedora Update System 2024-08-13 01:32:36 UTC
FEDORA-2024-5e86a0dcc7 has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-5e86a0dcc7`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-5e86a0dcc7

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 26 Fedora Update System 2024-08-13 02:38:38 UTC
FEDORA-2024-9b7e62ab2c has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-9b7e62ab2c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-9b7e62ab2c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 27 Fedora Update System 2024-08-21 02:18:51 UTC
FEDORA-2024-9b7e62ab2c (rust-raw-cpuid-11.1.0-1.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 28 Fedora Update System 2024-08-21 03:07:41 UTC
FEDORA-2024-5e86a0dcc7 (rust-raw-cpuid-11.1.0-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.