RPM: update build scripts

pull/92/head
François Andriot 6 years ago
parent 7e100357a2
commit 10db604da9

@ -6,7 +6,8 @@
PKGNAME="${1%/}"
PKGNAME="${PKGNAME##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
PATH="$(cd $(dirname $0); pwd):${PATH}"
SPECFILE=$(get_specfile.sh ${PKGNAME} ${TDE_VERSION})
VERSION=$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION} || :)

@ -1,6 +1,6 @@
#!/bin/bash -x
TDE_VERSION=${1:-14.0.0}
TDE_VERSION="${1:-${TDE_VERSION:-14.0.5}}"
ARCH=$(rpm -E %_target_cpu)
RPMDIR=$(rpm -E %{_rpmdir}.tde-${TDE_VERSION})

@ -5,7 +5,7 @@
PKGNAME="${1%/}"
PKGNAME="${PKGNAME##*/}"
TDE_VERSION="${2:-14.0.5}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
TARGETDIR="${3:-/tmp/${PKGNAME}-${TDE_VERSION}}"
DIST="$4"

@ -2,7 +2,7 @@
PKGNAME="$1"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
RPMDIR="$(rpm -E %{_rpmdir}.tde-${TDE_VERSION})"
RPMDIR_ARCH="${RPMDIR}/$(rpm -E %_target_cpu)"

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="$1"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
[ -d "${TARBALLS_DIR}" ] || TARBALLS_DIR=~/tde/tarballs/${TDE_VERSION}/

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.5}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
DIST="$3"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1

@ -1,12 +1,12 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.5}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
[ -z "${PKGNAME}" ] && echo "You must specify a package name !" && exit 1
[ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR=~/tde/master/tde-packaging
[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR=${TDE_PACKAGING_DIR}/redhat
[ -d "${TDE_PACKAGING_DIR}" ] || TDE_PACKAGING_DIR="${HOME}/tde/${TDE_BRANCH:-master}/tde-packaging"
[ -d "${DIST_PACKAGING_DIR}" ] || DIST_PACKAGING_DIR="${TDE_PACKAGING_DIR}/redhat"
# Special case for QT3
if [ "${PKGNAME}" = "qt3" ]; then

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
BUILT=$(get_latest_built_package_version.sh ${PKGNAME} ${TDE_VERSION})
TARBALL=$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION})

@ -1,7 +1,7 @@
#!/bin/bash
PKGNAME="${1##*/}"
TDE_VERSION="${2:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
INSTALLED=$(get_installed_package_version.sh ${PKGNAME} ${TDE_VERSION})
TARBALL=$(get_latest_tarball_version.sh ${PKGNAME} ${TDE_VERSION})

@ -1,3 +0,0 @@
#!/bin/bash -x
RPMDIR=$(rpm -E %_rpmdir)

@ -1,7 +1,7 @@
#!/bin/bash
WORKERS=$(getconf _NPROCESSORS_ONLN)
TDE_VERSION="${1:-14.0.0}"
TDE_VERSION="${2:-${TDE_VERSION:-14.0.5}}"
LOCKFILE="/tmp/lock.${0##*/}"
while [ -e "${LOCKFILE}" ]; do

