Diff linux-firmware-20241110 with a linux-firmware-99999999

/usr/portage/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild 2025-02-03 17:39:35.942678037 +0300
20 20
		SRC_URI="https://mirrors.edge.kernel.org/pub/linux/kernel/firmware/${P}.tar.xz"
21 21
	fi
22 22

  
23
	KEYWORDS="~alpha amd64 arm arm64 hppa ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86"
23
	KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
24 24
fi
25 25

  
26 26
DESCRIPTION="Linux firmware files"
......
30 30
	redistributable? ( linux-fw-redistributable BSD-2 BSD BSD-4 ISC MIT )
31 31
	unknown-license? ( all-rights-reserved )"
32 32
SLOT="0"
33
IUSE="bindist compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
33
IUSE="compress-xz compress-zstd deduplicate dist-kernel +initramfs +redistributable savedconfig unknown-license"
34 34
REQUIRED_USE="initramfs? ( redistributable )
35 35
	?? ( compress-xz compress-zstd )
36 36
	savedconfig? ( !deduplicate )"
37 37

  
38 38
RESTRICT="binchecks strip test
39
	!bindist? ( bindist )
40 39
	unknown-license? ( bindist )"
41 40

  
42 41
BDEPEND="initramfs? ( app-alternatives/cpio )
......
74 73

  
75 74
QA_PREBUILT="*"
76 75
PATCHES=(
77
	"${FILESDIR}"/${PN}-copy-firmware-r6.patch
76
	"${FILESDIR}"/${PN}-copy-firmware-r8.patch
78 77
)
79 78

  
80 79
pkg_pretend() {
......
90 89
}
91 90

  
92 91
pkg_setup() {
92

  
93
	python_setup
94

  
93 95
	if use compress-xz || use compress-zstd ; then
94 96
		local CONFIG_CHECK
95 97

  
......
136 138

  
137 139
	# whitelist of misc files
138 140
	local misc_files=(
139
		build_packages.py
140
		carl9170fw/autogen.sh
141
		carl9170fw/genapi.sh
142
		contrib/process_linux_firmware.py
143 141
		copy-firmware.sh
144
		check_whence.py
145 142
		dedup-firmware.sh
146
		LICEN[CS]E.*
147
		README.md
143
		check_whence.py
148 144
		WHENCE
145
		README
149 146
	)
150 147

  
151 148
	# whitelist of images with a free software license
......
213 210
		mellanox/mlxsw_spectrum-13.2000.1122.mfa2
214 211
	)
215 212

  
213
	if use !redistributable; then
214
		# remove files _not_ in the free_software or unknown_license lists
215
		# everything else is confirmed (or assumed) to be redistributable
216
		# based on upstream acceptance policy
217
		einfo "Removing non-redistributable files ..."
218
		local OLDIFS="${IFS}"
219
		local IFS=$'\n'
220
		set -o pipefail
221
		find ! -type d -printf "%P\n" \
222
			| grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
223
			| xargs -d '\n' --no-run-if-empty rm -v
224

  
225
		[[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
226

  
227
		IFS="${OLDIFS}"
228
	fi
229

  
230
	restore_config ${PN}.conf
231
}
232

  
233
src_install() {
234

  
235
	local FW_OPTIONS=( "-v" "-j1" )
236
	git config --global --add safe.directory "${S}" || die
237
	local files_to_keep=
238

  
239
	if use savedconfig; then
240
		if [[ -s "${S}/${PN}.conf" ]]; then
241
			files_to_keep="${T}/files_to_keep.lst"
242
			grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
243
			[[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
244
			FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
245
		fi
246
	fi
247

  
248
	if use compress-xz; then
249
		FW_OPTIONS+=( "--xz" )
250
	elif use compress-zstd; then
251
		FW_OPTIONS+=( "--zstd" )
252
	fi
253
	FW_OPTIONS+=( "${ED}/lib/firmware" )
254
	./copy-firmware.sh "${FW_OPTIONS[@]}" || die
255
	use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; }
256

  
216 257
	# blacklist of images with unknown license
217 258
	local unknown_license=(
218 259
		korg/k1212.dsp
......
262 303
		einfo "Removing files with unknown license ..."
263 304
		rm -v "${unknown_license[@]}" || die
264 305
	fi
265

  
266
	if use !redistributable; then
267
		# remove files _not_ in the free_software or unknown_license lists
268
		# everything else is confirmed (or assumed) to be redistributable
269
		# based on upstream acceptance policy
270
		einfo "Removing non-redistributable files ..."
271
		local OLDIFS="${IFS}"
272
		local IFS=$'\n'
273
		set -o pipefail
274
		find ! -type d -printf "%P\n" \
275
			| grep -Fvx -e "${misc_files[*]}" -e "${free_software[*]}" -e "${unknown_license[*]}" \
276
			| xargs -d '\n' --no-run-if-empty rm -v
277

  
278
		[[ ${?} -ne 0 ]] && die "Failed to remove non-redistributable files"
279

  
280
		IFS="${OLDIFS}"
281
	fi
282

  
283
	restore_config ${PN}.conf
284
}
285

  
286
src_install() {
287

  
288
	local FW_OPTIONS=( "-v" )
289
	local files_to_keep=
290

  
291
	if use savedconfig; then
292
		if [[ -s "${S}/${PN}.conf" ]]; then
293
			files_to_keep="${T}/files_to_keep.lst"
294
			grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
295
			[[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
296
			FW_OPTIONS+=( "--firmware-list" "${files_to_keep}" )
297
		fi
298
	fi
299

  
300
	if use compress-xz; then
301
		FW_OPTIONS+=( "--xz" )
302
	elif use compress-zstd; then
303
		FW_OPTIONS+=( "--zstd" )
304
	fi
305
	FW_OPTIONS+=( "${ED}/lib/firmware" )
306
	./copy-firmware.sh "${FW_OPTIONS[@]}" || die
307
	use deduplicate && { ./dedup-firmware.sh "${ED}/lib/firmware" || die; }
308

  
309 306
	pushd "${ED}/lib/firmware" &>/dev/null || die
310 307

  
311 308
	# especially use !redistributable will cause some broken symlinks
......
350 347
		insinto /boot
351 348
		doins "${S}"/amd-uc.img
352 349
	fi
353

  
354
	dodoc README.md
355
	# some licenses require copyright and permission notice to be included
356
	use bindist && dodoc WHENCE LICEN[CS]E.*
357 350
}
358 351

  
359 352
pkg_preinst() {
......
368 361

  
369 362
	# Make sure /boot is available if needed.
370 363
	use initramfs && ! use dist-kernel && mount-boot_pkg_preinst
364

  
371 365
}
372 366

  
373 367
pkg_postinst() {
Thank you!