From f75675f1198669c809cbe7acaea85e05f8018b45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= Date: Thu, 25 Jul 2013 18:19:54 +0200 Subject: RPM Packaging: add build scripts --- redhat/buildenv.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ redhat/rpmdist.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 redhat/buildenv.sh create mode 100755 redhat/rpmdist.sh diff --git a/redhat/buildenv.sh b/redhat/buildenv.sh new file mode 100644 index 000000000..da59a2953 --- /dev/null +++ b/redhat/buildenv.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# This file can be sourced in your .bashrc + +TDE_BASEDIR=~/tde +TDE_VERSION=14.0.0 +TDE_GITBASESRC=${TDE_BASEDIR}/tde_r14 +TDE_GITBASEPKG=${TDE_BASEDIR}/tde-packaging/redhat +TDE_TARBALLS=${TDE_BASEDIR}/tde-tarballs/${TDE_VERSION} + +export PATH="${PATH}:${TDE_GITBASEPKG}" + +# Distribution suffix (e.g: .el6 , .mga3 ...) +export DIST="$( "${TDE_GITBASEPKG}/rpmdist.sh" --dist )" + +# Go to the RPMS folder +alias cdrpm='cd ~/rpmbuild/RPMS/RPMS${DIST}' + +# Build a single tarball (execute from GIT directory) +alias tdp4='TARGET=14.0.0 SUFFIX=0 TARBALL_DIR=${TDE_TARBALLS}/main COMPRESS=gzip ${TDE_GITBASESRC}/scripts/create_tarball' + +# Rebuild all tarballs +alias tdep3='(rm -rf ~/tde/tde-tarballs/3.5.13.2; cd ~/tde/tde_v3.5.13-sru; export SUFFIX=0; export COMPRESS=gzip; export TDE_REBRAND=1; ./scripts/create_all_tarballs)' +alias tdep4='(rm -rf ${TDE_TARBALLS}; cd ${TDE_GITBASESRC}; export SUFFIX=0; export COMPRESS=gzip; export TDE_REBRAND=1; ./scripts/create_all_tarballs)' + +# Build a single package +alias cdp='cd ~/tde/tde-packaging/redhat' +alias grp3='./genrpm.sh -v 3.5.13.2 -a' +alias grp4='./genrpm.sh -v 14.0.0 -a' + +# Check if tarballs are more recent than installed packages +checknew() { + cd ~/tde/tde-tarballs/14.0.0 + find . -name "trinity-*.tar.gz" | while read f; do + TAR="${f##*/}" + NAME="${TAR%-*}" + + if rpm -q "${NAME}" &>/dev/null; then + set $(rpm -q --qf "%{name} 14.0.0 %{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 +} + +# Build local repository metadata (Mageia) +alias cru='(cdrpm; genhdlist2 noarch; genhdlist2 $(uname -i); sudo urpmi.update rpmbuild.$(uname -i) rpmbuild.noarch)' +alias cruc='(cdrpm; genhdlist2 --clean noarch; genhdlist2 --clean $(uname -i); sudo urpmi.update rpmbuild.$(uname -i) rpmbuild.noarch)' diff --git a/redhat/rpmdist.sh b/redhat/rpmdist.sh new file mode 100755 index 000000000..047fbfaa6 --- /dev/null +++ b/redhat/rpmdist.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +FEDORA=0 +RHEL=0 +MGA=0 +DIST="" + +if [ -r /etc/redhat-release ]; then + read a b c d e < /etc/redhat-release +elif [ -r /etc/SuSE-release ]; then + a="opensuse" +fi + +case $a in + # Mageia release 1 (Official) for x86_64 + Mageia*) + DIST=".mga${c}" +# MDKVERSION="201002" + ;; + # Mandriva Linux release 2011.0 (Official) for x86_64 + Mandriva*) + DIST=".mdv${d}" + MDKVERSION="201100" + ;; + # CentOS release 5.7 (Final) + # CentOS Linux release 6.0 (Final) + CentOS*) + if [ $c = "release" ]; then + RHEL="${d%%.*}"; DIST=".el${RHEL}" + else + RHEL="${c%%.*}"; DIST=".el${RHEL}" + fi + ;; + # Fedora release 15 (Lovelock) + Fedora*) FEDORA="${c}"; DIST=".fc${FEDORA}";; + # Opensuse + opensuse) + DIST=".oss$((read l; read a b c; echo ${c//./})