commit:     10a1ae74707b6a83d8e4b7580b25746f5e07644c
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Fri Jan 17 10:44:25 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 28 16:41:51 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10a1ae74

sys-apps/usbutils: add USE="usbreset", and masked

upstream thinks it could potentially damage hardware, so add the USE flag
"usbreset" which is off by default and masked.

Closes: https://bugs.gentoo.org/948216
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40177
Signed-off-by: Sam James <sam <AT> gentoo.org>

 profiles/default/linux/package.use.mask  |  5 +++
 sys-apps/usbutils/metadata.xml           |  3 ++
 sys-apps/usbutils/usbutils-018-r1.ebuild | 68 ++++++++++++++++++++++++++++++++
 3 files changed, 76 insertions(+)

diff --git a/profiles/default/linux/package.use.mask 
b/profiles/default/linux/package.use.mask
index af581ea60ca0..5f6340f64348 100644
--- a/profiles/default/linux/package.use.mask
+++ b/profiles/default/linux/package.use.mask
@@ -1,6 +1,11 @@
 # Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Z. Liu <[email protected]> (2025-03-24)
+# Upstream considers that the usbreset could potentially damage hardware.
+# bug #948216
+sys-apps/usbutils usbreset
+
 # Sam James <[email protected]> (2023-06-06)
 # Needs linux-only dev-libs/libaio.
 app-emulation/qemu -aio

diff --git a/sys-apps/usbutils/metadata.xml b/sys-apps/usbutils/metadata.xml
index 73dda144f9ac..5c9b9c422c67 100644
--- a/sys-apps/usbutils/metadata.xml
+++ b/sys-apps/usbutils/metadata.xml
@@ -5,4 +5,7 @@
        <email>[email protected]</email>
        <name>Gentoo Base System</name>
 </maintainer>
+<use>
+       <flag name="usbreset">additionally compile the potentially problematic 
usbreset util</flag>
+</use>
 </pkgmetadata>

diff --git a/sys-apps/usbutils/usbutils-018-r1.ebuild 
b/sys-apps/usbutils/usbutils-018-r1.ebuild
new file mode 100644
index 000000000000..afd812d8c744
--- /dev/null
+++ b/sys-apps/usbutils/usbutils-018-r1.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..13} )
+inherit meson python-single-r1
+
+DESCRIPTION="USB enumeration utilities"
+HOMEPAGE="
+       https://www.kernel.org/pub/linux/utils/usb/usbutils/
+       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usbutils.git/
+"
+SRC_URI="https://www.kernel.org/pub/linux/utils/usb/${PN}/${P}.tar.xz";
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="python usbreset"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+DEPEND="
+       virtual/libusb:1=
+       virtual/libudev:=
+"
+RDEPEND="
+       ${DEPEND}
+       python? (
+               ${PYTHON_DEPS}
+               sys-apps/hwdata
+       )
+"
+BDEPEND="
+       virtual/pkgconfig
+       python? ( ${PYTHON_DEPS} )
+"
+
+pkg_setup() {
+       use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+       default
+
+       use python && python_fix_shebang lsusb.py
+}
+
+src_install() {
+       meson_src_install
+
+       if use usbreset ; then
+               # https://github.com/gregkh/usbutils/issues/214
+               dobin ${BUILD_DIR}/usbreset
+               doman man/usbreset.1
+       fi
+
+       if ! use python ; then
+               rm -f "${ED}"/usr/bin/lsusb.py || die
+       fi
+}
+
+pkg_postinst() {
+       if use usbreset ; then
+               ewarn "Please be warned that 'usbreset' has been built and 
installed, but it could"
+               ewarn "damage your hardware, see upstream issue:"
+               ewarn "  https://github.com/gregkh/usbutils/issues/214";
+       fi
+}

Reply via email to