linux-glibc-devel/make_diff.sh

98 lines
2.2 KiB
Bash

#!/bin/bash
#
# Create a patch file between the base version and the current kernel-source
# Run on kernel-source.git repository:
# % make_diff.sh /somewhere/linux-glibc-devel-6.4.tar.xz
#
set -e
if [ -z "$1" ]; then
echo "usage: make_diff.sh base-tarball [patchfile]"
exit 1
fi
base="$1"
case "$base" in
*/linux-glibc-devel-*.tar.*)
;;
*)
echo "Invalid base tarball $1"
exit 1;;
esac
if [ ! -f "$base" ]; then
echo "Invalid base tarball $base"
exit 1
fi
basever=${base##*/}
basever=${basever%.tar.*}
test -z "$SCRATCH_AREA" && export SCRATCH_AREA=/dev/shm/scratch
mkdir -p $SCRATCH_AREA
destdir="$SCRATCH_AREA/linux-glibc-devel"
patchfile="$2"
test -z "$patchfile" && patchfile=linux-glibc-devel-current.patch
case "$patchfile" in
/*)
;;
*)
patchfile="$PWD/$patchfile";;
esac
susecommit=$(git rev-parse HEAD)
scripts/sequence-patch.sh --rapid --patch-dir "$destdir" || exit 1
cd "$destdir" || exit 1
kernel_dir="$PWD"
header_dir="$PWD/linux-glibc-devel-current"
mkdir -p "$header_dir"
remove="arc csky h8300 hexagon microblaze nds32 nios2 openrisc sh xtensa um"
archs=$(cd "$kernel_dir/arch" &&
for arch in *; do
test -d $arch || continue
case " $remove " in *" $arch "*) continue;; esac
echo $arch
done)
pushd "$kernel_dir"
for arch in $archs; do
mkdir "$header_dir/$arch"
cp Makefile "$header_dir/$arch"
make O="$header_dir/$arch" headers_install ARCH=$arch
done
popd
pushd "$header_dir"
find -type f \( -name ".*.cmd" -o -name Makefile \) -exec rm -f {} +
for arch in $archs; do
cd $arch
#-------------------------------------------------------------------
#Fri Sep 5 10:43:49 CEST 2008 - matz@suse.de
#- Remove the kernel version of drm headers, they conflict
# with the libdrm ones, and those are slightly newer.
#
rm -rf usr/include/drm/
# Remove confusing empty uapi directory
test ! -d usr/include/uapi || rmdir usr/include/uapi
for dir in *; do
case "$dir" in
usr) ;;
*)
if test -d "$dir"; then
rm -rf "$dir"
fi
;;
esac
done
cd ..
done
popd
tar xf "$base"
echo "kernel-source.git: $susecommit" > "$patchfile"
echo >> "$patchfile"
diff -ruN "$basever" linux-glibc-devel-current >> "$patchfile"
exit 0