Accepting request 517927 from home:michals

Do not do any supplements or deduplication of files between kernel-binary and
  kernel-firmware (bsc#1054239)

Raises disk useage from 198M to 200M on x86_64

OBS-URL: https://build.opensuse.org/request/show/517927
OBS-URL: https://build.opensuse.org/package/show/Kernel:HEAD/kernel-firmware?expand=0&rev=168
This commit is contained in:
Takashi Iwai 2017-08-21 13:52:47 +00:00 committed by Git OBS Bridge
parent c5237618dc
commit c403438624
3 changed files with 7 additions and 128 deletions

View File

@ -1,122 +0,0 @@
#!/bin/bash
#
# Generate Supplements: lines for the kernel-firmware package, by looking at
# the firmware: and alias: fields of kernel modules.
USAGE="find <firmware directory> | $0 --find-supplements [kernel directory | kernel.rpm]
$0 --kill-duplicates <firmware directory> [kernel directory | kernel.rpm]"
usage()
{
echo "Usage: $USAGE" >&2
exit 1
}
get_kernel_dir()
{
# default to the running or last installed kernel
if test -z "$kernel"; then
if test -d "/lib/modules/$(uname -r)/kernel"; then
kernel="$_"
return
fi
local pkg=$(rpm -q --qf '%{buildtime} %{n}-%{v}-%{r}\n' \
kernel-default kernel-desktop kernel-pae | sort -rn |
head -n1 | cut -d' ' -f 2)
if test -n "$pkg"; then
kernel=$(rpm -ql "$pkg" | \
grep -m1 '^/lib/modules/[2-9][^/]*/kernel$')
fi
if test -d "$kernel"; then
return
fi
echo "No kernel found" >&2
usage
fi
# /lib/modules/$version ?
if test -d "$kernel/kernel"; then
kernel="$_"
return
fi
# just $version ?
if test -d "/lib/modules/$kernel/kernel"; then
kernel="$_"
return
fi
# a kernel rpm?
case "$kernel" in
*.rpm)
mkdir "$tmp/kernel"
rpm2cpio "$kernel" | (cd "$tmp/kernel"; cpio -id --quiet)
kernel=($tmp/kernel/lib/modules/*/kernel)
kernel=${kernel[0]}
return
esac
usage
}
cache=
if test "$1" = "--cache" ; then
cache=$2
shift
shift
fi
if test "$1" = "--find-supplements" -a -n "$cache" ; then
if ! test -e "$cache"; then
get_kernel_dir
echo "Using $kernel" >&2
find "$kernel" -name '*.ko' -type f | while read ko; do
/sbin/modinfo -F firmware "$ko" | sed -e "s@\$@ $ko@"
done > $cache
fi
hits=$(while read fw ; do
sed -n -e "s@^${fw#$RPM_BUILD_ROOT/lib/firmware/} @@p" < "$cache"
done | sort)
if test -n "$hits"; then
echo "$hits" | RPMBUILD_SPECFILE=/dev/null /usr/lib/rpm/find-supplements.ksyms | \
sed 's/^modalias(kernel-[^:]*:/modalias(/' # strip the kernel-$flavor: prefix
fi
exit 0
fi
trap 'rm -rf "$tmp"' EXIT
tmp=$(mktemp -d)
case "$1" in
--find-supplements)
kernel=$2
cat >"$tmp/filelist"
if test ! -s "$tmp/filelist"; then
usage
fi
get_kernel_dir
echo "Using $kernel" >&2
find "$kernel" -name '*.ko' -type f | while read ko; do
if grep -qFf <(/sbin/modinfo -F firmware "$ko") \
"$tmp/filelist"; then
echo "$ko"
fi
done | sort | \
RPMBUILD_SPECFILE=/dev/null /usr/lib/rpm/find-supplements.ksyms dummy-package-please-ignore | \
sed 's/^modalias(kernel-[^:]*:/modalias(/' # strip the kernel-$flavor: prefix
;;
--kill-duplicates)
firmware=$2
kernel=$3
get_kernel_dir
kernel=${kernel/\/lib\/modules\//\/lib\/firmware\/}
kernel=${kernel%/kernel}
echo "Using $kernel" >&2
find "$firmware" -type f -printf '%P\n' | while read f; do
if cmp -s "$kernel/$f" "$firmware/$f"; then
rm -v "$_"
fi
done
;;
*)
usage
esac

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Aug 18 13:47:12 UTC 2017 - msuchanek@suse.com
- Do not do any supplements or deduplication of files between kernel-binary and
kernel-firmware (bsc#1054239).
* remove firmware.sh
-------------------------------------------------------------------
Tue Jun 27 07:21:43 UTC 2017 - mpluskal@suse.com

View File

@ -16,8 +16,6 @@
#
%define __find_supplements bash %{_sourcedir}/firmware.sh --find-supplements
%define __ksyms_supplements bash %{_sourcedir}/firmware.sh --cache %{_builddir}/%{?buildsubdir}/find_supplements.cache --find-supplements
%define __ksyms_path ^/lib/firmware
%define version_unconverted 20170622
@ -34,7 +32,6 @@ Url: https://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firm
# git archive --format=tar --prefix=linux-firmware-$version/ -v master ./ | xz -9 -M 4G --check=crc32 -T 4 > /tmp/linux-firmware-$version.tar.xz
#
Source0: kernel-firmware-%{version}.tar.xz
Source1: firmware.sh
# ast_dp501_fw.bin generated from header file of xf86-video-ast: MIT/X11 License
Source2: ast_dp501_fw.bin
Source8: ql2600_fw.bin
@ -42,7 +39,6 @@ Source9: ql2700_fw.bin
Source10: ql8300_fw.bin
Source99: %{name}-rpmlintrc
BuildRequires: fdupes
BuildRequires: kernel-default
BuildRequires: suse-module-tools
Requires(post): coreutils
Requires(postun): coreutils
@ -104,9 +100,7 @@ cp %{SOURCE2} %{SOURCE8} %{SOURCE9} %{SOURCE10} .
mkdir -p %{buildroot}/lib/firmware
cp -avf * %{buildroot}/lib/firmware
rm -f %{buildroot}/lib/firmware/WHENCE
bash %{_sourcedir}/firmware.sh --kill-duplicates %{buildroot}/lib/firmware/
%fdupes %{buildroot}
rm -f find_supplements.cache
# In alsa-firmware
rm -f %{buildroot}/lib/firmware/ctefx.bin
rm -f %{buildroot}/lib/firmware/ctspeq.bin