void-packages icon indicating copy to clipboard operation
void-packages copied to clipboard

New package: cyme-2.0.0.

Open klardotsh opened this issue 1 year ago • 1 comments

Testing the changes

  • I tested the changes in this PR: YES

(I ran the binary plain, and saw my USB devices and their speeds enumerated. I then ran it as cyme --lsusb and saw similar output to the stock lsusb, so the "drop in replacement ish" mode seems sane too)

New package

klardotsh avatar Oct 09 '24 21:10 klardotsh

I suspect the CI failures relate to running in the highly containerized and locked down GHA environment, but I can't be completely sure. I especially suspect this due to the rusb error code member being "Other". I don't appear to be missing any rdeps for the resulting binary, for example:

(snowcone) ~  » ldd $(which cyme)
	linux-vdso.so.1 (0x00007f2523f53000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007f2523f14000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f2523616000)
	/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f2523f55000)

klardotsh avatar Oct 09 '24 22:10 klardotsh

The missing udevrs dependency issue I can repro locally on x86_64-musl. Not yet sure why this is the case, but I'll poke at it a bit.

klardotsh avatar Oct 30 '24 18:10 klardotsh

Upstream made a bizarre decision to declare the dependency only for manually selected targets: https://github.com/tuna-f1sh/cyme/blob/c64fc0f66494202f67007f3dabfd244d5ce54fef/Cargo.toml#L47-L61

we'd probably have to patch it to include it on all unixes, or even just in the main dependency section

tranzystorekk avatar Oct 30 '24 19:10 tranzystorekk

It gets worse, actually: even overriding features to force the use of the C FFI bindings to udev/hwdb/etc., fails:

diff --git a/srcpkgs/cyme/template b/srcpkgs/cyme/template
index 6822da63a2e..58ce77a6240 100644
--- a/srcpkgs/cyme/template
+++ b/srcpkgs/cyme/template
@@ -3,7 +3,12 @@ pkgname=cyme
 version=2.0.0
 revision=1
 build_style=cargo
-checkdepends="eudev"
+# The default udevrs dependency is, for whatever reason, not found on Musl, but
+# falling back to the C FFI dependency works. If we're already using system
+# udev anyway, we'll also use the system udev HWDB rather than the crate
+# dependency which might be of a different version than what the system ships.
+configure_args="--no-default-features --features=regex_icon,ffi,udev_hwdb"
+makedepends="eudev-libudev-devel"
 short_desc="List system USB buses and devices"
 maintainer="klardotsh <[email protected]>"
 license="GPL-3.0-or-later"
error[E0432]: unresolved import `udevlib`
 --> src/udev_ffi.rs:3:5
  |
3 | use udevlib;
  |     ^^^^^^^ no external crate `udevlib`

For more information about this error, try `rustc --explain E0432`.
error: could not compile `cyme` (lib) due to 1 previous error
=> ERROR: cyme-2.0.0_1: do_build: '${make_cmd} build --release --locked --target ${RUST_TARGET} ${configure_args} ${make_build_args}' exited with 101
=> ERROR:   in do_build() at common/build-style/cargo.sh:8

EDIT: Extrapolating from your comment (which, I had also looked at Cargo.toml and pondered a bit), I'm assuming Cargo considers Musl to be a non-Linux. I know it's a different triplet as far as LLVM was concerned, but I was hoping Cargo/Rust would at least understand it to be a Linux still?

klardotsh avatar Oct 30 '24 19:10 klardotsh

the following patches seem to work on musl for me:

diff --git a/srcpkgs/cyme/template b/srcpkgs/cyme/template
index 6822da63a2e..ab67215cd12 100644
--- a/srcpkgs/cyme/template
+++ b/srcpkgs/cyme/template
@@ -3,6 +3,9 @@ pkgname=cyme
 version=2.0.0
 revision=1
 build_style=cargo
+configure_args="--no-default-features --features=regex_icon,nusb,udevlib,udev_hwdb"
+hostmakedepends="pkg-config"
+makedepends="eudev-libudev-devel"
 checkdepends="eudev"
 short_desc="List system USB buses and devices"
 maintainer="klardotsh <[email protected]>"

(no need to also disable native rust usb support IMO)

diff --git a/Cargo.toml b/Cargo.toml
index 6e80771..53fe0af 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -36,6 +36,8 @@ regex = { version = "1.10.5", optional = true }
 uuid = { version = "1.9.1", features = ["serde"] }
 pci-ids = "0.2.5"
 unicode-width = "0.2.0"
+udevrs = { version = "^0.3.0", optional = true }
+udevlib = { package = "udev", version = "^0.8.0", optional = true }
 
 [patch.crates-io]
 nusb = { git = "https://github.com/tuna-f1sh/nusb", branch = "cyme" }
@@ -44,22 +46,6 @@ nusb = { git = "https://github.com/tuna-f1sh/nusb", branch = "cyme" }
 diff = "0.1"
 assert-json-diff = "2.0.2"
 
-[target.x86_64-unknown-linux-gnu.dependencies]
-udevrs = { version = "^0.3.0", optional = true }
-udevlib = { package = "udev", version = "^0.8.0", optional = true }
-
-[target.arm-unknown-linux-gnueabihf.dependencies]
-udevrs = { version = "^0.3.0", optional = true }
-udevlib = { package = "udev", version = "^0.8.0", optional = true }
-
-[target.aarch64-unknown-linux-gnu.dependencies]
-udevrs = { version = "^0.3.0", optional = true }
-udevlib = { package = "udev", version = "^0.8.0", optional = true }
-
-[target.riscv64gc-unknown-linux-gnu.dependencies]
-udevrs = { version = "^0.3.0", optional = true }
-udevlib = { package = "udev", version = "^0.8.0", optional = true }
-
 [features]
 libusb = ["dep:rusb"]
 udev = ["dep:udevrs"]

tranzystorekk avatar Oct 30 '24 19:10 tranzystorekk

Pull Requests become stale 90 days after last activity and are closed 14 days after that. If this pull request is still relevant bump it or assign it.

github-actions[bot] avatar Mar 05 '25 02:03 github-actions[bot]