1 |
commit: 36f2e6f505922fc48f1059055c2ab94937880dc7 |
2 |
Author: xdch47 <xdch47 <AT> posteo <DOT> de> |
3 |
AuthorDate: Tue Nov 27 09:35:54 2018 +0000 |
4 |
Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Dec 2 18:20:59 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=36f2e6f5 |
7 |
|
8 |
sys-apps/lshw: patches for various fixes (musl+mem) |
9 |
|
10 |
musl compile fixes: |
11 |
- include "libgen.h" for basename |
12 |
- fix basename parameters (should be char * instead of const char *) |
13 |
|
14 |
additional changes |
15 |
- fix potential buffer overflows |
16 |
- bump to eapi7 |
17 |
|
18 |
Package-Manager: Portage-2.3.51, Repoman-2.3.11 |
19 |
Manifest-Sign-Key: 0DEDF1A904568BAD1FC45C283DCC44782ED07E1C |
20 |
Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org> |
21 |
|
22 |
sys-apps/lshw/Manifest | 15 ++ |
23 |
sys-apps/lshw/files/lshw-02.18b-fixes.patch | 188 +++++++++++++++++++++ |
24 |
sys-apps/lshw/files/lshw-02.18b-gentoo.patch | 161 ++++++++++++++++++ |
25 |
.../lshw/files/lshw-02.18b-gettext-array.patch | 31 ++++ |
26 |
sys-apps/lshw/files/lshw-02.18b-sgx.patch | 32 ++++ |
27 |
sys-apps/lshw/lshw-02.18b-r2.ebuild | 72 ++++++++ |
28 |
sys-apps/lshw/metadata.xml | 8 + |
29 |
7 files changed, 507 insertions(+) |
30 |
|
31 |
diff --git a/sys-apps/lshw/Manifest b/sys-apps/lshw/Manifest |
32 |
new file mode 100644 |
33 |
index 0000000..d64989e |
34 |
--- /dev/null |
35 |
+++ b/sys-apps/lshw/Manifest |
36 |
@@ -0,0 +1,15 @@ |
37 |
+-----BEGIN PGP SIGNED MESSAGE----- |
38 |
+Hash: SHA256 |
39 |
+ |
40 |
+DIST lshw-B.02.18.tar.gz 2322176 BLAKE2B 66183895fcdd5b47bfaa044c10f7b561b3310829b53828444a20f078ce63e166a878595c8a8a79e22f1e4ab726e98165a1b31225997785d2bfc3ad5d7b0c5214 SHA512 4385db86101178b8bd33a80e991718e14f83277c66b3d63ae97cb4339196873b6e9b31a174024bf43d16fe66e1d7f8cf5cea56076697878087880c8821b11e47 |
41 |
+-----BEGIN PGP SIGNATURE----- |
42 |
+ |
43 |
+iQEzBAEBCAAdFiEEDe3xqQRWi60fxFwoPcxEeC7QfhwFAlv9D/cACgkQPcxEeC7Q |
44 |
+fhxSvggAmDoo1vQYKHl3fwhZnFcx7ByB7tIp4Qj0ugNKUp5DEelojTuviwnwT/SV |
45 |
+nzPi2+o0ExX/SGAmjcukIqIOx7a3TieyHU/qEAxMikTAe/y7hMYmgyydON28i3M2 |
46 |
+50p0xFkuQ2i6xPGS76WojWz/YVBUhrbOrbxzlcVPKRAu2vD/MhSZkWA+0JX+RqS0 |
47 |
+Tp6TzttzD3uwR365J2VxiWw5q9AZroq+tY8IWk8NZnLqTyVXOP7BA0XaR0Zz+nw0 |
48 |
+EDNb9PVCTrraXFzWKIL+NMOghi8q2gP2iCzlfvBPDOuh6y0bGRtXdYAQtB8tqe0z |
49 |
+JaeR0rCU/dB6hd+WlXwSEIxgd7/GBw== |
50 |
+=gv1w |
51 |
+-----END PGP SIGNATURE----- |
52 |
|
53 |
diff --git a/sys-apps/lshw/files/lshw-02.18b-fixes.patch b/sys-apps/lshw/files/lshw-02.18b-fixes.patch |
54 |
new file mode 100644 |
55 |
index 0000000..ce395e1 |
56 |
--- /dev/null |
57 |
+++ b/sys-apps/lshw/files/lshw-02.18b-fixes.patch |
58 |
@@ -0,0 +1,188 @@ |
59 |
+diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc |
60 |
+index 5a2b8c0..c5100d8 100644 |
61 |
+--- a/src/core/cpuinfo.cc |
62 |
++++ b/src/core/cpuinfo.cc |
63 |
+@@ -16,7 +16,7 @@ static int currentcpu = 0; |
64 |
+ static hwNode *getcpu(hwNode & node, |
65 |
+ int n = 0) |
66 |
+ { |
67 |
+- char cpubusinfo[10]; |
68 |
++ char cpubusinfo[16]; |
69 |
+ hwNode *cpu = NULL; |
70 |
+ |
71 |
+ if (n < 0) |
72 |
+diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc |
73 |
+index 2823233..3ffd316 100644 |
74 |
+--- a/src/core/device-tree.cc |
75 |
++++ b/src/core/device-tree.cc |
76 |
+@@ -420,7 +420,7 @@ static void scan_devtree_memory(hwNode & core) |
77 |
+ |
78 |
+ while (true) |
79 |
+ { |
80 |
+- char buffer[10]; |
81 |
++ char buffer[16]; |
82 |
+ string mcbase; |
83 |
+ vector < string > slotnames; |
84 |
+ vector < string > dimmtypes; |
85 |
+diff --git a/src/core/hw.h b/src/core/hw.h |
86 |
+index 4211a82..8adaf3f 100644 |
87 |
+--- a/src/core/hw.h |
88 |
++++ b/src/core/hw.h |
89 |
+@@ -3,6 +3,7 @@ |
90 |
+ |
91 |
+ #include <string> |
92 |
+ #include <vector> |
93 |
++#include <libgen.h> |
94 |
+ |
95 |
+ using namespace std; |
96 |
+ |
97 |
+diff --git a/src/core/network.cc b/src/core/network.cc |
98 |
+index 15a961d..8bdb3fa 100644 |
99 |
+--- a/src/core/network.cc |
100 |
++++ b/src/core/network.cc |
101 |
+@@ -396,7 +396,7 @@ bool scan_network(hwNode & n) |
102 |
+ |
103 |
+ // check for wireless extensions |
104 |
+ memset(buffer, 0, sizeof(buffer)); |
105 |
+- strncpy(buffer, interfaces[i].c_str(), sizeof(buffer)); |
106 |
++ strncpy(buffer, interfaces[i].c_str(), sizeof(buffer)-1); |
107 |
+ if (ioctl(fd, SIOCGIWNAME, &buffer) == 0) |
108 |
+ { |
109 |
+ interface.addCapability("wireless", _("Wireless-LAN")); |
110 |
+diff --git a/src/core/partitions.cc b/src/core/partitions.cc |
111 |
+index 634a8c0..44f69d1 100644 |
112 |
+--- a/src/core/partitions.cc |
113 |
++++ b/src/core/partitions.cc |
114 |
+@@ -690,7 +690,7 @@ static bool detect_gpt(source & s, hwNode & n) |
115 |
+ static uint8_t buffer[BLOCKSIZE]; |
116 |
+ static gpth gpt_header; |
117 |
+ uint32_t i = 0; |
118 |
+- char gpt_version[8]; |
119 |
++ char gpt_version[16]; |
120 |
+ uint8_t *partitions = NULL; |
121 |
+ uint8_t type; |
122 |
+ |
123 |
+@@ -1108,11 +1108,11 @@ static bool detect_gpt(source & s, hwNode & n) |
124 |
+ partition.setConfig("name", p.PartitionName); |
125 |
+ if(p.Attributes && PARTITION_PRECIOUS) |
126 |
+ partition.addCapability("precious", "This partition is required for the platform to function"); |
127 |
+- if(p.Attributes && PARTITION_READONLY) |
128 |
++ if(p.Attributes & PARTITION_READONLY) |
129 |
+ partition.addCapability("readonly", "Read-only partition"); |
130 |
+- if(p.Attributes && PARTITION_HIDDEN) |
131 |
++ if(p.Attributes & PARTITION_HIDDEN) |
132 |
+ partition.addCapability("hidden"); |
133 |
+- if(p.Attributes && PARTITION_NOMOUNT) |
134 |
++ if(p.Attributes & PARTITION_NOMOUNT) |
135 |
+ partition.addCapability("nomount", "No automatic mount"); |
136 |
+ |
137 |
+ partition.describeCapability("nofs", "No filesystem"); |
138 |
+diff --git a/src/core/scsi.cc b/src/core/scsi.cc |
139 |
+index afc582b..dd0699f 100644 |
140 |
+--- a/src/core/scsi.cc |
141 |
++++ b/src/core/scsi.cc |
142 |
+@@ -210,7 +210,7 @@ int channel = -1, |
143 |
+ int id = -1, |
144 |
+ int lun = -1) |
145 |
+ { |
146 |
+- char buffer[10]; |
147 |
++ char buffer[16]; |
148 |
+ string result = "SCSI:"; |
149 |
+ |
150 |
+ snprintf(buffer, sizeof(buffer), "%02d", host); |
151 |
+diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc |
152 |
+index acc9d00..24f7152 100644 |
153 |
+--- a/src/core/sysfs.cc |
154 |
++++ b/src/core/sysfs.cc |
155 |
+@@ -97,9 +97,11 @@ static string sysfs_getbustype(const string & path) |
156 |
+ |
157 |
+ for (i = 0; i < n; i++) |
158 |
+ { |
159 |
++ char *tmp_path = strdup(path.c_str()); |
160 |
+ devname = |
161 |
+ string(fs.path + "/bus/") + string(namelist[i]->d_name) + |
162 |
+- "/devices/" + basename(path.c_str()); |
163 |
++ "/devices/" + basename(tmp_path); |
164 |
++ free (tmp_path); |
165 |
+ |
166 |
+ if (samefile(devname, path)) |
167 |
+ return string(namelist[i]->d_name); |
168 |
+@@ -139,7 +141,9 @@ static string sysfstobusinfo(const string & path) |
169 |
+ |
170 |
+ if (bustype == "virtio") |
171 |
+ { |
172 |
+- string name = basename(path.c_str()); |
173 |
++ char *tmp_path = strdup(path.c_str()); |
174 |
++ string name = basename(tmp_path); |
175 |
++ free(tmp_path); |
176 |
+ if (name.compare(0, 6, "virtio") == 0) |
177 |
+ return "virtio@" + name.substr(6); |
178 |
+ else |
179 |
+@@ -207,7 +211,10 @@ string entry::driver() const |
180 |
+ string driverlink = This->devpath + "/driver"; |
181 |
+ if (!exists(driverlink)) |
182 |
+ return ""; |
183 |
+- return basename(readlink(driverlink).c_str()); |
184 |
++ char *tmp_path = strdup(readlink(driverlink).c_str()); |
185 |
++ driverlink = string(basename(tmp_path)); |
186 |
++ free(tmp_path); |
187 |
++ return driverlink; |
188 |
+ } |
189 |
+ |
190 |
+ |
191 |
+@@ -288,7 +295,10 @@ string entry::name_in_class(const string & classname) const |
192 |
+ |
193 |
+ string entry::name() const |
194 |
+ { |
195 |
+- return basename(This->devpath.c_str()); |
196 |
++ char *tmp_path = strdup(This->devpath.c_str()); |
197 |
++ string name = string(basename(tmp_path)); |
198 |
++ free(tmp_path); |
199 |
++ return name; |
200 |
+ } |
201 |
+ |
202 |
+ |
203 |
+diff --git a/src/core/volumes.cc b/src/core/volumes.cc |
204 |
+index b433956..1185e34 100644 |
205 |
+--- a/src/core/volumes.cc |
206 |
++++ b/src/core/volumes.cc |
207 |
+@@ -446,7 +446,7 @@ static string dos_serial(unsigned long serial) |
208 |
+ { |
209 |
+ char buffer[16]; |
210 |
+ |
211 |
+- snprintf(buffer, sizeof(buffer), "%04lx-%04lx", serial >> 16, serial & 0xffff); |
212 |
++ snprintf(buffer, sizeof(buffer), "%04lx-%04lx", (serial >> 16) & 0xffff, serial & 0xffff); |
213 |
+ |
214 |
+ return string(buffer); |
215 |
+ } |
216 |
+@@ -987,13 +987,13 @@ static bool detect_ntfs(hwNode & n, source & s) |
217 |
+ else |
218 |
+ n.setConfig("state", "clean"); |
219 |
+ |
220 |
+- if(vi->flags && VOLUME_MODIFIED_BY_CHKDSK) |
221 |
++ if(vi->flags & VOLUME_MODIFIED_BY_CHKDSK) |
222 |
+ n.setConfig("modified_by_chkdsk", "true"); |
223 |
+- if(vi->flags && VOLUME_MOUNTED_ON_NT4) |
224 |
++ if(vi->flags & VOLUME_MOUNTED_ON_NT4) |
225 |
+ n.setConfig("mounted_on_nt4", "true"); |
226 |
+- if(vi->flags && VOLUME_UPGRADE_ON_MOUNT) |
227 |
++ if(vi->flags & VOLUME_UPGRADE_ON_MOUNT) |
228 |
+ n.setConfig("upgrade_on_mount", "true"); |
229 |
+- if(vi->flags && VOLUME_RESIZE_LOG_FILE) |
230 |
++ if(vi->flags & VOLUME_RESIZE_LOG_FILE) |
231 |
+ n.setConfig("resize_log_file", "true"); |
232 |
+ } |
233 |
+ if(info) |
234 |
+diff --git a/src/lshw.cc b/src/lshw.cc |
235 |
+index 77a5932..74643fc 100644 |
236 |
+--- a/src/lshw.cc |
237 |
++++ b/src/lshw.cc |
238 |
+@@ -219,7 +219,7 @@ char **argv) |
239 |
+ exit(1); |
240 |
+ } |
241 |
+ |
242 |
+- if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", NULL); |
243 |
++ if(enabled("output:X")) execl(SBINDIR"/gtk-lshw", SBINDIR"/gtk-lshw", (char *)NULL); |
244 |
+ |
245 |
+ if (geteuid() != 0) |
246 |
+ { |
247 |
|
248 |
diff --git a/sys-apps/lshw/files/lshw-02.18b-gentoo.patch b/sys-apps/lshw/files/lshw-02.18b-gentoo.patch |
249 |
new file mode 100644 |
250 |
index 0000000..0a50e9d |
251 |
--- /dev/null |
252 |
+++ b/sys-apps/lshw/files/lshw-02.18b-gentoo.patch |
253 |
@@ -0,0 +1,161 @@ |
254 |
+--- lshw-B.02.18/src/Makefile |
255 |
++++ lshw-B.02.18/src/Makefile |
256 |
+@@ -21,11 +21,11 @@ |
257 |
+ CXX?=c++ |
258 |
+ INCLUDES=-I./core/ |
259 |
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" |
260 |
+-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
261 |
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
262 |
+ ifeq ($(SQLITE), 1) |
263 |
+ CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) |
264 |
+ endif |
265 |
+-LDFLAGS=-L./core/ -g |
266 |
++LDFLAGS += -L./core/ |
267 |
+ ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) |
268 |
+ LDFLAGS+= -Wl,--as-needed |
269 |
+ endif |
270 |
+@@ -39,27 +39,25 @@ |
271 |
+ export LIBS |
272 |
+ export LDFLAGS |
273 |
+ |
274 |
+-DATAFILES = pci.ids usb.ids oui.txt manuf.txt |
275 |
+- |
276 |
+-all: $(PACKAGENAME) $(PACKAGENAME).1 $(DATAFILES) |
277 |
++all: $(PACKAGENAME) $(PACKAGENAME).1 |
278 |
+ |
279 |
+ .cc.o: |
280 |
+ $(CXX) $(CXXFLAGS) -c $< -o $@ |
281 |
+ |
282 |
+ .PHONY: core |
283 |
+ core: |
284 |
+- +make -C core all |
285 |
++ $(MAKE) -C core all |
286 |
+ |
287 |
+ $(PACKAGENAME): core $(PACKAGENAME).o |
288 |
+ $(CXX) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS) |
289 |
+ |
290 |
+ .PHONY: po |
291 |
+ po: |
292 |
+- +make -C po all |
293 |
++ $(MAKE) -C po all |
294 |
+ |
295 |
+ .PHONY: gui |
296 |
+ gui: core |
297 |
+- +make -C gui all |
298 |
++ $(MAKE) -C gui all |
299 |
+ |
300 |
+ .PHONY: nologo |
301 |
+ nologo: |
302 |
+@@ -70,7 +68,6 @@ |
303 |
+ |
304 |
+ $(PACKAGENAME)-static: core core/lib$(PACKAGENAME).a $(PACKAGENAME).o |
305 |
+ $(CXX) $(LDSTATIC) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS) |
306 |
+- $(STRIP) $@ |
307 |
+ |
308 |
+ .PHONY: compressed |
309 |
+ compressed: $(PACKAGENAME)-compressed |
310 |
+@@ -93,14 +90,13 @@ |
311 |
+ manuf.txt: |
312 |
+ wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf |
313 |
+ |
314 |
+-install: all |
315 |
++install: |
316 |
+ $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) |
317 |
+ $(INSTALL) -m 0755 $(PACKAGENAME) $(DESTDIR)/$(SBINDIR) |
318 |
+ $(INSTALL) -d -m 0755 $(DESTDIR)/$(MANDIR)/man1 |
319 |
+ $(INSTALL) -m 0644 $(PACKAGENAME).1 $(DESTDIR)/$(MANDIR)/man1 |
320 |
+ $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME) |
321 |
+- $(INSTALL) -m 0644 $(DATAFILES) $(DESTDIR)/$(DATADIR)/$(PACKAGENAME) |
322 |
+- make -C po install |
323 |
++ $(MAKE) -C po install |
324 |
+ |
325 |
+ install-gui: gui |
326 |
+ $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) |
327 |
+@@ -112,8 +108,8 @@ |
328 |
+ |
329 |
+ clean: |
330 |
+ rm -f $(PACKAGENAME).o $(PACKAGENAME) $(PACKAGENAME)-static $(PACKAGENAME)-compressed |
331 |
+- make -C core clean |
332 |
+- make -C gui clean |
333 |
++ $(MAKE) -C core clean |
334 |
++ $(MAKE) -C gui clean |
335 |
+ |
336 |
+ .timestamp: |
337 |
+ date --utc +%Y%m%d%H%M%S > $@ |
338 |
+--- lshw-B.02.18/src/core/Makefile |
339 |
++++ lshw-B.02.18/src/core/Makefile |
340 |
+@@ -1,10 +1,9 @@ |
341 |
+ PACKAGENAME?=lshw |
342 |
+ |
343 |
+-CXX=c++ |
344 |
++CXX?=c++ |
345 |
+ INCLUDES= |
346 |
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" |
347 |
+-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
348 |
+-LDFLAGS= |
349 |
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
350 |
+ LDSTATIC= |
351 |
+ LIBS= |
352 |
+ |
353 |
+--- lshw-B.02.18/src/core/pci.cc |
354 |
++++ lshw-B.02.18/src/core/pci.cc |
355 |
+@@ -17,7 +17,7 @@ |
356 |
+ |
357 |
+ #define PROC_BUS_PCI "/proc/bus/pci" |
358 |
+ #define SYS_BUS_PCI "/sys/bus/pci" |
359 |
+-#define PCIID_PATH DATADIR"/pci.ids:/usr/share/lshw/pci.ids:/usr/local/share/pci.ids:/usr/share/pci.ids:/etc/pci.ids:/usr/share/hwdata/pci.ids:/usr/share/misc/pci.ids" |
360 |
++#define PCIID_PATH "/usr/share/misc/pci.ids" |
361 |
+ |
362 |
+ #define PCI_CLASS_REVISION 0x08 /* High 24 bits are class, low 8 revision */ |
363 |
+ #define PCI_VENDOR_ID 0x00 /* 16 bits */ |
364 |
+--- lshw-B.02.18/src/core/usb.cc |
365 |
++++ lshw-B.02.18/src/core/usb.cc |
366 |
+@@ -27,7 +27,7 @@ |
367 |
+ |
368 |
+ #define PROCBUSUSBDEVICES "/proc/bus/usb/devices" |
369 |
+ #define SYSKERNELDEBUGUSBDEVICES "/sys/kernel/debug/usb/devices" |
370 |
+-#define USBID_PATH DATADIR"/usb.ids:/usr/share/lshw/usb.ids:/usr/local/share/usb.ids:/usr/share/usb.ids:/etc/usb.ids:/usr/share/hwdata/usb.ids:/usr/share/misc/usb.ids" |
371 |
++#define USBID_PATH "/usr/share/misc/usb.ids" |
372 |
+ |
373 |
+ #define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ |
374 |
+ #define USB_CLASS_AUDIO 1 |
375 |
+--- lshw-B.02.18/src/gui/Makefile |
376 |
++++ lshw-B.02.18/src/gui/Makefile |
377 |
+@@ -1,5 +1,7 @@ |
378 |
+ PACKAGENAME?=lshw |
379 |
+ |
380 |
++SQLITE?=0 |
381 |
++ |
382 |
+ CXX?=c++ |
383 |
+ CC?=cc |
384 |
+ STRIP?=strip |
385 |
+@@ -8,14 +10,15 @@ |
386 |
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" |
387 |
+ GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags) |
388 |
+ INCLUDES=-I../core $(GTKINCLUDES) |
389 |
+-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
390 |
++CXXFLAGS += -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) |
391 |
+ CFLAGS=$(CXXFLAGS) $(DEFINES) |
392 |
+ GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs) |
393 |
+-LIBS=-L../core -llshw -lresolv $(GTKLIBS) |
394 |
+-LDFLAGS= |
395 |
+-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) |
396 |
+- LDFLAGS+= -Wl,--as-needed |
397 |
+-endif |
398 |
++LIBS=-L../core -llshw -lresolv $(GTKLIBS) |
399 |
++ |
400 |
++ifeq ($(SQLITE), 1) |
401 |
++ CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) |
402 |
++ LIBS+= $(shell pkg-config --libs sqlite3) |
403 |
++endif |
404 |
+ |
405 |
+ OBJS = gtk-lshw.o callbacks.o engine.o print-gui.o stock.o |
406 |
+ SRCS = $(OBJS:.o=.c) |
407 |
+@@ -39,7 +42,6 @@ |
408 |
+ $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) |
409 |
+ |
410 |
+ install: all |
411 |
+- $(STRIP) gtk-$(PACKAGENAME) |
412 |
+ |
413 |
+ clean: |
414 |
+ rm -f $(OBJS) gtk-$(PACKAGENAME) gtk-lshw.glade.bak gtk-lshw.gladep.bak callbacks.c.bak callbacks.h.bak Makefile.bak |
415 |
|
416 |
diff --git a/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch b/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch |
417 |
new file mode 100644 |
418 |
index 0000000..4aea642 |
419 |
--- /dev/null |
420 |
+++ b/sys-apps/lshw/files/lshw-02.18b-gettext-array.patch |
421 |
@@ -0,0 +1,31 @@ |
422 |
+patch sent upstream |
423 |
+ |
424 |
+From 1fb7ebed787ec1b73218c1f12cbb71b103433375 Mon Sep 17 00:00:00 2001 |
425 |
+From: Mike Frysinger <vapier@g.o> |
426 |
+Date: Tue, 14 Mar 2017 22:25:12 -0700 |
427 |
+Subject: [PATCH] fix array access with string translations |
428 |
+ |
429 |
+The code forgot to rebase the num to 0 before indexing the string array. |
430 |
+It also provides 5 strings, but was only allowing 4 to be accessed. |
431 |
+--- |
432 |
+ src/core/dmi.cc | 4 ++-- |
433 |
+ 1 file changed, 2 insertions(+), 2 deletions(-) |
434 |
+ |
435 |
+diff --git a/src/core/dmi.cc b/src/core/dmi.cc |
436 |
+index 250f48572d54..0db074975f2d 100644 |
437 |
+--- a/src/core/dmi.cc |
438 |
++++ b/src/core/dmi.cc |
439 |
+@@ -510,8 +510,8 @@ static const char *dmi_memory_array_location(u8 num) |
440 |
+ }; |
441 |
+ if (num <= 0x0A) |
442 |
+ return _(memory_array_location[num]); |
443 |
+- if (num >= 0xA0 && num < 0xA4) |
444 |
+- return _(jp_memory_array_location[num]); |
445 |
++ if (num >= 0xA0 && num <= 0xA4) |
446 |
++ return _(jp_memory_array_location[num - 0xA0]); |
447 |
+ return ""; |
448 |
+ } |
449 |
+ |
450 |
+-- |
451 |
+2.12.0 |
452 |
+ |
453 |
|
454 |
diff --git a/sys-apps/lshw/files/lshw-02.18b-sgx.patch b/sys-apps/lshw/files/lshw-02.18b-sgx.patch |
455 |
new file mode 100644 |
456 |
index 0000000..92bd6c2 |
457 |
--- /dev/null |
458 |
+++ b/sys-apps/lshw/files/lshw-02.18b-sgx.patch |
459 |
@@ -0,0 +1,32 @@ |
460 |
+patch from upstream: |
461 |
+https://ezix.org/src/pkg/lshw/commit/5e5744732b2dcdf83845919256388b3842033183 |
462 |
+ |
463 |
+From 5e5744732b2dcdf83845919256388b3842033183 Mon Sep 17 00:00:00 2001 |
464 |
+From: Wenkai Du <wenkai.du@×××××.com> |
465 |
+Date: Fri, 22 Dec 2017 09:57:57 -0800 |
466 |
+Subject: [PATCH] lshw: fix segmentation fault when /dev/sgx is present |
467 |
+ |
468 |
+When Intel SGX is enabled in kernel, /dev/sgx is created and is |
469 |
+picked up by "/dev/sg*" glob matching. |
470 |
+ |
471 |
+Signed-off-by: Wenkai Du <wenkai.du@×××××.com> |
472 |
+--- |
473 |
+ src/core/scsi.cc | 2 +- |
474 |
+ 1 file changed, 1 insertion(+), 1 deletion(-) |
475 |
+ |
476 |
+diff --git a/src/core/scsi.cc b/src/core/scsi.cc |
477 |
+index b38dda2cd8a8..75061c0fb195 100644 |
478 |
+--- a/src/core/scsi.cc |
479 |
++++ b/src/core/scsi.cc |
480 |
+@@ -30,7 +30,7 @@ |
481 |
+ |
482 |
+ __ID("@(#) $Id$"); |
483 |
+ |
484 |
+-#define SG_X "/dev/sg*" |
485 |
++#define SG_X "/dev/sg[0-9]*" |
486 |
+ #define SG_MAJOR 21 |
487 |
+ |
488 |
+ #ifndef SCSI_IOCTL_GET_PCI |
489 |
+-- |
490 |
+2.15.1 |
491 |
+ |
492 |
|
493 |
diff --git a/sys-apps/lshw/lshw-02.18b-r2.ebuild b/sys-apps/lshw/lshw-02.18b-r2.ebuild |
494 |
new file mode 100644 |
495 |
index 0000000..e2254b7 |
496 |
--- /dev/null |
497 |
+++ b/sys-apps/lshw/lshw-02.18b-r2.ebuild |
498 |
@@ -0,0 +1,72 @@ |
499 |
+# Copyright 1999-2018 Gentoo Authors |
500 |
+# Distributed under the terms of the GNU General Public License v2 |
501 |
+ |
502 |
+EAPI="7" |
503 |
+ |
504 |
+PLOCALES='fr' |
505 |
+ |
506 |
+inherit flag-o-matic toolchain-funcs l10n desktop |
507 |
+ |
508 |
+MAJ_PV=$(ver_cut 1-2) |
509 |
+MIN_PV=$(ver_cut 3) |
510 |
+ |
511 |
+MY_P="$PN-${MIN_PV^^}.$MAJ_PV" |
512 |
+DESCRIPTION="Hardware Lister" |
513 |
+HOMEPAGE="https://www.ezix.org/project/wiki/HardwareLiSter" |
514 |
+SRC_URI="https://www.ezix.org/software/files/${MY_P}.tar.gz" |
515 |
+ |
516 |
+LICENSE="GPL-2" |
517 |
+SLOT="0" |
518 |
+KEYWORDS="amd64 arm ~arm64 ~mips ~ppc ~x86" |
519 |
+IUSE="gtk sqlite static" |
520 |
+ |
521 |
+REQUIRED_USE="static? ( !gtk )" |
522 |
+ |
523 |
+RDEPEND="gtk? ( x11-libs/gtk+:2 ) |
524 |
+ sqlite? ( dev-db/sqlite:3 )" |
525 |
+DEPEND="${RDEPEND} |
526 |
+ gtk? ( virtual/pkgconfig ) |
527 |
+ sqlite? ( virtual/pkgconfig )" |
528 |
+RDEPEND="${RDEPEND} |
529 |
+ sys-apps/hwids" |
530 |
+ |
531 |
+S="${WORKDIR}/${MY_P}" |
532 |
+ |
533 |
+PATCHES=( |
534 |
+ "${FILESDIR}/${PN}-02.18b-gentoo.patch" |
535 |
+ "${FILESDIR}/${PN}-02.18b-gettext-array.patch" |
536 |
+ "${FILESDIR}/${PN}-02.18b-sgx.patch" |
537 |
+ "${FILESDIR}/${PN}-02.18b-fixes.patch" |
538 |
+) |
539 |
+ |
540 |
+src_prepare() { |
541 |
+ default |
542 |
+ l10n_find_plocales_changes "src/po" "" ".po" || die |
543 |
+ sed -i \ |
544 |
+ -e "/^LANGUAGES =/ s/=.*/= $(l10n_get_locales)/" \ |
545 |
+ src/po/Makefile || die |
546 |
+ sed -i \ |
547 |
+ -e 's:\<pkg-config\>:${PKG_CONFIG}:' \ |
548 |
+ src/Makefile src/gui/Makefile || die |
549 |
+} |
550 |
+ |
551 |
+src_compile() { |
552 |
+ tc-export CC CXX AR PKG_CONFIG |
553 |
+ use static && append-ldflags -static |
554 |
+ |
555 |
+ # Need two sep make statements to avoid parallel build issues. #588174 |
556 |
+ local sqlite=$(usex sqlite 1 0) |
557 |
+ emake SQLITE=${sqlite} all |
558 |
+ use gtk && emake SQLITE=${sqlite} gui |
559 |
+} |
560 |
+ |
561 |
+src_install() { |
562 |
+ emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install $(usex gtk 'install-gui' '') |
563 |
+ dodoc README.md docs/* |
564 |
+ if use gtk ; then |
565 |
+ newicon -s scalable src/gui/artwork/logo.svg gtk-lshw.svg |
566 |
+ make_desktop_entry \ |
567 |
+ "${EPREFIX}"/usr/sbin/gtk-lshw \ |
568 |
+ "${DESCRIPTION}" |
569 |
+ fi |
570 |
+} |
571 |
|
572 |
diff --git a/sys-apps/lshw/metadata.xml b/sys-apps/lshw/metadata.xml |
573 |
new file mode 100644 |
574 |
index 0000000..56c1244 |
575 |
--- /dev/null |
576 |
+++ b/sys-apps/lshw/metadata.xml |
577 |
@@ -0,0 +1,8 @@ |
578 |
+<?xml version="1.0" encoding="UTF-8"?> |
579 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
580 |
+<pkgmetadata> |
581 |
+<maintainer type="project"> |
582 |
+ <email>base-system@g.o</email> |
583 |
+ <name>Gentoo Base System</name> |
584 |
+</maintainer> |
585 |
+</pkgmetadata> |