summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-10-29 21:28:19 +0100
committerThomas Deutschmann <whissi@gentoo.org>2020-10-29 21:32:05 +0100
commit9bf0896d92caad00a6d07958fc934233db3f7d9b (patch)
treed172703475025f7dc0f800058d5a8a9854aac622 /sys-kernel/linux-firmware
parentapp-office/calligra: Drop 3.2.1 (r0) (diff)
downloadgentoo-9bf0896d92caad00a6d07958fc934233db3f7d9b.tar.gz
gentoo-9bf0896d92caad00a6d07958fc934233db3f7d9b.tar.bz2
gentoo-9bf0896d92caad00a6d07958fc934233db3f7d9b.zip
sys-kernel/linux-firmware: use copy-firmware.sh to install firmwares
copy-firmware.sh will honor WHENCE file and will take care of symlinked firmwares. Closes: https://bugs.gentoo.org/751760 Package-Manager: Portage-3.0.8, Repoman-3.0.2 Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'sys-kernel/linux-firmware')
-rw-r--r--sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild (renamed from sys-kernel/linux-firmware/linux-firmware-20201022.ebuild)160
-rw-r--r--sys-kernel/linux-firmware/linux-firmware-99999999.ebuild160
2 files changed, 148 insertions, 172 deletions
diff --git a/sys-kernel/linux-firmware/linux-firmware-20201022.ebuild b/sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild
index 736bd9493455..fcd90451c740 100644
--- a/sys-kernel/linux-firmware/linux-firmware-20201022.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-20201022-r1.ebuild
@@ -30,11 +30,11 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
unknown-license? ( all-rights-reserved )"
SLOT="0"
IUSE="initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )"
+
RESTRICT="binchecks strip
unknown-license? ( bindist )"
-REQUIRED_USE="initramfs? ( redistributable )"
-
BDEPEND="initramfs? ( app-arch/cpio )"
#add anything else that collides to this
@@ -60,6 +60,8 @@ RDEPEND="!savedconfig? (
)
)"
+QA_PREBUILT="*"
+
pkg_pretend() {
use initramfs && mount-boot_pkg_pretend
}
@@ -77,31 +79,40 @@ src_unpack() {
}
src_prepare() {
- # source and documentation files, not to be installed
- local source_files=(
- README
- WHENCE
- "LICEN[CS]E*"
- "GPL*"
- configure
- Makefile
- check_whence.py
- atusb/ChangeLog
- av7110/Boot.S
- av7110/Makefile
- carl9170fw/
- cis/Makefile
- cis/src/
- dsp56k/bootstrap.asm
- dsp56k/concat-bootstrap.pl
- dsp56k/Makefile
- "isci/*.[ch]"
- isci/Makefile
- isci/README
- "keyspan_pda/*.S"
- keyspan_pda/Makefile
- usbdux/
- )
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
# whitelist of images with a free software license
local free_software=(
@@ -217,90 +228,67 @@ src_prepare() {
lgs8g75.fw
)
- default
-
- # remove sources and documentation (wildcards are expanded)
- rm -r ${source_files[@]} || die
- rm -rf .git
-
if use !unknown-license; then
- # remove files in unknown_license
- rm "${unknown_license[@]}" || die
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
fi
if use !redistributable; then
# remove files _not_ in the free_software or unknown_license lists
# everything else is confirmed (or assumed) to be redistributable
# based on upstream acceptance policy
- local IFS=$'\n'
- find ! -type d -printf "%P\n" \
+ einfo "Removing non-redistributable files ..."
+ IFS=$'\n' find ! -type d -printf "%P\n" \
| grep -Fvx -e "${free_software[*]}" -e "${unknown_license[*]}" \
- | xargs -d '\n' rm || die
- IFS=$' \t\n'
+ | xargs -d '\n' rm -v || die
fi
- if use initramfs; then
- if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
+ restore_config ${PN}.conf
+}
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
- else
- # If this will ever happen something has changed which
- # must be reviewed
- die "'${S}/amd-ucode' not found!"
- fi
- fi
+src_install() {
+ ./copy-firmware.sh -v "${ED}/lib/firmware" || die
- echo "# Remove files that shall not be installed from this list." > ${PN}.conf
- find * ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) >> ${PN}.conf
+ pushd "${ED}/lib/firmware" &>/dev/null || die
if use savedconfig; then
- restore_config ${PN}.conf
-
- ebegin "Removing all files not listed in config"
- find ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) -printf "%P\n" \
- | grep -Fvx -f <(grep -v '^#' ${PN}.conf \
- || die "grep failed, empty config file?") \
- | xargs -d '\n' --no-run-if-empty rm
- eend $? || die
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ local files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+
+ einfo "Applying USE=savedconfig; Removing all files not listed in config ..."
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -f "${files_to_keep}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config"
+ fi
fi
# remove empty directories, bug #396073
find -type d -empty -delete || die
-}
-
-src_install() {
- save_config ${PN}.conf
- rm ${PN}.conf || die
-
- if use initramfs ; then
- mkdir "${ED}/boot" || die
- mv "${S}"/amd-uc.img "${ED}/boot" || die
- fi
+ # sanity check
if ! ( shopt -s failglob; : * ) 2>/dev/null; then
eerror "No files to install. Check your USE flag settings"
eerror "and the list of files in your saved configuration."
die "Refusing to install an empty package"
fi
- insinto /lib/firmware/
- doins -r *
+ if use savedconfig; then
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
}
pkg_preinst() {
diff --git a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
index 736bd9493455..fcd90451c740 100644
--- a/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
+++ b/sys-kernel/linux-firmware/linux-firmware-99999999.ebuild
@@ -30,11 +30,11 @@ LICENSE="GPL-2 GPL-2+ GPL-3 BSD MIT || ( MPL-1.1 GPL-2 )
unknown-license? ( all-rights-reserved )"
SLOT="0"
IUSE="initramfs +redistributable savedconfig unknown-license"
+REQUIRED_USE="initramfs? ( redistributable )"
+
RESTRICT="binchecks strip
unknown-license? ( bindist )"
-REQUIRED_USE="initramfs? ( redistributable )"
-
BDEPEND="initramfs? ( app-arch/cpio )"
#add anything else that collides to this
@@ -60,6 +60,8 @@ RDEPEND="!savedconfig? (
)
)"
+QA_PREBUILT="*"
+
pkg_pretend() {
use initramfs && mount-boot_pkg_pretend
}
@@ -77,31 +79,40 @@ src_unpack() {
}
src_prepare() {
- # source and documentation files, not to be installed
- local source_files=(
- README
- WHENCE
- "LICEN[CS]E*"
- "GPL*"
- configure
- Makefile
- check_whence.py
- atusb/ChangeLog
- av7110/Boot.S
- av7110/Makefile
- carl9170fw/
- cis/Makefile
- cis/src/
- dsp56k/bootstrap.asm
- dsp56k/concat-bootstrap.pl
- dsp56k/Makefile
- "isci/*.[ch]"
- isci/Makefile
- isci/README
- "keyspan_pda/*.S"
- keyspan_pda/Makefile
- usbdux/
- )
+ default
+
+ find . -type f -not -perm 0644 -print0 \
+ | xargs --null --no-run-if-empty chmod 0644 \
+ || die
+
+ chmod +x copy-firmware.sh || die
+
+ if use initramfs; then
+ if [[ -d "${S}/amd-ucode" ]]; then
+ local UCODETMP="${T}/ucode_tmp"
+ local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
+ mkdir -p "${UCODEDIR}" || die
+ echo 1 > "${UCODETMP}/early_cpio"
+
+ local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
+ cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
+
+ if [[ ! -s "${amd_ucode_file}" ]]; then
+ die "Sanity check failed: '${amd_ucode_file}' is empty!"
+ fi
+
+ pushd "${UCODETMP}" &>/dev/null || die
+ find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
+ popd &>/dev/null || die
+ if [[ ! -s "${S}/amd-uc.img" ]]; then
+ die "Failed to create '${S}/amd-uc.img'!"
+ fi
+ else
+ # If this will ever happen something has changed which
+ # must be reviewed
+ die "'${S}/amd-ucode' not found!"
+ fi
+ fi
# whitelist of images with a free software license
local free_software=(
@@ -217,90 +228,67 @@ src_prepare() {
lgs8g75.fw
)
- default
-
- # remove sources and documentation (wildcards are expanded)
- rm -r ${source_files[@]} || die
- rm -rf .git
-
if use !unknown-license; then
- # remove files in unknown_license
- rm "${unknown_license[@]}" || die
+ einfo "Removing files with unknown license ..."
+ rm -v "${unknown_license[@]}" || die
fi
if use !redistributable; then
# remove files _not_ in the free_software or unknown_license lists
# everything else is confirmed (or assumed) to be redistributable
# based on upstream acceptance policy
- local IFS=$'\n'
- find ! -type d -printf "%P\n" \
+ einfo "Removing non-redistributable files ..."
+ IFS=$'\n' find ! -type d -printf "%P\n" \
| grep -Fvx -e "${free_software[*]}" -e "${unknown_license[*]}" \
- | xargs -d '\n' rm || die
- IFS=$' \t\n'
+ | xargs -d '\n' rm -v || die
fi
- if use initramfs; then
- if [[ -d "${S}/amd-ucode" ]]; then
- local UCODETMP="${T}/ucode_tmp"
- local UCODEDIR="${UCODETMP}/kernel/x86/microcode"
- mkdir -p "${UCODEDIR}" || die
- echo 1 > "${UCODETMP}/early_cpio"
-
- local amd_ucode_file="${UCODEDIR}/AuthenticAMD.bin"
- cat "${S}"/amd-ucode/*.bin > "${amd_ucode_file}" || die "Failed to concat amd cpu ucode"
-
- if [[ ! -s "${amd_ucode_file}" ]]; then
- die "Sanity check failed: '${amd_ucode_file}' is empty!"
- fi
+ restore_config ${PN}.conf
+}
- pushd "${UCODETMP}" &>/dev/null || die
- find . -print0 | cpio --quiet --null -o -H newc -R 0:0 > "${S}"/amd-uc.img
- popd &>/dev/null || die
- if [[ ! -s "${S}/amd-uc.img" ]]; then
- die "Failed to create '${S}/amd-uc.img'!"
- fi
- else
- # If this will ever happen something has changed which
- # must be reviewed
- die "'${S}/amd-ucode' not found!"
- fi
- fi
+src_install() {
+ ./copy-firmware.sh -v "${ED}/lib/firmware" || die
- echo "# Remove files that shall not be installed from this list." > ${PN}.conf
- find * ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) >> ${PN}.conf
+ pushd "${ED}/lib/firmware" &>/dev/null || die
if use savedconfig; then
- restore_config ${PN}.conf
-
- ebegin "Removing all files not listed in config"
- find ! -type d ! \( -name ${PN}.conf -o -name amd-uc.img \) -printf "%P\n" \
- | grep -Fvx -f <(grep -v '^#' ${PN}.conf \
- || die "grep failed, empty config file?") \
- | xargs -d '\n' --no-run-if-empty rm
- eend $? || die
+ if [[ -s "${S}/${PN}.conf" ]]; then
+ local files_to_keep="${T}/files_to_keep.lst"
+ grep -v '^#' "${S}/${PN}.conf" 2>/dev/null > "${files_to_keep}" || die
+ [[ -s "${files_to_keep}" ]] || die "grep failed, empty config file?"
+
+ einfo "Applying USE=savedconfig; Removing all files not listed in config ..."
+ set -o pipefail
+ find ! -type d -printf "%P\n" \
+ | grep -Fvx -f "${files_to_keep}" \
+ | xargs -d '\n' --no-run-if-empty rm -v
+
+ [[ ${?} -ne 0 ]] && die "Failed to remove files not listed in config"
+ fi
fi
# remove empty directories, bug #396073
find -type d -empty -delete || die
-}
-
-src_install() {
- save_config ${PN}.conf
- rm ${PN}.conf || die
-
- if use initramfs ; then
- mkdir "${ED}/boot" || die
- mv "${S}"/amd-uc.img "${ED}/boot" || die
- fi
+ # sanity check
if ! ( shopt -s failglob; : * ) 2>/dev/null; then
eerror "No files to install. Check your USE flag settings"
eerror "and the list of files in your saved configuration."
die "Refusing to install an empty package"
fi
- insinto /lib/firmware/
- doins -r *
+ if use savedconfig; then
+ echo "# Remove files that shall not be installed from this list." > "${S}"/${PN}.conf || die
+ find * ! -type d >> "${S}"/${PN}.conf || die
+ save_config "${S}"/${PN}.conf
+ fi
+
+ popd &>/dev/null || die
+
+ if use initramfs ; then
+ insinto /boot
+ doins "${S}"/amd-uc.img
+ fi
}
pkg_preinst() {