From: <bva...@us...> - 2014-08-07 08:38:28
|
Revision: 5712 http://sourceforge.net/p/scst/svn/5712 Author: bvassche Date: 2014-08-07 08:38:19 +0000 (Thu, 07 Aug 2014) Log Message: ----------- scripts/rebuild-rhel-kernel-rpm: Add RHEL 7 support Modified Paths: -------------- trunk/scripts/rebuild-rhel-kernel-rpm trunk/scripts/rhel-rpm-functions Modified: trunk/scripts/rebuild-rhel-kernel-rpm =================================================================== --- trunk/scripts/rebuild-rhel-kernel-rpm 2014-08-07 08:12:22 UTC (rev 5711) +++ trunk/scripts/rebuild-rhel-kernel-rpm 2014-08-07 08:38:19 UTC (rev 5712) @@ -51,14 +51,17 @@ kernel="kernel-$(uname -r)" fi -releasever="$(sed -n -e 's/^.* release \([0-9.]*\).*$/\1/p' /etc/issue)" +releasever="$(sed -n -e 's/^.* release \([0-9.]*\).*$/\1/p' /etc/redhat-release)" +distro="$(sed -n -e 's/^\(.*\) release .*$/\1/p' /etc/redhat-release)" -distro="$(sed -n -e 's/^\(.*\) release .*$/\1/p' /etc/issue)" - install_prerequisites=true +usage() { + echo "$(basename "$0") [-d <distro>] [-h] [-i] [-k <kver>] [-r <rel>]" +} + type /usr/bin/getopt >/dev/null || exit 1 -options="$(/usr/bin/getopt d:ik:r: "$@")" || { usage; exit 1; } +options="$(/usr/bin/getopt d:hik:r: "$@")" || { usage; exit 1; } set -- $options while [ "$1" != "${1#-}" ]; do case "$1" in @@ -76,7 +79,7 @@ kernel_src_rpm="${kernel}.src.rpm" kver="${kernel#kernel-}" -srpm_urls="$(get_srpm_urls $distro $releasever $arch)" || exit $? +srpm_urls="$(get_srpm_urls "$distro" "$releasever" "$arch")" || exit $? function log { echo @@ -84,6 +87,25 @@ echo } +copy_best_matching_patch() { + local f v + + v="${kver}" + while [ "${v%[0-9a-z]}" != "$v" ]; do + f="${1}-${v}.patch" + if [ -e "$f" ]; then + copy_patch "$f" "$2" + return 0 + fi + while [ "${v%[0-9a-z]}" != "$v" ]; do + v="${v%[0-9a-z]}" + done + v="${v%.}" + v="${v%-}" + done + return 1 +} + function copy_patch { local p="$1" while [ ! -e "$p" ] @@ -122,7 +144,7 @@ log "Installing prerequisites" if $install_prerequisites; then - sudo yum install -y -q asciidoc binutils-devel elfutils-libelf-devel hmaccalc ncurses-devel newt-devel patchutils 'perl(ExtUtils::Embed)' python-devel redhat-rpm-config rpmdevtools rng-tools rpm-build unifdef xmlto yum-utils zlib-devel + sudo yum install -y -q asciidoc binutils-devel elfutils-libelf-devel hmaccalc ncurses-devel newt-devel patchutils 'perl(ExtUtils::Embed)' python-devel redhat-rpm-config rpmdevtools rng-tools rpm-build unifdef wget xmlto yum-utils zlib-devel fi rc=$?; if [ $rc != 0 ]; then exit $rc; fi @@ -173,19 +195,16 @@ log "Copying SCST patches to the SOURCES directory" cd ${rpmbuild_dir}/SOURCES -copy_patch $scst_dir/scst/kernel/rhel/scst_exec_req_fifo-${kver}.patch scst_exec_req_fifo.patch -v="${kver}" -while [ "${v/.*}" != "$v" ]; do - f="$scst_dir/iscsi-scst/kernel/patches/rhel/put_page_callback-${v}.patch" - if [ -e "$f" ]; then - copy_patch "$f" put_page_callback.patch - break - fi - while [ "${v%[0-9a-z]}" != "$v" ]; do - v="${v%[0-9a-z]}" - done - v="${v%.}" -done +copy_best_matching_patch $scst_dir/scst/kernel/rhel/scst_exec_req_fifo scst_exec_req_fifo.patch || +{ + echo "No matching scst_exec_req_fifo patch found for kernel version $kver"; + exit 1; +} +copy_best_matching_patch $scst_dir/iscsi-scst/kernel/patches/rhel/put_page_callback put_page_callback.patch || +{ + echo "No matching scst_exec_req_fifo patch found for kernel version $kver"; + exit 1; +} log "Adding SCST patches in kernel.spec" @@ -321,7 +340,7 @@ make ARCH=$Arch %{oldconfig_target} > /dev/null echo "# $Arch" > configs/$i EOF -elif [ ${kver#3.10.0-121} != $kver ]; then +elif [ ${kver#3.10.0-12[13]} != $kver ]; then # RHEL/CentOS/SL 7.0 patch -p1 ${rpmbuild_dir}/SPECS/kernel.spec <<'EOF' || exit $? --- kernel.spec.orig 2014-05-23 10:09:17.707202148 +0200 Modified: trunk/scripts/rhel-rpm-functions =================================================================== --- trunk/scripts/rhel-rpm-functions 2014-08-07 08:12:22 UTC (rev 5711) +++ trunk/scripts/rhel-rpm-functions 2014-08-07 08:38:19 UTC (rev 5712) @@ -22,7 +22,7 @@ case $releasever in 5.*|6.[01]) echo "http://vault.centos.org/${releasever}/os/SRPMS http://vault.centos.org/${releasever}/updates/SRPMS";; - 6.*) + [67].*) echo "http://vault.centos.org/${releasever}/os/Source/SPackages http://vault.centos.org/${releasever}/updates/Source/SPackages";; esac ;; @@ -73,7 +73,7 @@ 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";; - 6.*) + [67].*) echo "http://vault.centos.org/${releasever}/os/${arch}/Packages http://vault.centos.org/${releasever}/updates/${arch}/Packages";; esac ;; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |