From 8aa19779f47b204c15bb53fc172f14fd3cdaa88a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 3 Oct 2014 11:59:39 +0000 Subject: [PATCH] scripts: Merge r5533:5821 from trunk except rebuild-rhel-kernel-rpm git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5823 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scripts/generate-kernel-patch | 36 +++++++++---- scripts/rhel-rpm-functions | 98 +++++++++++++++++++++++++++++++++++ scripts/run-regression-tests | 46 ++++++++-------- 3 files changed, 148 insertions(+), 32 deletions(-) create mode 100644 scripts/rhel-rpm-functions diff --git a/scripts/generate-kernel-patch b/scripts/generate-kernel-patch index cc95d7a67..ef7ebb037 100755 --- a/scripts/generate-kernel-patch +++ b/scripts/generate-kernel-patch @@ -373,18 +373,32 @@ rm -rf "${tmpdir}" for s in ${separate_patches} do - fileset=$s - for f in $(set | grep "^$s=" | sed -e "s/^$s='\(.*\)'\$/\1/" -e "s/^$s=\(.*\)\$/\1/") - do - if [ "${f#scst/include}" != "${f}" ]; then - add_file "${f}" "include/scst/${f#scst/include/}" - elif [ "${f#doc}" != "${f}" ]; then - add_file "${f}" "Documentation/scst/${f#doc/}" - else - add_file "${f}" "drivers/scst/${f#scst/src/}" + { + fileset=$s + for f in $(set | grep "^$s=" | sed -e "s/^$s='\(.*\)'\$/\1/" -e "s/^$s=\(.*\)\$/\1/") + do + if [ "${f#scst/include}" != "${f}" ]; then + add_file "${f}" "include/scst/${f#scst/include/}" + elif [ "${f#doc}" != "${f}" ]; then + add_file "${f}" "Documentation/scst/${f#doc/}" + else + add_file "${f}" "drivers/scst/${f#scst/src/}" + fi + done + if [ "$s" = "scst_03_public_headers" ]; then + tmp_itf_ver="$(mktemp /tmp/scst-itf-ver.h.XXXXXXXXXX)" + cat <<"EOF" >$tmp_itf_ver +/* Autogenerated, don't edit */ + +#define SCST_INTF_VER "SCST_INTF_VER" +#define SCST_CONST_INTF_VER "SCST_CONST_INTF_VER" +#define DEV_USER_INTF_VER "DEV_USER_INTF_VER" +EOF + add_file "$tmp_itf_ver" "include/scst/scst_itf_ver.h" + rm -f "$tmp_itf_ver" fi - done \ - | process_patch "${s}.diff" + } | + process_patch "${s}.diff" done { diff --git a/scripts/rhel-rpm-functions b/scripts/rhel-rpm-functions new file mode 100644 index 000000000..a6765ae3f --- /dev/null +++ b/scripts/rhel-rpm-functions @@ -0,0 +1,98 @@ +# -*- mode: shell-script -*- +# Shell functions for downloading and extracting a RHEL or RHEL clone RPM + +# Arguments: +# $1: Linux distribution name +# $2: Linux distribution version (major.minor) +# $3: architecture +function get_srpm_urls() { + local arch distro releasever releasevermajor releaseverminor + + distro="$1" + releasever="$2" + arch="$3" + IFS=. + set -- "$2" + unset IFS + releasevermajor="$1" + releaseverminor="$2" + + case "$distro" in + "CentOS"*) + case $releasever in + 5.*|6.[01]) + echo "http://vault.centos.org/${releasever}/os/SRPMS http://vault.centos.org/${releasever}/updates/SRPMS";; + [67].*) + echo "http://vault.centos.org/${releasever}/os/Source/SPackages http://vault.centos.org/${releasever}/updates/Source/SPackages";; + esac + ;; + "Red Hat Enterprise Linux"*) + case $releasever in + [56].*) + echo "http://ftp.redhat.com/pub/redhat/linux/enterprise/${releasevermajor}Server/en/os/SRPMS http://ftp.redhat.com/redhat/rhel/rc/7/Server/source/tree/Packages";; + esac + ;; + "Oracle Linux Server") + echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEK/latest/${arch}/getPackageSource" + ;; + "Scientific Linux") + case $releasever in + 5.*) + echo "http://ftp.scientificlinux.org/linux/scientific/$releasevermajor$releaseverminor/SRPMS/vendor";; + 6.*) + echo "http://ftp.scientificlinux.org/linux/scientific/$releasever/SRPMS/vendor";; + esac + ;; + *) + echo "Unknown type of distribution: $distro" >&2 + return 1 + ;; + esac +} + +# Arguments: +# $1: Linux distribution name +# $2: Linux distribution version (major.minor) +# $3: architecture +function get_rpm_urls() { + local arch distro releasever releasevermajor releaseverminor + + distro="$1" + releasever="$2" + arch="$3" + IFS=. + set -- "$2" + unset IFS + releasevermajor="$1" + releaseverminor="$2" + + case "$distro" in + "CentOS"*) + case $releasever in + 5.*) + echo "http://vault.centos.org/${releasever}/os/${arch}/CentOS http://vault.centos.org/${releasever}/updates/${arch}/RPMS";; + 6.[01]) + echo "http://vault.centos.org/${releasever}/os/${arch}/Packages http://vault.centos.org/${releasever}/updates/${arch}/Packages";; + [67].*) + echo "http://vault.centos.org/${releasever}/os/${arch}/Packages http://vault.centos.org/${releasever}/updates/${arch}/Packages";; + esac + ;; + "Red Hat Enterprise Linux"*) + echo "";; + "Oracle Linux Server") + echo "http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/${releaseverminor}/base/${arch}/getPackageSource http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/latest/${arch}/getPackageSource http://public-yum.oracle.com/repo/OracleLinux/OL${releasevermajor}/UEK/latest/${arch}/getPackageSource" + ;; + "Scientific Linux") + case $releasever in + 5.*) + echo "http://ftp.scientificlinux.org/linux/scientific/$releasevermajor$releaseverminor/SRPMS/vendor";; + 6.*) + echo "http://ftp.scientificlinux.org/linux/scientific/$releasever/SRPMS/vendor";; + esac + ;; + *) + echo "Unknown distribution type: $distro" >&2 + return 1 + ;; + esac +} diff --git a/scripts/run-regression-tests b/scripts/run-regression-tests index 65105cf9d..f792254c4 100755 --- a/scripts/run-regression-tests +++ b/scripts/run-regression-tests @@ -263,30 +263,32 @@ CONFIG_TRACING CONFIG_X86_32 \ " echo "Patching and configuring kernel ..." + if [ "$ipv6" = "false" ]; then + disable="$disable CONFIG_IPV6" + fi ( local srcdir="$PWD" - cd "${outputdir}/linux-$1" \ - && if [ "${multiple_patches}" = "false" ]; then - patch -p1 -f -s <"${patchfile}" >"${patchoutput}" - else - rm -f "${patchoutput}" - for p in "${outputdir}/${patchdir}"/* - do - echo "==== $p" >>"${patchoutput}" - patch -p1 -f -s <"${p}" >>"${patchoutput}" 2>&1 - done - fi \ - && if [ -e $srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ]; then - echo "$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ..." \ + cd "${outputdir}/linux-$1" && + if [ "${multiple_patches}" = "false" ]; then + patch -p1 -f -s <"${patchfile}" >"${patchoutput}" + else + rm -f "${patchoutput}" + for p in "${outputdir}/${patchdir}"/*; do + echo "==== $p" >>"${patchoutput}" + patch -p1 -f -s <"${p}" >>"${patchoutput}" 2>&1 + done + fi && + if [ -e $srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ]; then + echo "$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch ..." \ >>"${patchoutput}" - patch -p1 -f -s <$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch \ - >>"${patchoutput}"; - else - echo "srpt/patches/kernel-${kver}-pre-cflags.patch not found."; \ - fi \ - && make -s allmodconfig &>"${outputdir}/make-config-output.txt" \ - && for c in $disable; do sed -i.tmp "s/^$c=y\$/$c=n/" .config; done \ - && make -s oldconfig &>/dev/null + patch -p1 -f -s <$srcdir/srpt/patches/kernel-${kver}-pre-cflags.patch \ + >>"${patchoutput}" + else + echo "srpt/patches/kernel-${kver}-pre-cflags.patch not found." + fi && + make -s allmodconfig &>"${outputdir}/make-config-output.txt" && + for c in $disable; do sed -i.tmp "s/^$c=[ym]\$/$c=n/" .config; done && + make -s oldconfig &>/dev/null ) } @@ -585,6 +587,7 @@ do run_checkpatch="true" run_sparse="true" run_smatch="true" + ipv6="true" global_multiple_patches="${multiple_patches}" while [ "${kv%-?}" != "${kv}" -o "${kv%-??}" != "${kv}" ]; do kv_without_opt="${kv%-?}" @@ -593,6 +596,7 @@ do fi kopt="${kv#${kv_without_opt}}" case "${kopt}" in + '-4') ipv6="false";; '-f') full_check="true";; '-i') ibmvio="true";; '-nc') run_checkpatch="false";;