@ -1,114 +0,0 @@
#!/bin/bash
# This file can be sourced in your .bashrc
BRANCH="$(git rev-parse --abbrev-ref HEAD)"
TDE_BASEDIR="${HOME}/tde"
[ -z "${TDE_VERSION}" ] && TDE_VERSION="14.0.5"
TDE_GITBASESRC=${TDE_BASEDIR}/${BRANCH}/tde
[ -d "${TDE_PACKAGING_DIR}" ] || export TDE_PACKAGING_DIR="${TDE_BASEDIR}/${BRANCH}/tde-packaging"
TDE_GITBASEPKG="${TDE_PACKAGING_DIR}/redhat"
TDE_TARBALLS="${TDE_BASEDIR}/tde-tarballs/${TDE_VERSION}"
export PATH="${PATH}:${TDE_GITBASEPKG}/build"
# Distribution suffix (e.g: .el6 , .mga3 ...)
export DIST="$( "${TDE_GITBASEPKG}/build/rpmdist.sh" --dist )"
# Go to the RPMS folder
alias cdrpm='cd ${HOME}/rpmbuild/RPMS/RPMS${DIST}'
# Build a single tarball (execute from GIT directory)
alias tdp4='TARGET=${TDE_VERSION} SUFFIX=0 TARBALL_DIR=${TDE_TARBALLS}/main COMPRESS=gzip ${TDE_GITBASESRC}/scripts/create_tarball'
# Rebuild all tarballs
if [ -x /usr/bin/pigz ]; then
export TDE_COMPRESS=pigz
else
export TDE_COMPRESS=gzip
fi
alias tdep3='(rm -rf ~/tde/tde-tarballs/3.5.13.2; cd ~/tde/tde_v3.5.13-sru; export SUFFIX=0; export COMPRESS=${TDE_COMPRESS:-gzip}; export TDE_REBRAND=1; ./scripts/create_all_tarballs)'
alias tdep4='(cd ${TDE_GITBASESRC}; export SUFFIX=0; export COMPRESS=${TDE_COMPRESS:-gzip}; export TDE_REBRAND=1; ./scripts/create_all_tarballs)'
# Build a single package
alias cdp='cd $HOME/tde/tde-packaging/redhat'
grp3() {
build_rpm_package.sh "${1}" "3.5.13.2"
}
grp4() {
build_rpm_package.sh "${1}" "${TDE_VERSION}"
}
# Check if tarballs are more recent than installed packages
checknew() {
find ~/tde/tde-tarballs/${TDE_VERSION} -name "trinity-*.tar.gz" | while read f; do
TAR="${f##*/}"
NAME="${TAR%-*}"
if rpm -q "${NAME}" &>/dev/null; then
set $(rpm -q --qf "%{name} ${TDE_VERSION} %{release}" ${NAME} )
B="$1-$2~${3#*_}"
A=${TAR%.tar.gz}
B=${B%.opt}
B=${B%${DIST}}
if [[ "$A" > "$B" ]]; then
echo "Installed: $B"
echo "Available: $A"
echo
fi
fi
done
}
do_optimizegraphics() {
if ! (which optipng && which advdef && which pngout) ; then
echo "Missing utility ! Check that 'optipng', 'advdef' and 'pngout' utilities are available !"
return 1
fi
while read m; do
if [ -d "${m}" ]; then
pushd "${m}"
if [ -r .optimizegraphics ]; then
echo "Graphics are already optimized !"
else
optimizegraphics
touch .optimizegraphics
fi
popd
fi
done < submodules
}
alias rr='rpm -qa --qf "%{name}|%{buildhost}|%{packager}\n" | grep -e "\(\.vtf\|andriot\)"|cut -d"|" -f1 | sort'
# Update main repository
alias tdu='(export GIT_ASKPASS=/bin/true; cd ~/tde/tde_master; ./scripts/switch_all_submodules_to_head_and_clean)'
# Build local repository metadata (Mageia)
alias cru='(cdrpm; genhdlist2 --allow-empty-media noarch; genhdlist2 $(uname -i); sudo urpmi.update rpmbuild.$(uname -i) rpmbuild.noarch)'
alias cruc='(cdrpm; genhdlist2 --clean --allow-empty-media noarch; genhdlist2 --clean $(uname -i); sudo urpmi.update rpmbuild.$(uname -i) rpmbuild.noarch)'
# Build local repository (RHEL)
alias cry='(cdrpm; createrepo $(uname -i); createrepo noarch; sudo yum clean all --disablerepo="*" --enablerepo="rpmbuild*")'
alias sy='sudo yum localinstall -y --nogpgcheck'
# Build local repository (openSUSE)
alias crz='(cdrpm; createrepo $(uname -i); createrepo noarch; sudo zypper refresh)'
# Build local repository (PCLOS)
alias cra='(cdrpm; genpkglist $PWD noarch; genpkglist $PWD i586; genpkglist $PWD x86_64; genbasedir $PWD i586 x86_64 noarch; sudo apt-get update)'
alias crac='(cdrpm; for i in i586 noarch x86_64; do cd $i; tdesortrpm.sh; cd -; done; rpmsign --addsign */RPMS.*/*.rpm; for i in i586 noarch x86_64; do for j in 3rdparty applications dependencies extras libraries main; do genpkglist $PWD/$i $j; done; done; for i in i586 noarch x86_64; do genbasedir $PWD/$i 3rdparty applications dependencies extras libraries main; done; sudo apt-get update)'
alias cras='(cdrpm; cd $(uname -i); rm -rf base; mkdir base; for i in 3rdparty applications dependencies extras libraries main; do genpkglist $PWD $i; done; genbasedir $PWD 3rdparty applications dependencies extras libraries main; cd ../noarch; rm -rf base; mkdir base; for i in applications dependencies extras main; do genpkglist $PWD $i; done; genbasedir $PWD applications dependencies extras main )'
# Reinstall packages (Mageia)
getrpmfromsrpm() {
rpm -qa --qf "%{name} %{sourcerpm}\n"|grep "$1"|awk '{print $1}'
}
reinst() {
sudo urpmi --replacepkgs --allow-force $(getrpmfromsrpm $1)
}

