From c39ca964b3288690923cdb4e63275aebd334e4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Sun, 2 Dec 2018 11:45:46 +0100 Subject: RPM: update build scripts --- redhat/build/gather_rpm_sources.sh | 4 ++-- redhat/build/get_latest_tarball_filename.sh | 16 ++++++++-------- redhat/build/get_specfile.sh | 12 +++++++----- redhat/buildenv.sh | 15 ++++++++------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/redhat/build/gather_rpm_sources.sh b/redhat/build/gather_rpm_sources.sh index f6b7253dc..244b140c5 100755 --- a/redhat/build/gather_rpm_sources.sh +++ b/redhat/build/gather_rpm_sources.sh @@ -1,4 +1,4 @@ -#!/bin/bash -x +#!/bin/bash # Usage: gather_rpm_sources.sh # Example: gather_rpm_sources.sh tdebase 14.0.0 /tmp/tdebase @@ -30,7 +30,7 @@ cp -f ${SPECFILE} ${SOURCES} ${TARBALL} "${TARGETDIR}" ### Check for patches -PATCHDIR="${HOME}/tde/tde-patches/${TDE_VERSION}/$1" +PATCHDIR="${HOME}/tde/patches/${TDE_VERSION}/$1" if [ -d "${PATCHDIR}" ]; then cat "${PATCHDIR}/"*".patch" >>"${TARGETDIR}/one.patch" sed -i "${TARGETDIR}/"*".spec" \ diff --git a/redhat/build/get_latest_tarball_filename.sh b/redhat/build/get_latest_tarball_filename.sh index 7901d0915..7e8059b3b 100755 --- a/redhat/build/get_latest_tarball_filename.sh +++ b/redhat/build/get_latest_tarball_filename.sh @@ -10,32 +10,32 @@ TDE_VERSION="${2:-14.0.0}" EXTRA_DIR="$(cd ${TARBALLS_DIR}/../extras/; pwd)" -RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -n | tail -n 1) +RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 -RET=$(find "${TARBALLS_DIR}" "${EXTRA_DIR}" -follow -name "${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -n | tail -n 1) +RET=$(find "${TARBALLS_DIR}" "${EXTRA_DIR}" -follow -name "${PKGNAME}-${TDE_VERSION}*.tar.gz" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 -RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-[0-9]*.tar.gz" | sort -n | tail -n 1) +RET=$(find "${TARBALLS_DIR}" -name "trinity-${PKGNAME}-[0-9]*.tar.gz" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 -RET=$(find "${EXTRA_DIR}" -follow -name "${PKGNAME}[-_][0-9]*.tar.*" | sort -n | tail -n 1) +RET=$(find "${EXTRA_DIR}" -follow -name "${PKGNAME}[-_][0-9]*.tar.*" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 # Now look in the 'tde-packaging' directory -RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1) +RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 # Retry without 'trinity-*', and allow any TAR extension. -RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1) +RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 # Retry without 'trinity-*', and allow any TAR extension. -RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -n | tail -n 1) +RET=$(find "${DIST_PACKAGING_DIR}" -name "${PKGNAME}-[0-9]*.tar*" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 # Retry by removing numbers in package name, e.g "imlib1" => "imlib" -RET=$(find "${DIST_PACKAGING_DIR}" -name "$(tr -d "[0-9]" <<< ${PKGNAME})-[0-9]*.tar*" | sort -n | tail -n 1) +RET=$(find "${DIST_PACKAGING_DIR}" -name "$(tr -d "[0-9]" <<< ${PKGNAME})-[0-9]*.tar*" | sort -V | tail -n 1) [ -r "${RET}" ] && echo "${RET}" && exit 0 diff --git a/redhat/build/get_specfile.sh b/redhat/build/get_specfile.sh index b7336ffcc..92fbd7ddb 100755 --- a/redhat/build/get_specfile.sh +++ b/redhat/build/get_specfile.sh @@ -25,10 +25,12 @@ for filename in \ "trinity-${PKGNAME}.spec" \ ; do SPECFILE="$(find "${DIST_PACKAGING_DIR}" -follow -name "${filename}")" - if [ -r "${SPECFILE}" ]; then - echo "${SPECFILE}" - exit 0 - fi + [ -r "${SPECFILE}" ] && break || continue done -exit 1 +if [ -r "${SPECFILE}" ]; then + echo "${SPECFILE}" + exit 0 +else + exit 1 +fi diff --git a/redhat/buildenv.sh b/redhat/buildenv.sh index 029f29afa..13304eb05 100644 --- a/redhat/buildenv.sh +++ b/redhat/buildenv.sh @@ -2,13 +2,14 @@ # This file can be sourced in your .bashrc -TDE_BASEDIR=~/tde +BRANCH="$(git rev-parse --abbrev-ref HEAD)" +TDE_BASEDIR="${HOME}/tde" [ -z "${TDE_VERSION}" ] && TDE_VERSION="14.0.5" -TDE_GITBASESRC=${TDE_BASEDIR}/tde.master -TDE_GITBASEPKG=${TDE_BASEDIR}/tde-packaging.master/redhat -TDE_TARBALLS=${TDE_BASEDIR}/tde-tarballs/${TDE_VERSION} +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}" -[ -d "${TDE_PACKAGING_DIR}" ] || export TDE_PACKAGING_DIR=~/tde/tde-packaging.master export PATH="${PATH}:${TDE_GITBASEPKG}/build" @@ -16,7 +17,7 @@ export PATH="${PATH}:${TDE_GITBASEPKG}/build" export DIST="$( "${TDE_GITBASEPKG}/build/rpmdist.sh" --dist )" # Go to the RPMS folder -alias cdrpm='cd ~/rpmbuild/RPMS/RPMS${DIST}' +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' @@ -31,7 +32,7 @@ alias tdep3='(rm -rf ~/tde/tde-tarballs/3.5.13.2; cd ~/tde/tde_v3.5.13-sru; expo 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 ~/tde/tde-packaging/redhat' +alias cdp='cd $HOME/tde/tde-packaging/redhat' grp3() { build_rpm_package.sh "${1}" "3.5.13.2" -- cgit v1.2.1