diff options
author | albator <albator@aria.vtf> | 2011-09-04 17:04:12 +0200 |
---|---|---|
committer | albator <albator@aria.vtf> | 2011-09-04 17:04:12 +0200 |
commit | 016dd39c2ae7c15ce5b16c992fa1a2dd60d755ca (patch) | |
tree | 94d8c98fbf2650fbbf980469a7cf70054147ffb4 /redhat | |
parent | df86c138f55c583cec28278b818236917a75f229 (diff) | |
download | tde-packaging-016dd39c2ae7c15ce5b16c992fa1a2dd60d755ca.tar.gz tde-packaging-016dd39c2ae7c15ce5b16c992fa1a2dd60d755ca.zip |
Initial production script for RHEL
Use 'gentarball.sh' to generate tarballs from SVN, then 'genrpm.sh' to build RPM.
Diffstat (limited to 'redhat')
-rw-r--r-- | redhat/components.txt | 7 | ||||
-rwxr-xr-x | redhat/genrpm.sh | 80 | ||||
-rwxr-xr-x | redhat/gentarball.sh | 60 |
3 files changed, 147 insertions, 0 deletions
diff --git a/redhat/components.txt b/redhat/components.txt new file mode 100644 index 000000000..9a4b4836d --- /dev/null +++ b/redhat/components.txt @@ -0,0 +1,7 @@ +dependencies/qt3 +dependencies/tqtinterface +dependencies/dbus-tqt +dependencies/arts +kdelibs +kdebase +kdebindings diff --git a/redhat/genrpm.sh b/redhat/genrpm.sh new file mode 100755 index 000000000..96d6ce7de --- /dev/null +++ b/redhat/genrpm.sh @@ -0,0 +1,80 @@ +#!/bin/bash + +cd "$( dirname "$0" )" + +clear +cat <<EOF +This script generates RPM of TDE from source tarball. +Please choose a TDE component to build. + +EOF + +# Checks RPMBUILD environment +if [ $( rpm -E "%{rhel}" ) = "%{rhel}" ] && [ $( rpm -E "%{fedora}" ) = "%{fedora}" ]; 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 + +select COMP in $( cut -f1 "components.txt" ) ; do + # 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 + if [ -z "${VERSION}" ]; then + set $( cd "${COMP}"; echo ${COMP##*/}*.tar.gz) + if [ $# -gt 1 ]; then + select VERSION in $*; do break; done + elif [ -r "${COMP}/$1" ]; then + VERSION="$1" + else + echo "No source tarball found for '${COMP}' !" + continue + fi + VERSION="${VERSION##${COMP##*/}-}" + VERSION="${VERSION%%.tar.gz}" + # If version is defined in spec file: appends the date + else + VERSION="${VERSION}.$(date +%Y%m%d)" + fi + + # Chooses a spec file (if many) + set $( cd "${COMP}"; echo *.spec ) + if [ $# -gt 1 ]; then + select SPEC in $*; do break; done + elif [ -r "${COMP}/$1" ]; then + SPEC="$1" + else + echo "Fatal: no spec file found !" + exit 2 + fi + + cat <<EOF + +About to build '${COMP}': + Version: '${VERSION}' + Spec file: '${SPEC}' + +Press ENTER to build, or CTRL+C to abort. +EOF + read rep + + # Specific prefix for installation of some components + case "${COMP##*/}" in + "qt3") PREFIX="/usr";; + esac + + set -x + rpmbuild -ba \ + --define "_sourcedir ${PWD}/${COMP}" \ + --define "_prefix ${PREFIX:-/opt/trinity}" \ + --define "version ${VERSION:-3.5.13}" \ + ${COMP}/${SPEC} || exit 1 + set +x +done + diff --git a/redhat/gentarball.sh b/redhat/gentarball.sh new file mode 100755 index 000000000..9fd57625f --- /dev/null +++ b/redhat/gentarball.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +cd "$( dirname "$0" )" + +# Default TDE version (if unspecified in 'components.txt') +DEFAULT_VERSION="3.5.12.99" + +clear +cat <<EOF +This script generates a source tarball of TDE from the SVN/GIT repository. +Please choose a TDE component to archive or build. + +EOF + + +##### CHOOSE A TDE COMPONENT ##### +PS3="Enter number: " +select COMP in $( cut -f1 components.txt ) ; do + ARCHIVEDIR="${PWD}/${COMP}" + [ -d "${ARCHIVEDIR}" ] || mkdir -p "${ARCHIVEDIR}" + + VERSION=$( awk '{ if ($1 == "'${COMP}'") { print $2; } }' components.txt ) + if [ -z "${VERSION}" ]; then VERSION=${DEFAULT_VERSION}; fi + ARCHIVENAME=${COMP##*/}-${VERSION}.$(date +%Y%m%d).tar.gz + + # List existing tarballs + if [ -e ${ARCHIVEDIR}/${COMP##*/}*.tar.gz ]; then + echo + echo "You currently have the following tarball(s): " + for i in ${ARCHIVEDIR}/${COMP##*/}*.tar.gz; do echo " ${i##*/}"; done + fi + + echo + echo "Press ENTER to download a new version '${ARCHIVENAME}', or CTRL+C to abort." + read rep + + TMPDIRTDE=$(mktemp -d) + pushd "${TMPDIRTDE}" >/dev/null + mkdir -p "${TMPDIRTDE}/${COMP}" + pushd "${COMP}/.." >/dev/null + echo "Extracting '${COMP}' from SVN ..." + case "${COMP##*/}" in + "qt3") git clone http://scm.trinitydesktop.org/scm/git/tde; mv tde/main/dependencies/qt3 . ;; + *) svn export --force --quiet svn://anonsvn.kde.org/home/kde/branches/trinity/${COMP};; + esac + popd >/dev/null + echo "Creating archive '${ARCHIVENAME}' ..." + tar cfz ${ARCHIVEDIR}/${ARCHIVENAME} ${COMP} + popd >/dev/null + echo "Cleaning temporary directory ..." + rm -rf "${TMPDIRTDE}" + cat <<EOF + +Resulting archive: +EOF + \ls -l ${ARCHIVEDIR}/${ARCHIVENAME} + echo + echo "Have a nice day !" + break +done |