@ -1,210 +0,0 @@
#!/bin/bash
cd "$( dirname "$0" )"
ARGS=""
DIST="$(rpmdist.sh --dist)"
# CCACHE related stuff
if [ ! -d /var/cache/ccache ]; then
[ -z "${DIST}" ] && DIST="$(rpm -E "%{dist}")"
if [ -n "${DIST}" ]; then
export CCACHE_DIR=~/.ccache${DIST}.$(uname -m)
fi
fi
while [ $# -gt 0 ]; do
case "$1" in
"--auto"|"-a") AUTO=1;;
"--version"|"-v") REQVERSION="$2"; shift;;
"--"*) ARGS="${ARGS} $1";;
*) COMP="${1%%/}";;
esac
shift
done
if [ -d ~/tde/tde-tarballs/${REQVERSION} ]; then
eval TARBALLS_DIR=~/tde/tde-tarballs/${REQVERSION}
else
eval TARBALLS_DIR=~/tde/tde-tarballs/3.5.13.2
#eval TARBALLS_DIR=~/tde/tde-tarballs/14.0.0
fi
#clear
cat <<EOF
$(< /etc/redhat-release) [$(uname -m)]
This script generates RPM of TDE from source tarball.
EOF
# Checks RPMBUILD environment
RHEL="$( rpm -E "%{rhel}" )"
FEDORA="$( rpm -E "%{fedora}" )"
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
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
fi
# Checks TDE version to use
#if [ -z "${REQVERSION}" ]; then
# REQVERSION="3.5.13"
#fi
if [ -z "${COMP}" ]; then
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
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 *${COMP##*/}*.spec )
if [ $# -gt 1 ]; then
if [ -n "${REQVERSION}" ]; then
set $( cd "${COMP}"; echo *-${REQVERSION}.spec )
SPEC="$1"
else
select SPEC in $*; do break; done
fi
elif [ -r "${COMP}/$1" ]; then
SPEC="$1"
else
echo "Fatal: no spec file found !"
echo $1
exit 2
fi
cat <<EOF
About to build '${COMP}':
Version: '${VERSION}'
Preversion: '${PREVERSION}'
Spec file: '${SPEC}'
Tarball: '${TARBALL}'
Press ENTER to build, or CTRL+C to abort.
EOF
[ -z "${AUTO}" ] && read rep
# Specific prefix for installation of some components
case "${COMP##*/}" in
"qt3") PREFIX="/usr";;
esac
# Determines if we are running an i386 or x86_64 distro
if [ "$(rpm -q --qf '%{arch}\n' kernel | tail -n 1)" = "i686" ]; then
ARGS="${ARGS} --target=i686"
fi
LOGFILE=/tmp/log.${COMP##*/}
SOURCEDIR="$(mktemp -d)"
# Puts the GIT files in 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}"
echo "Copying TARBALL ..."
cp -fv "${TARBALL}" "${SOURCEDIR}"
BUILDDIR="/dev/shm/BUILD${DIST}.$(uname -i)"
BUILDROOTDIR="/dev/shm/BUILDROOT${DIST}.$(uname -i)"
TOPSRCRPMDIR="$(rpm -E %_srcrpmdir)"
TOPRPMDIR="$(rpm -E %_rpmdir)"
SUBDIR="${COMP%/*}"
if [ "${SUBDIR}" = "${COMP}" ]; then
SUBDIR="main"
fi
RPMDIR="${TOPRPMDIR}/${SUBDIR}"
SRCRPMDIR="${TOPSRCRPMDIR}/${SUBDIR}"
[ -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 "tde_prefix ${PREFIX:-/opt/trinity}" \
--define "version ${VERSION:-3.5.13.2}" \
--define "preversion ${PREVERSION}" \
"${SOURCEDIR}/${SPEC}"
echo "RET=$?"
) 2>&1 | tee ${LOGFILE}
eval "$(grep ^RET= ${LOGFILE})"
# Removes temporary source directory
rm -rf "${SOURCEDIR}"
if [ "${RET}" -gt 0 ]; then
exit ${RET}
fi
set +x
if grep -q "error: Failed build dependencies:" ${LOGFILE}; then
# DEPS=$( sed -n -e "/.* is needed by .*/ s/^[ \t]*\([a-zA-Z2-9_-]*\) .*/\1/p" ${LOGFILE} )
set $( grep " is needed by " ${LOGFILE} | cut -d " " -f1 )
exit 2
fi
rm -rf "${SOURCEDIR}"
# Removes BUILDDIR if build succeeded
rm -rf "${BUILDDIR}/"*${COMP##*/}-${VERSION}*
Loading…
Cancel
Save