Skip to content
Snippets Groups Projects
Commit 903d3f80 authored by Julien Bonjean's avatar Julien Bonjean
Browse files

[#1317] Cleaning

parent 7f2ef061
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
#####################################################
# File Name: build-packages.sh
#
# Purpose :
#
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-05-29
# Last Modified: 2009-05-29 12:27:50 -0400
#####################################################
. ./globals
if [ "$?" -ne 0 ]; then
echo "!! Cannot source global file"
exit -1
fi
cd ${PACKAGING_DIR}
if [ ! ${PACKAGING_DIR} ];then
echo "!! Cannot go to working directory"
exit -1
fi
# check if version is ok
if [ ! ${VERSION} ]; then
echo "!! Cannot detect current version"
exit -1
fi
# open log file
exec 3<>${LOG_FILE}
# redirect outputs (stdout & stderr)
exec 1>&3
exec 2>&3
echo "SFLPhone version is ${VERSION}"
# check user
if [ "${WHOAMI}" != "${USER}" ]; then
echo "!! Please use user ${USER} to run this script"
exit -1;
fi
if [ ${RELEASE_MODE} ]; then
echo "Release mode : ${RELEASE_MODE}"
else
echo "Snapshot mode"
fi
# decompress repository
echo "Untar repository"
cd ${BUILD_DIR} && tar xf ${REPOSITORY_ARCHIVE}
if [ "$?" -ne "0" ]; then
echo " !! Cannot untar repository"
exit -1
fi
# launch distribution specific script
if [ "${DISTRIBUTION}" = "ubuntu" ];then
echo "Launch packaging for Ubuntu (hardy/intrepid/jaunty)"
cd ${UBUNTU_DIR} && ./build-packages-ubuntu.sh $*
elif [ "${DISTRIBUTION}" = "opensuse" ]; then
echo "Launch packaging for openSUSE 11"
cd ${OPENSUSE_DIR} && ./build-packages-opensuse.sh $*
else
echo "!! Cannot detect distribution"
exit -1
fi
if [ "$?" -ne 0 ]; then
echo "!! Error in subprocess"
exit -1
fi
echo "All done"
# close file descriptor
exec 3>&-
exit 0
......@@ -9,58 +9,42 @@
# Last Modified: 2009-05-28 15:55:14 -0400
#####################################################
# general
RELEASE_MODE="$1"
ROOT_DIR="/home/sflphone"
PACKAGING_DIR="${ROOT_DIR}/sflphone-packaging"
# distributions
UBUNTU_DIR="${PACKAGING_DIR}/ubuntu"
OPENSUSE="${PACKAGING_DIR}/opensuse"
OPENSUSE_DIR="${PACKAGING_DIR}/opensuse"
# where packaging will be donne
BUILD_DIR="${PACKAGING_DIR}/build"
DIST_DIR="${PACKAGING_DIR}/dists"
REPOSITORY_ARCHIVE="${BUILD_DIR}/sflphone.tar.gz"
REPOSITORY_DIR="${BUILD_DIR}/sflphone"
REPOSITORY_SFLPHONE_COMMON_DIR="${REPOSITORY_DIR}/sflphone-common"
REPOSITORY_SFLPHONE_CLIENT_KDE_DIR="${REPOSITORY_DIR}/sflphone-client-kde"
REPOSITORY_SFLPHONE_CLIENT_GNOME_DIR="${REPOSITORY_DIR}/sflphone-client-gnome"
# target directories
DIST_DIR="${PACKAGING_DIR}/dists"
# system information
ARCH_FLAG=`getconf -a|grep LONG_BIT | sed -e 's/LONG_BIT\s*//'`
OS_VERSION=`lsb_release -d -s -c | sed -e '1d'`
DISTRIBUTION=`lsb_release -s -d | sed 's/"//g' | tr 'A-Z' 'a-z' | cut -d " " -f1`
VERSION=`cat ${BUILD_DIR}/VERSION`
if [ ! ${VERSION} ]; then
echo "!! Cannot detect current version"
exit -1
fi
# other stuff
EDITOR=echo
export EDITOR
RELEASE_MODE=$1
USER="sflphone"
WHOAMI=`whoami`
#PACKAGES=('sflphone-common' 'sflphone-client-gnome' 'sflphone-client-kde')
# packages we will build
PACKAGES=('sflphone-common sflphone-client-gnome')
GLOBAL_LOG=${PACKAGING_DIR}/sflphone-${OS_VERSION}-${ARCH_FLAG}.log
# open log file
exec 3<>${GLOBAL_LOG}
# redirect outputs (stdout & stderr)
exec 1>&3
exec 2>&3
echo "SFLPhone version is ${VERSION}"
WHO=`whoami`
if [ "${WHO}" != "${USER}" ]; then
echo "!! Please use user ${USER} to run this script"
exit -1;
# log file
LOG_ID="${OS_VERSION}"
if [ "${LOG_ID}" = "" ]; then
LOG_ID="${DISTRIBUTION}"
fi
if [ ${RELEASE_MODE} ]; then
echo "Release mode : ${RELEASE_MODE}"
else
echo "Snapshot mode"
fi
LOG_FILE=${PACKAGING_DIR}/sflphone-${LOG_ID}-${ARCH_FLAG}.log
#!/bin/bash
#####################################################
# File Name: build-package-opensuse.sh
# File Name: build-packages-opensuse.sh
#
# Purpose :
#
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-05-27
# Last Modified: 2009-05-28 16:32:54 -0400
# Last Modified: 2009-05-29 12:15:08 -0400
#####################################################
BUILD_DIR=/tmp/sflphone
SRC_DIR=${HOME}/sflphone-packaging/build/sflphone
WORKING_DIR=${HOME}/sflphone-packaging
VERSION=`cat ${SRC_DIR}/sflphone-common/VERSION`
. ../globals
if [ ! ${VERSION} ]; then
echo "!! Cannot detect current version"
cd ${OPENSUSE_DIR}
if [ "$?" -ne "0" ]; then
echo " !! Cannot cd to openSUSE directory"
exit -1
fi
# create build directories
echo "Create directories"
mkdir -p ${BUILD_DIR}/BUILD
mkdir -p ${BUILD_DIR}/RPMS
......@@ -27,6 +27,7 @@ mkdir -p ${BUILD_DIR}/SOURCES
mkdir -p ${BUILD_DIR}/SPECS
mkdir -p ${BUILD_DIR}/SRPMS
# create rpm macros
echo "Create RPM macros"
cat > ~/.rpmmacros << STOP
%packager Julien Bonjean (julien.bonjean@savoirfairelinux.com)
......@@ -44,29 +45,48 @@ cat > ~/.rpmmacros << STOP
%_srcrpmdir %{_topdir}/SRPMS
STOP
# create packages
for PACKAGE in ${PACKAGES[@]}
do
echo "Prepare ${PACKAGE}"
cd ${SRC_DIR}
cd ${REPOSITORY_DIR}
echo " -> create source archive"
mv ${PACKAGE} ${PACKAGE}-${VERSION} 2>/dev/null
tar cf ${PACKAGE}.tar.gz ${PACKAGE}-${VERSION}
mv ${PACKAGE} ${PACKAGE}-${VERSION} 2>/dev/null && \
tar cf ${PACKAGE}.tar.gz ${PACKAGE}-${VERSION} && \
mv ${PACKAGE}-${VERSION} ${PACKAGE}
if [ "$?" -ne "0" ]; then
echo "!! Cannot create source archive"
exit -1
fi
echo " -> move archive to source directory"
mv ${PACKAGE}.tar.gz ${BUILD_DIR}/SOURCES
cd ${WORKING_DIR}
if [ "$?" -ne "0" ]; then
echo "!! Cannot move archive"
exit -1
fi
cd ${PACKAGING_DIR}
echo " -> update spec file"
sed "s/VERSION/${VERSION}/g" ${PACKAGE}.spec > ${BUILD_DIR}/SPECS/${PACKAGE}.spec
if [ "$?" -ne "0" ]; then
echo "!! Cannot update spec file"
exit -1
fi
done
# launch build
echo "Launch build"
rpmbuild -ba ${BUILD_DIR}/SPECS/*.spec
exit 0
if [ "$?" -ne "0" ]; then
echo "!! Cannot build packages"
exit -1
fi
......@@ -7,11 +7,6 @@
. ../globals
if [ ! ${PACKAGING_DIR} ];then
echo "!! Cannot source globals file"
exit -1
fi
cd ${UBUNTU_DIR}
if [ "$?" -ne "0" ]; then
......@@ -20,7 +15,7 @@ if [ "$?" -ne "0" ]; then
fi
PACKAGE_SYSVER="0ubuntu1"
FULL_VERSION="${VERSION}-0ubuntu1"
FULL_VERSION="${VERSION}-${PACKAGE_SYSVER}"
#########################
# BEGIN
......@@ -39,21 +34,13 @@ echo "Do updates"
sudo apt-get update >/dev/null
sudo apt-get upgrade -y >/dev/null
# decompress repository
echo "Untar repository"
cd ${BUILD_DIR} && tar xf ${REPOSITORY_ARCHIVE}
if [ "$?" -ne "0" ]; then
echo " !! Cannot untar repository"
exit -1
fi
for PACKAGE in ${PACKAGES[@]}
do
echo "Process ${PACKAGE}"
echo " -> prepare debian directories"
mv ${UBUNTU_DIR}/debian-${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}/
mv ${UBUNTU_DIR}/debian-${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}/debian
# generate the changelog
echo " -> generate changelog"
......@@ -114,10 +101,3 @@ if [ "$?" -ne "0" ]; then
exit -1
fi
echo "All done"
# close file descriptor
exec 3>&-
exit 0
......@@ -7,7 +7,7 @@
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-04-20
# Last Modified: 2009-05-28 18:30:17 -0400
# Last Modified: 2009-05-29 12:29:27 -0400
#####################################################
#
......@@ -228,7 +228,7 @@ if [ ${DO_PREPARE} ]; then
VERSION="${VERSION}~${RELEASE_MODE}"
fi
else
VERSION="${VERSION}-snapshot-${SNAPSHOT_TAG}"
VERSION="${VERSION}~snapshot${SNAPSHOT_TAG}"
fi
echo "Version is : ${VERSION}"
......@@ -265,7 +265,7 @@ if [ ${DO_PREPARE} ]; then
# generate the changelog, according to the distribution and the git commit messages
echo "Update debian changelogs (2/2)"
cd ${REPOSITORY_DIR}
${SCRIPTS_DIR}/sfl-git-dch.sh ${RELEASE_MODE}
${SCRIPTS_DIR}/sfl-git-dch.sh ${VERSION} ${RELEASE_MODE}
if [ "$?" -ne "0" ]; then
echo "!! Cannot update debian changelogs"
......@@ -333,7 +333,7 @@ if [ ${DO_MAIN_LOOP} ]; then
fi
echo "Launch remote build"
${SSH_BASE} "cd ${REMOTE_DEPLOY_DIR}/ubuntu/ && ./build-package-ubuntu.sh ${RELEASE_MODE}"
${SSH_BASE} "cd ${REMOTE_DEPLOY_DIR} && ./build-packages.sh ${RELEASE_MODE}"
if [ "$?" -ne "0" ]; then
echo " !! Error during remote packaging process"
......
......@@ -7,7 +7,7 @@
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-05-13
# Last Modified: 2009-05-28 18:24:53 -0400
# Last Modified: 2009-05-29 10:51:33 -0400
#####################################################
# set -x
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment