scripts: Merge r3737:4204 from trunk

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4205 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-04-12 11:50:41 +00:00
parent b3d8507430
commit 3535eada10
5 changed files with 78 additions and 2480 deletions

View File

@@ -211,12 +211,21 @@ fi
# Strip patch level from the kernel version number.
kver="$(kernel_version "$1")"
# Include fcst in the patch for kernel versions 2.6.33 and later.
if [ "${kver}" ">" "2.6.32" ]; then
include_fcst="true"
else
include_fcst="false"
fi
# Make sure that for kernel 2.6.33 and later the line
# "#define CONFIG_SCST_PROC" is removed from scst/include/scst.h.
if grep -qw scst_sysfs scst/kernel/in-tree/Makefile.scst-${kver} \
|| [ "${generating_upstream_patch}" = "true" ];
then
specialize_patch_options="${specialize_patch_options} -v config_scst_proc_undefined=1"
else
include_proc_impl="true"
fi
if [ "${debug_specialize}" = "true" ]; then
specialize_patch_options="${specialize_patch_options} -v debug=1"
@@ -288,7 +297,7 @@ scst_13_vdisk="scst/src/dev_handlers/scst_vdisk.c"
scst_14_tg="scst/src/scst_tg.c"
separate_patches="scst_03_public_headers scst_04_main scst_05_targ scst_06_lib scst_07_pres scst_08_sysfs scst_09_debug scst_10_sgv scst_user scst_13_vdisk scst_14_tg"
if [ "${generating_upstream_patch}" = "false" ]; then
if [ "$include_proc_impl" = "true" ]; then
separate_patches+=" scst_proc"
fi
source_files_in_separate_patch=""
@@ -319,7 +328,7 @@ mkdir -p "${tmpdir}"
tmp_Kconfig="${tmpdir}/Kconfig.scst-${kver}"
cat "scst/kernel/in-tree/Kconfig.scst" | \
if [ -e "${fcst_patch_series}" ]; then
if [ "${include_fcst}" ]; then
cat
else
grep -v '^source "drivers/scst/fcst/Kconfig"$'
@@ -328,12 +337,12 @@ add_file "${tmp_Kconfig}" "drivers/scst/Kconfig"
tmp_Makefile="${tmpdir}/Makefile.scst-${kver}"
cat "scst/kernel/in-tree/Makefile.scst-${kver}" | \
if [ "${generating_upstream_patch}" = "true" ]; then
if [ "$include_proc_impl" != "true" ]; then
grep -v 'scst_proc'
else
cat
fi | \
if [ -e "${fcst_patch_series}" ]; then
if [ "${include_fcst}" -a "${kver}" != "2.6.37" -a "${kver}" != "2.6.38" ]; then
cat
else
sed -e 's: fcst/* : :'

File diff suppressed because it is too large Load Diff

26
scripts/generate-scst-patch Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
#
# A script to prepare a patch for posting on scst-devel@sourceforge.net.
#
# Copyright (C) 2012 Chetan Loke <loke.chetan@gmail.com>
# Copyright (C) 2012 Bart Van Assche <bvanassche@acm.org>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation, version 2
# of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
echo "Patch description:"
echo "Your description goes here..."
echo
echo "Signed-off-by: Write your name here <write-your-email-addr@your-host.com>"
echo ---
/usr/bin/svn diff "$@" | /usr/bin/diffstat
echo
/usr/bin/svn diff -x -p "$@"
echo

View File

@@ -58,7 +58,7 @@ case "$distro" in
if [ $releasevermajor = 5 ]; then
srpm_url=("http://vault.centos.org/${releasever}/os/SRPMS" "http://vault.centos.org/${releasever}/updates/SRPMS")
else
srpm_url=("http://mirror.centos.org/centos/${releasever}/os/SRPMS/Packages" "http://mirror.centos.org/centos/${releasever}/updates/SRPMS")
srpm_url=("http://vault.centos.org/${releasever}/os/Source/SPackages" "http://vault.centos.org/${releasever}/updates/Source/SPackages")
fi
;;
"Red Hat Enterprise Linux"*)
@@ -121,17 +121,6 @@ log "Creating directory ${rpmbuild_dir}"
mkdir -p ${rpmbuild_dir}/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
log "Updating ~/.rpmmacros"
if [ -e ~/.rpmmacros ]; then
cp ~/.rpmmacros ~/.rpmmacros.tmp
else
touch ~/.rpmmacros.tmp
fi
{ cat ~/.rpmmacros.tmp | grep -v '^%_topdir '; \
echo "%_topdir ${rpmbuild_dir}"; } > ~/.rpmmacros
rm -f ~/.rpmmacros.tmp
log "Installing, unpacking and preparing kernel source files"
mkdir -p ${downloaddir}
@@ -158,12 +147,16 @@ sudo yum-builddep -q -y ${downloaddir}/${kernel_src_rpm}
log "Installing kernel sources in ${rpmbuild_dir}"
cd ${rpmbuild_dir}
{ rpm -i ${downloaddir}/${kernel_src_rpm} 2>&1 \
| grep -v ' does not exist'; }
rpm --define="%_topdir ${rpmbuild_dir}" -i ${downloaddir}/${kernel_src_rpm} 2>&1 \
| grep -v ' does not exist'
cd SPECS
{ rpmbuild -bp --target=${arch} kernel*.spec; \
rc=$?; if [ rc != 0 ]; then exit $rc; fi; } 2>&1 \
| tee prep-err.log
{
rpmbuild --define="%_topdir ${rpmbuild_dir}" -bp --target=${arch} kernel*.spec
rc=$?
if [ rc != 0 ]; then
exit $rc
fi
} 2>&1 | tee prep-err.log
log "Copying SCST patches to the SOURCES directory"
@@ -304,8 +297,13 @@ fi
log "Rebuilding kernel"
cd ${rpmbuild_dir}/SPECS
{ rpmbuild -bb --target=${arch} --with baseonly --with firmware --without kabichk kernel*.spec; rc=$?; if [ $rc != 0 ]; then exit $rc; fi; } 2>&1 \
| tee build.log
{
rpmbuild --define="%_topdir ${rpmbuild_dir}" -bb --target=${arch} --with baseonly --with firmware --without kabichk kernel*.spec
rc=$?
if [ $rc != 0 ]; then
exit $rc
fi
} 2>&1 | tee build.log
log "Ready. You can now install the freshly built kernel RPM as follows:\n"\

View File

@@ -301,25 +301,28 @@ function run_sparse {
shift
echo "Running sparse on the patched kernel in ${subdir} $@ ..."
(
cd "${outputdir}/linux-$k" \
&& make -s prepare \
&& make -s scripts \
&& if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C make -k M=arch/powerpc/lib; fi \
&& LC_ALL=C make -k C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}" "$@"
) &> "${outputfile}"
local errors=$(grep -c ' error:' "${outputfile}")
local warnings=$(grep -c ' warning:' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
cat "${outputfile}" \
| grep -E 'warning:|error:' \
| sed -e 's/^[^ ]*:[^ ]*:[^ ]*: //' \
-e "s/context imbalance in '[^']*':/context imbalance in <function>:/g" \
-e "s/context problem in '[^']*': '[^']*'/context problem in <function>: <function>/g" \
-e "s/function '[^']*'/function/g" \
-e "s/symbol '[^']*'/symbol/g" \
| sort \
| uniq -c
if (cd "${outputdir}/linux-$k" \
&& make -s prepare \
&& make -s scripts \
&& if grep -q '^CONFIG_PPC=y$' .config; then LC_ALL=C make -k M=arch/powerpc/lib; fi \
&& LC_ALL=C make -k C=2 CF=-D__CHECK_ENDIAN__ M="${subdir}" "$@"
) &> "${outputfile}"
then
local errors=$(grep -c ' error:' "${outputfile}")
local warnings=$(grep -c ' warning:' "${outputfile}")
echo "${errors} errors / ${warnings} warnings."
cat "${outputfile}" \
| grep -E 'warning:|error:' \
| sed -e 's/^[^ ]*:[^ ]*:[^ ]*: //' \
-e "s/context imbalance in '[^']*':/context imbalance in <function>:/g" \
-e "s/context problem in '[^']*': '[^']*'/context problem in <function>: <function>/g" \
-e "s/function '[^']*'/function/g" \
-e "s/symbol '[^']*'/symbol/g" \
| sort \
| uniq -c
else
echo FAILED
fi
return 0
}