summaryrefslogtreecommitdiffstats
path: root/redhat/genrpm.sh
diff options
context:
space:
mode:
authorFrançois Andriot <albator78@libertysurf.fr>2013-06-24 20:04:29 +0200
committerFrançois Andriot <albator78@libertysurf.fr>2013-06-24 20:04:29 +0200
commit7d2530b3a09c48df5070a9fbddb20dda9d6ba213 (patch)
tree75179ad523e4c7e0befd199223dfeee374813f86 /redhat/genrpm.sh
parentfd19f6bf3d8b5bfa11600f83adb51e75c0404105 (diff)
downloadtde-packaging-7d2530b3a09c48df5070a9fbddb20dda9d6ba213.tar.gz
tde-packaging-7d2530b3a09c48df5070a9fbddb20dda9d6ba213.zip
RPM Packaging: misc updates for 3.5.13.2
Diffstat (limited to 'redhat/genrpm.sh')
-rwxr-xr-xredhat/genrpm.sh136
1 files changed, 91 insertions, 45 deletions
diff --git a/redhat/genrpm.sh b/redhat/genrpm.sh
index df6362bc3..6dfe7d68c 100755
--- a/redhat/genrpm.sh
+++ b/redhat/genrpm.sh
@@ -3,10 +3,11 @@
cd "$( dirname "$0" )"
ARGS=""
-eval TARBALLS_DIR=~/tde/3.5.13.1
+eval TARBALLS_DIR=~/tde/tde-tarballs/3.5.13.2
+DIST="$(rpmdist.sh --dist)"
+# CCACHE related stuff
if [ ! -d /var/cache/ccache ]; then
- DIST="$(rpmdist.sh --dist)"
[ -z "${DIST}" ] && DIST="$(rpm -E "%{dist}")"
if [ -n "${DIST}" ]; then
export CCACHE_DIR=~/.ccache${DIST}.$(uname -m)
@@ -14,20 +15,19 @@ if [ ! -d /var/cache/ccache ]; then
fi
while [ $# -gt 0 ]; do
- case "$1" in
- "--auto"|"-a") AUTO=1;;
- "--version"|"-v") REQVERSION="$2"; shift;;
- "--"*) ARGS="${ARGS} $1";;
- *) COMP="${1%%/}";;
- esac
- shift
+ case "$1" in
+ "--auto"|"-a") AUTO=1;;
+ "--version"|"-v") REQVERSION="$2"; shift;;
+ "--"*) ARGS="${ARGS} $1";;
+ *) COMP="${1%%/}";;
+ esac
+ shift
done
clear
cat <<EOF
$(< /etc/redhat-release) [$(uname -m)]
This script generates RPM of TDE from source tarball.
-Please choose a TDE component to build.
EOF
@@ -38,14 +38,14 @@ SUSE="$( rpm -E "%{suse_version}" )"
PCLINUXOS="$( rpm -E "%{pclinuxos}" )"
MGAVERSION="$( rpm -E "%{mgaversion}" )"
if [ "${RHEL}" = "%{rhel}" ] && [ "${FEDORA}" = "%{fedora}" ] && [ "${SUSE}" = "%{suse_version}" ] && [ "${PCLINUXOS}" = "%{pclinuxos}" ] && [ "${MGAVERSION}" = "%{mgaversion}" ] ; then
- cat <<EOF
+ cat <<EOF
Error: RPM macro %rhel or %fedora must be set to the distribution version to build !
E.g:
%rhel 6
or:
%fedora 15
EOF
- exit 1
+ exit 1
fi
# Checks TDE version to use
@@ -54,39 +54,46 @@ fi
#fi
if [ -z "${COMP}" ]; then
- select COMP in $( cut -f1 "components.txt" | grep -v "^#" ) ; do break; done
+ select COMP in $( cut -f1 "components.txt" | grep -v "^#" ) ; do break; done
fi
# Gets package version from 'components.txt' file
VERSION=$( awk '{ if ($1 == "'${COMP}'") { print $2; } }' components.txt )
# If no version is set in text file, get version number from source tarball name
+COMPNAME="${COMP##*/}"
if [ -z "${VERSION}" ]; then
- if [ -n "${REQVERSION}" ]; then
- set $( cd "${TARBALLS_DIR}"; echo ${COMP##*/}*-${REQVERSION%-sru}*.tar.gz)
- else
- set $( cd "${TARBALLS_DIR}"; echo ${COMP##*/}*.tar.* )
- fi
- if [ $# -gt 1 ]; then
- select VERSION in $*; do break; done
- elif [ -r "${TARBALLS_DIR}/$1" ]; then
- VERSION="$1"
- elif [ "${COMP}" = "trinity-live" ]; then
- VERSION="3.5.13"
- else
- echo "No source tarball found for '${COMP}' !"
- exit 0
- fi
- VERSION="${VERSION##${COMP##*/}-}"
- VERSION="${VERSION%%.tar.gz}"
- VERSION="${VERSION%%.tar.bz2}"
-# If version is defined in spec file: appends the date
-else
- VERSION="${VERSION}.$(date +%Y%m%d)"
+ for d in "${TARBALLS_DIR}/main/${COMP%/*}" "${TARBALLS_DIR}/main/" "${PWD}/main/${COMP}/"; do
+ for n in "trinity-${COMPNAME}-${REQVERSION:-*}.tar.gz" "trinity-${COMPNAME}?-${REQVERSION:-*}.tar.gz" "trinity-${COMPNAME/kde/tde}-${REQVERSION:-*}.tar.gz" "trinity-${COMPNAME/kde/tde}-${REQVERSION:-*}*.tar.gz"; do
+# echo $d/$n
+ set $d/$n
+ if [ $# -eq 0 ]; then
+ echo "No tarball found !"
+ exit 1
+ elif [ $# -eq 1 ] && [ -r "$1" ]; then
+ TARBALL=$1
+ elif [ $# -gt 1 ]; then
+ select TARBALL in $*; do break; done
+ fi
+ done
+ done
+
+ echo "TARBALL is ${TARBALL##*/}"
+fi
+
+# Checks for version
+if [ -z "${VERSION}" ] && [ -n "${REQVERSION}" ]; then
+ VERSION="${REQVERSION}"
+fi
+
+# Checks for preversion (non-final)
+if [ "${TARBALL}" != "${TARBALL%%~pre*}" ]; then
+ PREVERSION="${TARBALL##*~}"
+ PREVERSION="${PREVERSION%.tar*}"
fi
# Chooses a spec file (if many)
-set $( cd "${COMP}"; echo *.spec )
+set $( cd "${COMP}"; echo *${COMP##*/}*.spec )
if [ $# -gt 1 ]; then
if [ -n "${REQVERSION}" ]; then
set $( cd "${COMP}"; echo *-${REQVERSION}.spec )
@@ -98,6 +105,7 @@ elif [ -r "${COMP}/$1" ]; then
SPEC="$1"
else
echo "Fatal: no spec file found !"
+ echo $1
exit 2
fi
@@ -105,7 +113,9 @@ cat <<EOF
About to build '${COMP}':
Version: '${VERSION}'
+ Preversion: '${PREVERSION}'
Spec file: '${SPEC}'
+ Tarball: '${TARBALL}'
CCACHE_DIR='${CCACHE_DIR}'
@@ -127,28 +137,62 @@ LOGFILE=/tmp/log.${COMP##*/}
SOURCEDIR="$(mktemp -d)"
# Puts the GIT files in SOURCEDIR
-cp -rf "${PWD}/${COMP}/"* "${SOURCEDIR}"
+#rsync -rLv "${PWD}/${COMP}/" "${SOURCEDIR}/"
+while read a b; do
+ case "${a}" in
+ "Source"*|"Patch"*)
+ b=$(rpm -E "${b##*/}")
+ [ -r "${COMP}/${b}" ] && cp -fv "${COMP}/${b}" "${SOURCEDIR}"
+ ;;
+ esac
+done < "${COMP}/${SPEC}"
+
+# Copies the SPEC file
+cp -f "${COMP}/${SPEC}" "${SOURCEDIR}"
+
# Puts the TARBALL in SOURCEDIR
-cp -f "${TARBALLS_DIR}/${COMP}-"*.tar* "${SOURCEDIR}"
+#cp -f "${TARBALLS_DIR}/${COMP}-"*.tar* "${SOURCEDIR}"
+echo "Copying TARBALL ..."
+cp -fv "${TARBALL}" "${SOURCEDIR}"
+
+if [ $(hostname) = "aria.vtf" ]; then
+ BUILDDIR="$HOME/rpmbuild/BUILD/BUILD${DIST}.$(uname -i)"
+ BUILDROOTDIR="$HOME/rpmbuild/BUILDROOT/BUILDROOT${DIST}.$(uname -i)"
+else
+ BUILDDIR="/dev/shm/BUILD${DIST}.$(uname -i)"
+ BUILDROOTDIR="/dev/shm/BUILDROOT${DIST}.$(uname -i)"
+fi
+
+TOPSRCRPMDIR="$(rpm -E %_srcrpmdir)"
+TOPRPMDIR="$(rpm -E %_rpmdir)"
+SUBDIR="${COMP%/*}"
+if [ "${SUBDIR}" = "${COMP}" ]; then
+ SUBDIR="main"
+fi
+RPMDIR="${TOPRPMDIR}/${SUBDIR}"
+SRCRPMDIR="${TOPSRCRPMDIR}/${SUBDIR}"
-BUILDDIR="/dev/shm/BUILD${DIST}.$(uname -i)"
-BUILDROOTDIR="/dev/shm/BUILDROOT${DIST}.$(uname -i)"
+[ -d "${BUILDDIR}" ] || mkdir "${BUILDDIR}"
+[ -d "${BUILDROOTDIR}" ] || mkdir "${BUILDROOTDIR}"
set -x
(
rpmbuild -ba \
${ARGS} \
+ --define "_specdir ${SOURCEDIR}" \
--define "_sourcedir ${SOURCEDIR}" \
- --define "_builddir ${BUILDDIR}" \
- --define "_buildrootdir ${BUILDROOTDIR}" \
+ --define "_builddir ${BUILDDIR}" \
+ --define "_buildrootdir ${BUILDROOTDIR}" \
--define "tde_prefix ${PREFIX:-/opt/trinity}" \
- --define "version ${VERSION:-3.5.13}" \
- ${COMP}/${SPEC} || exit 1
+ --define "version ${VERSION:-3.5.13.2}" \
+ --define "preversion ${PREVERSION}" \
+ ${SOURCEDIR}/${SPEC}
+ echo "RET=$?"
) 2>&1 | tee ${LOGFILE}
-RET=$?
+eval "$(grep ^RET= ${LOGFILE})"
set +x
-if [ ${RET} -gt 0 ]; then
+if [ "${RET}" -gt 0 ]; then
exit ${RET}
fi
@@ -158,4 +202,6 @@ if grep -q "error: Failed build dependencies:" ${LOGFILE}; then
exit 2
fi
+set -x
rm -rf "${SOURCEDIR}"
+#rm -rf "${BUILDDIR}/"*${COMP}-${VERSION}*