1 |
commit: 9bf0896d92caad00a6d07958fc934233db3f7d9b |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Oct 29 20:28:19 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Oct 29 20:32:05 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bf0896d |
7 |
|
8 |
sys-kernel/linux-firmware: use copy-firmware.sh to install firmwares |
9 |
|
10 |
copy-firmware.sh will honor WHENCE file and will take care of |
11 |
symlinked firmwares. |
12 |
|
13 |
Closes: https://bugs.gentoo.org/751760 |
14 |
Package-Manager: Portage-3.0.8, Repoman-3.0.2 |
15 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
16 |
|
17 |
...22.ebuild => linux-firmware-20201022-r1.ebuild} | 160 ++++++++++----------- |
18 |
.../linux-firmware/linux-firmware-99999999.ebuild | 160 ++++++++++----------- |
19 |
2 files changed, 148 insertions(+), 172 deletions(-) |
20 |
|
21 |
diff --git a/sys-kernel/linux-firmware/linux-firmware-20201022.ebuild b/sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild |
22 |
similarity index 85% |
23 |
rename from sys-kernel/linux-firmware/linux-firmware-20201022.ebuild |
24 |
rename to sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild |
25 |
index 736bd949345..fcd90451c74 100644 |
26 |
--- a/sys-kernel/linux-firmware/linux-firmware-20201022.ebuild |
27 |
+++ b/sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild |
28 |
@@ -30,11 +30,11 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) |
29 |
unknown-license? ( all-rights-reserved )" |
30 |
SLOT="0" |
31 |
IUSE="initramfs +redistributable savedconfig unknown-license" |
32 |
+REQUIRED_USE="initramfs? ( redistributable )" |
33 |
+ |
34 |
RESTRICT="binchecks strip |
35 |
unknown-license? ( bindist )" |
36 |
|
37 |
-REQUIRED_USE="initramfs? ( redistributable )" |
38 |
- |
39 |
BDEPEND="initramfs? ( app-arch/cpio )" |
40 |
|
41 |
#add anything else that collides to this |
42 |
@@ -60,6 +60,8 @@ RDEPEND="!savedconfig? ( |
43 |
) |
44 |
)" |
45 |
|
46 |
+QA_PREBUILT="*" |
47 |
+ |
48 |
pkg_pretend() { |
49 |
use initramfs && mount-boot_pkg_pretend |
50 |
} |
51 |
@@ -77,31 +79,40 @@ src_unpack() { |
52 |
} |
53 |
|
54 |
src_prepare() { |
55 |
- # source and documentation files, not to be installed |
56 |
- local source_files=( |
57 |
- README |
58 |
- WHENCE |
59 |
- "LICEN[CS]E*" |
60 |
- "GPL*" |
61 |
- configure |
62 |
- Makefile |
63 |
- check_whence.py |
64 |
- atusb/ChangeLog |
65 |
- av7110/Boot.S |
66 |
- av7110/Makefile |
67 |
- carl9170fw/ |
68 |
- cis/Makefile |
69 |
- cis/src/ |
70 |
- dsp56k/bootstrap.asm |
71 |
- dsp56k/concat-bootstrap.pl |
72 |
- dsp56k/Makefile |
73 |
- "isci/*.[ch]" |
74 |
- isci/Makefile |
75 |
- isci/README |
76 |
- "keyspan_pda/*.S" |
77 |
- keyspan_pda/Makefile |
78 |
- usbdux/ |
79 |
- ) |
80 |
+ default |
81 |
+ |
82 |
+ find . -type f -not -perm 0644 -print0 \ |
83 |
+ | xargs --null --no-run-if-empty chmod 0644 \ |
84 |
+ || die |
85 |
+ |
86 |
+ chmod +x copy-firmware.sh || die |
87 |
+ |
88 |
+ if use initramfs; then |
89 |
+ if [[ -d "${S}/amd-ucode" ]]; then |
90 |
+ local UCODETMP="${T}/ucode_tmp" |
91 |
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode" |
92 |
+ mkdir -p "${UCODEDIR}" || die |
93 |
+ echo 1 > "${UCODETMP}/early_cpio" |
94 |
+ |
95 |
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin" |
96 |
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode" |
97 |
+ |
98 |
+ if [[ ! -s "${amd_ucode_file}" ]]; then |
99 |
+ die "Sanity check failed: '${amd_ucode_file}' is empty!" |
100 |
+ fi |
101 |
+ |
102 |
+ pushd "${UCODETMP}" &>/dev/null || die |
103 |
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img |
104 |
+ popd &>/dev/null || die |
105 |
+ if [[ ! -s "${S}/amd-uc.img" ]]; then |
106 |
+ die "Failed to create '${S}/amd-uc.img'!" |
107 |
+ fi |
108 |
+ else |
109 |
+ # If this will ever happen something has changed which |
110 |
+ # must be reviewed |
111 |
+ die "'${S}/amd-ucode' not found!" |
112 |
+ fi |
113 |
+ fi |
114 |
|
115 |
# whitelist of images with a free software license |
116 |
local free_software=( |
117 |
@@ -217,90 +228,67 @@ src_prepare() { |
118 |
lgs8g75.fw |
119 |
) |
120 |
|
121 |
- default |
122 |
- |
123 |
- # remove sources and documentation (wildcards are expanded) |
124 |
- rm -r ${source_files[@]} || die |
125 |
- rm -rf .git |
126 |
- |
127 |
if use !unknown-license; then |
128 |
- # remove files in unknown_license |
129 |
- rm "${unknown_license[@]}" || die |
130 |
+ einfo "Removing files with unknown license ..." |
131 |
+ rm -v "${unknown_license[@]}" || die |
132 |
fi |
133 |
|
134 |
if use !redistributable; then |
135 |
# remove files _not_ in the free_software or unknown_license lists |
136 |
# everything else is confirmed (or assumed) to be redistributable |
137 |
# based on upstream acceptance policy |
138 |
- local IFS=$'\n' |
139 |
- find ! -type d -printf "%P\n" \ |
140 |
+ einfo "Removing non-redistributable files ..." |
141 |
+ IFS=$'\n' find ! -type d -printf "%P\n" \ |
142 |
| grep -Fvx -e "${free_software[*]}" -e "${unknown_license[*]}" \ |
143 |
- | xargs -d '\n' rm || die |
144 |
- IFS=$' \t\n' |
145 |
+ | xargs -d '\n' rm -v || die |
146 |
fi |
147 |
|
148 |
- if use initramfs; then |
149 |
- if [[ -d "${S}/amd-ucode" ]]; then |
150 |
- local UCODETMP="${T}/ucode_tmp" |
151 |
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode" |
152 |
- mkdir -p "${UCODEDIR}" || die |
153 |
- echo 1 > "${UCODETMP}/early_cpio" |
154 |
- |
155 |
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin" |
156 |
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode" |
157 |
- |
158 |
- if [[ ! -s "${amd_ucode_file}" ]]; then |
159 |
- die "Sanity check failed: '${amd_ucode_file}' is empty!" |
160 |
- fi |
161 |
+ restore_config ${PN}.conf |
162 |
+} |
163 |
|
164 |
- pushd "${UCODETMP}" &>/dev/null || die |
165 |
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img |
166 |
- popd &>/dev/null || die |
167 |
- if [[ ! -s "${S}/amd-uc.img" ]]; then |
168 |
- die "Failed to create '${S}/amd-uc.img'!" |
169 |
- fi |
170 |
- else |
171 |
- # If this will ever happen something has changed which |
172 |
- # must be reviewed |
173 |
- die "'${S}/amd-ucode' not found!" |
174 |
- fi |
175 |
- fi |
176 |
+src_install() { |
177 |
+ ./copy-firmware.sh -v "${ED}/lib/firmware" || die |
178 |
|
179 |
- echo "# Remove files that shall not be installed from this list." > ${PN}.conf |
180 |
- find * ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) >> ${PN}.conf |
181 |
+ pushd "${ED}/lib/firmware" &>/dev/null || die |
182 |
|
183 |
if use savedconfig; then |
184 |
- restore_config ${PN}.conf |
185 |
- |
186 |
- ebegin "Removing all files not listed in config" |
187 |
- find ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) -printf "%P\n" \ |
188 |
- | grep -Fvx -f <(grep -v '^#' ${PN}.conf \ |
189 |
- || die "grep failed, empty config file?") \ |
190 |
- | xargs -d '\n' --no-run-if-empty rm |
191 |
- eend $? || die |
192 |
+ if [[ -s "${S}/${PN}.conf" ]]; then |
193 |
+ local files_to_keep="${T}/files_to_keep.lst" |
194 |
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die |
195 |
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" |
196 |
+ |
197 |
+ einfo "Applying USE=savedconfig; Removing all files not listed in config ..." |
198 |
+ set -o pipefail |
199 |
+ find ! -type d -printf "%P\n" \ |
200 |
+ | grep -Fvx -f "${files_to_keep}" \ |
201 |
+ | xargs -d '\n' --no-run-if-empty rm -v |
202 |
+ |
203 |
+ [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config" |
204 |
+ fi |
205 |
fi |
206 |
|
207 |
# remove empty directories, bug #396073 |
208 |
find -type d -empty -delete || die |
209 |
-} |
210 |
- |
211 |
-src_install() { |
212 |
- save_config ${PN}.conf |
213 |
- rm ${PN}.conf || die |
214 |
- |
215 |
- if use initramfs ; then |
216 |
- mkdir "${ED}/boot" || die |
217 |
- mv "${S}"/amd-uc.img "${ED}/boot" || die |
218 |
- fi |
219 |
|
220 |
+ # sanity check |
221 |
if ! ( shopt -s failglob; : * ) 2>/dev/null; then |
222 |
eerror "No files to install. Check your USE flag settings" |
223 |
eerror "and the list of files in your saved configuration." |
224 |
die "Refusing to install an empty package" |
225 |
fi |
226 |
|
227 |
- insinto /lib/firmware/ |
228 |
- doins -r * |
229 |
+ if use savedconfig; then |
230 |
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die |
231 |
+ find * ! -type d >> "${S}"/${PN}.conf || die |
232 |
+ save_config "${S}"/${PN}.conf |
233 |
+ fi |
234 |
+ |
235 |
+ popd &>/dev/null || die |
236 |
+ |
237 |
+ if use initramfs ; then |
238 |
+ insinto /boot |
239 |
+ doins "${S}"/amd-uc.img |
240 |
+ fi |
241 |
} |
242 |
|
243 |
pkg_preinst() { |
244 |
|
245 |
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild |
246 |
index 736bd949345..fcd90451c74 100644 |
247 |
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild |
248 |
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild |
249 |
@@ -30,11 +30,11 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 ) |
250 |
unknown-license? ( all-rights-reserved )" |
251 |
SLOT="0" |
252 |
IUSE="initramfs +redistributable savedconfig unknown-license" |
253 |
+REQUIRED_USE="initramfs? ( redistributable )" |
254 |
+ |
255 |
RESTRICT="binchecks strip |
256 |
unknown-license? ( bindist )" |
257 |
|
258 |
-REQUIRED_USE="initramfs? ( redistributable )" |
259 |
- |
260 |
BDEPEND="initramfs? ( app-arch/cpio )" |
261 |
|
262 |
#add anything else that collides to this |
263 |
@@ -60,6 +60,8 @@ RDEPEND="!savedconfig? ( |
264 |
) |
265 |
)" |
266 |
|
267 |
+QA_PREBUILT="*" |
268 |
+ |
269 |
pkg_pretend() { |
270 |
use initramfs && mount-boot_pkg_pretend |
271 |
} |
272 |
@@ -77,31 +79,40 @@ src_unpack() { |
273 |
} |
274 |
|
275 |
src_prepare() { |
276 |
- # source and documentation files, not to be installed |
277 |
- local source_files=( |
278 |
- README |
279 |
- WHENCE |
280 |
- "LICEN[CS]E*" |
281 |
- "GPL*" |
282 |
- configure |
283 |
- Makefile |
284 |
- check_whence.py |
285 |
- atusb/ChangeLog |
286 |
- av7110/Boot.S |
287 |
- av7110/Makefile |
288 |
- carl9170fw/ |
289 |
- cis/Makefile |
290 |
- cis/src/ |
291 |
- dsp56k/bootstrap.asm |
292 |
- dsp56k/concat-bootstrap.pl |
293 |
- dsp56k/Makefile |
294 |
- "isci/*.[ch]" |
295 |
- isci/Makefile |
296 |
- isci/README |
297 |
- "keyspan_pda/*.S" |
298 |
- keyspan_pda/Makefile |
299 |
- usbdux/ |
300 |
- ) |
301 |
+ default |
302 |
+ |
303 |
+ find . -type f -not -perm 0644 -print0 \ |
304 |
+ | xargs --null --no-run-if-empty chmod 0644 \ |
305 |
+ || die |
306 |
+ |
307 |
+ chmod +x copy-firmware.sh || die |
308 |
+ |
309 |
+ if use initramfs; then |
310 |
+ if [[ -d "${S}/amd-ucode" ]]; then |
311 |
+ local UCODETMP="${T}/ucode_tmp" |
312 |
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode" |
313 |
+ mkdir -p "${UCODEDIR}" || die |
314 |
+ echo 1 > "${UCODETMP}/early_cpio" |
315 |
+ |
316 |
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin" |
317 |
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode" |
318 |
+ |
319 |
+ if [[ ! -s "${amd_ucode_file}" ]]; then |
320 |
+ die "Sanity check failed: '${amd_ucode_file}' is empty!" |
321 |
+ fi |
322 |
+ |
323 |
+ pushd "${UCODETMP}" &>/dev/null || die |
324 |
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img |
325 |
+ popd &>/dev/null || die |
326 |
+ if [[ ! -s "${S}/amd-uc.img" ]]; then |
327 |
+ die "Failed to create '${S}/amd-uc.img'!" |
328 |
+ fi |
329 |
+ else |
330 |
+ # If this will ever happen something has changed which |
331 |
+ # must be reviewed |
332 |
+ die "'${S}/amd-ucode' not found!" |
333 |
+ fi |
334 |
+ fi |
335 |
|
336 |
# whitelist of images with a free software license |
337 |
local free_software=( |
338 |
@@ -217,90 +228,67 @@ src_prepare() { |
339 |
lgs8g75.fw |
340 |
) |
341 |
|
342 |
- default |
343 |
- |
344 |
- # remove sources and documentation (wildcards are expanded) |
345 |
- rm -r ${source_files[@]} || die |
346 |
- rm -rf .git |
347 |
- |
348 |
if use !unknown-license; then |
349 |
- # remove files in unknown_license |
350 |
- rm "${unknown_license[@]}" || die |
351 |
+ einfo "Removing files with unknown license ..." |
352 |
+ rm -v "${unknown_license[@]}" || die |
353 |
fi |
354 |
|
355 |
if use !redistributable; then |
356 |
# remove files _not_ in the free_software or unknown_license lists |
357 |
# everything else is confirmed (or assumed) to be redistributable |
358 |
# based on upstream acceptance policy |
359 |
- local IFS=$'\n' |
360 |
- find ! -type d -printf "%P\n" \ |
361 |
+ einfo "Removing non-redistributable files ..." |
362 |
+ IFS=$'\n' find ! -type d -printf "%P\n" \ |
363 |
| grep -Fvx -e "${free_software[*]}" -e "${unknown_license[*]}" \ |
364 |
- | xargs -d '\n' rm || die |
365 |
- IFS=$' \t\n' |
366 |
+ | xargs -d '\n' rm -v || die |
367 |
fi |
368 |
|
369 |
- if use initramfs; then |
370 |
- if [[ -d "${S}/amd-ucode" ]]; then |
371 |
- local UCODETMP="${T}/ucode_tmp" |
372 |
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode" |
373 |
- mkdir -p "${UCODEDIR}" || die |
374 |
- echo 1 > "${UCODETMP}/early_cpio" |
375 |
- |
376 |
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin" |
377 |
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode" |
378 |
- |
379 |
- if [[ ! -s "${amd_ucode_file}" ]]; then |
380 |
- die "Sanity check failed: '${amd_ucode_file}' is empty!" |
381 |
- fi |
382 |
+ restore_config ${PN}.conf |
383 |
+} |
384 |
|
385 |
- pushd "${UCODETMP}" &>/dev/null || die |
386 |
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img |
387 |
- popd &>/dev/null || die |
388 |
- if [[ ! -s "${S}/amd-uc.img" ]]; then |
389 |
- die "Failed to create '${S}/amd-uc.img'!" |
390 |
- fi |
391 |
- else |
392 |
- # If this will ever happen something has changed which |
393 |
- # must be reviewed |
394 |
- die "'${S}/amd-ucode' not found!" |
395 |
- fi |
396 |
- fi |
397 |
+src_install() { |
398 |
+ ./copy-firmware.sh -v "${ED}/lib/firmware" || die |
399 |
|
400 |
- echo "# Remove files that shall not be installed from this list." > ${PN}.conf |
401 |
- find * ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) >> ${PN}.conf |
402 |
+ pushd "${ED}/lib/firmware" &>/dev/null || die |
403 |
|
404 |
if use savedconfig; then |
405 |
- restore_config ${PN}.conf |
406 |
- |
407 |
- ebegin "Removing all files not listed in config" |
408 |
- find ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) -printf "%P\n" \ |
409 |
- | grep -Fvx -f <(grep -v '^#' ${PN}.conf \ |
410 |
- || die "grep failed, empty config file?") \ |
411 |
- | xargs -d '\n' --no-run-if-empty rm |
412 |
- eend $? || die |
413 |
+ if [[ -s "${S}/${PN}.conf" ]]; then |
414 |
+ local files_to_keep="${T}/files_to_keep.lst" |
415 |
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die |
416 |
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?" |
417 |
+ |
418 |
+ einfo "Applying USE=savedconfig; Removing all files not listed in config ..." |
419 |
+ set -o pipefail |
420 |
+ find ! -type d -printf "%P\n" \ |
421 |
+ | grep -Fvx -f "${files_to_keep}" \ |
422 |
+ | xargs -d '\n' --no-run-if-empty rm -v |
423 |
+ |
424 |
+ [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config" |
425 |
+ fi |
426 |
fi |
427 |
|
428 |
# remove empty directories, bug #396073 |
429 |
find -type d -empty -delete || die |
430 |
-} |
431 |
- |
432 |
-src_install() { |
433 |
- save_config ${PN}.conf |
434 |
- rm ${PN}.conf || die |
435 |
- |
436 |
- if use initramfs ; then |
437 |
- mkdir "${ED}/boot" || die |
438 |
- mv "${S}"/amd-uc.img "${ED}/boot" || die |
439 |
- fi |
440 |
|
441 |
+ # sanity check |
442 |
if ! ( shopt -s failglob; : * ) 2>/dev/null; then |
443 |
eerror "No files to install. Check your USE flag settings" |
444 |
eerror "and the list of files in your saved configuration." |
445 |
die "Refusing to install an empty package" |
446 |
fi |
447 |
|
448 |
- insinto /lib/firmware/ |
449 |
- doins -r * |
450 |
+ if use savedconfig; then |
451 |
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die |
452 |
+ find * ! -type d >> "${S}"/${PN}.conf || die |
453 |
+ save_config "${S}"/${PN}.conf |
454 |
+ fi |
455 |
+ |
456 |
+ popd &>/dev/null || die |
457 |
+ |
458 |
+ if use initramfs ; then |
459 |
+ insinto /boot |
460 |
+ doins "${S}"/amd-uc.img |
461 |
+ fi |
462 |
} |
463 |
|
464 |
pkg_preinst() { |