Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/lshw/, sys-apps/lshw/files/
Date: Thu, 04 Jan 2018 07:14:41
Message-Id: 1515050007.1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc.vapier@gentoo
1 commit: 1cb1b9ca5d372c83314d9f7b02c80eb7c10cc0bc
2 Author: Wenkai Du <wenkai.du <AT> intel <DOT> com>
3 AuthorDate: Thu Jan 4 07:13:02 2018 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 4 07:13:27 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1cb1b9ca
7
8 sys-apps/lshw: add upstream fix for crashes w/Intel SGX
9
10 sys-apps/lshw/files/lshw-02.18b-sgx.patch | 32 ++++++++++++++
11 sys-apps/lshw/lshw-02.18b-r1.ebuild | 73 +++++++++++++++++++++++++++++++
12 2 files changed, 105 insertions(+)
13
14 diff --git a/sys-apps/lshw/files/lshw-02.18b-sgx.patch b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
15 new file mode 100644
16 index 00000000000..92bd6c23e2f
17 --- /dev/null
18 +++ b/sys-apps/lshw/files/lshw-02.18b-sgx.patch
19 @@ -0,0 +1,32 @@
20 +patch from upstream:
21 +https://ezix.org/src/pkg/lshw/commit/5e5744732b2dcdf83845919256388b3842033183
22 +
23 +From 5e5744732b2dcdf83845919256388b3842033183 Mon Sep 17 00:00:00 2001
24 +From: Wenkai Du <wenkai.du@×××××.com>
25 +Date: Fri, 22 Dec 2017 09:57:57 -0800
26 +Subject: [PATCH] lshw: fix segmentation fault when /dev/sgx is present
27 +
28 +When Intel SGX is enabled in kernel, /dev/sgx is created and is
29 +picked up by "/dev/sg*" glob matching.
30 +
31 +Signed-off-by: Wenkai Du <wenkai.du@×××××.com>
32 +---
33 + src/core/scsi.cc | 2 +-
34 + 1 file changed, 1 insertion(+), 1 deletion(-)
35 +
36 +diff --git a/src/core/scsi.cc b/src/core/scsi.cc
37 +index b38dda2cd8a8..75061c0fb195 100644
38 +--- a/src/core/scsi.cc
39 ++++ b/src/core/scsi.cc
40 +@@ -30,7 +30,7 @@
41 +
42 + __ID("@(#) $Id$");
43 +
44 +-#define SG_X "/dev/sg*"
45 ++#define SG_X "/dev/sg[0-9]*"
46 + #define SG_MAJOR 21
47 +
48 + #ifndef SCSI_IOCTL_GET_PCI
49 +--
50 +2.15.1
51 +
52
53 diff --git a/sys-apps/lshw/lshw-02.18b-r1.ebuild b/sys-apps/lshw/lshw-02.18b-r1.ebuild
54 new file mode 100644
55 index 00000000000..c22eab42757
56 --- /dev/null
57 +++ b/sys-apps/lshw/lshw-02.18b-r1.ebuild
58 @@ -0,0 +1,73 @@
59 +# Copyright 1999-2018 Gentoo Foundation
60 +# Distributed under the terms of the GNU General Public License v2
61 +
62 +EAPI="5"
63 +
64 +PLOCALES='fr'
65 +
66 +inherit flag-o-matic eutils toolchain-funcs l10n
67 +
68 +MAJ_PV=${PV:0:${#PV}-1}
69 +MIN_PVE=${PV:0-1}
70 +MIN_PV=${MIN_PVE/b/B}
71 +
72 +MY_P="$PN-$MIN_PV.$MAJ_PV"
73 +DESCRIPTION="Hardware Lister"
74 +HOMEPAGE="https://www.ezix.org/project/wiki/HardwareLiSter"
75 +SRC_URI="https://www.ezix.org/software/files/${MY_P}.tar.gz"
76 +
77 +LICENSE="GPL-2"
78 +SLOT="0"
79 +KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
80 +IUSE="gtk sqlite static"
81 +
82 +REQUIRED_USE="static? ( !gtk )"
83 +
84 +RDEPEND="gtk? ( x11-libs/gtk+:2 )
85 + sqlite? ( dev-db/sqlite:3 )"
86 +DEPEND="${RDEPEND}
87 + gtk? ( virtual/pkgconfig )
88 + sqlite? ( virtual/pkgconfig )"
89 +RDEPEND="${RDEPEND}
90 + sys-apps/hwids"
91 +
92 +S=${WORKDIR}/${MY_P}
93 +
94 +PATCHES=(
95 + "${FILESDIR}"/${PN}-02.18b-gentoo.patch
96 + "${FILESDIR}"/${PN}-02.18b-gettext-array.patch
97 + "${FILESDIR}"/${PN}-02.18b-sgx.patch
98 +)
99 +
100 +src_prepare() {
101 + epatch "${PATCHES[@]}"
102 +
103 + l10n_find_plocales_changes "src/po" "" ".po" || die
104 + sed -i \
105 + -e "/^LANGUAGES =/ s/=.*/= $(l10n_get_locales)/" \
106 + src/po/Makefile || die
107 + sed -i \
108 + -e 's:\<pkg-config\>:${PKG_CONFIG}:' \
109 + src/Makefile src/gui/Makefile || die
110 +}
111 +
112 +src_compile() {
113 + tc-export CC CXX AR PKG_CONFIG
114 + use static && append-ldflags -static
115 +
116 + # Need two sep make statements to avoid parallel build issues. #588174
117 + local sqlite=$(usex sqlite 1 0)
118 + emake SQLITE=${sqlite} all
119 + use gtk && emake SQLITE=${sqlite} gui
120 +}
121 +
122 +src_install() {
123 + emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install $(usex gtk 'install-gui' '')
124 + dodoc README.md docs/*
125 + if use gtk ; then
126 + newicon -s scalable src/gui/artwork/logo.svg gtk-lshw.svg
127 + make_desktop_entry \
128 + "${EPREFIX}"/usr/sbin/gtk-lshw \
129 + "${DESCRIPTION}"
130 + fi
131 +}