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

[#1317] Cleaning

parent 7f2ef061
Branches
Tags
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 @@ ...@@ -9,58 +9,42 @@
# Last Modified: 2009-05-28 15:55:14 -0400 # Last Modified: 2009-05-28 15:55:14 -0400
##################################################### #####################################################
# general
RELEASE_MODE="$1"
ROOT_DIR="/home/sflphone" ROOT_DIR="/home/sflphone"
PACKAGING_DIR="${ROOT_DIR}/sflphone-packaging" PACKAGING_DIR="${ROOT_DIR}/sflphone-packaging"
# distributions
UBUNTU_DIR="${PACKAGING_DIR}/ubuntu" UBUNTU_DIR="${PACKAGING_DIR}/ubuntu"
OPENSUSE="${PACKAGING_DIR}/opensuse" OPENSUSE_DIR="${PACKAGING_DIR}/opensuse"
# where packaging will be donne
BUILD_DIR="${PACKAGING_DIR}/build" BUILD_DIR="${PACKAGING_DIR}/build"
DIST_DIR="${PACKAGING_DIR}/dists"
REPOSITORY_ARCHIVE="${BUILD_DIR}/sflphone.tar.gz" REPOSITORY_ARCHIVE="${BUILD_DIR}/sflphone.tar.gz"
REPOSITORY_DIR="${BUILD_DIR}/sflphone" 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*//'` ARCH_FLAG=`getconf -a|grep LONG_BIT | sed -e 's/LONG_BIT\s*//'`
OS_VERSION=`lsb_release -d -s -c | sed -e '1d'` 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` VERSION=`cat ${BUILD_DIR}/VERSION`
if [ ! ${VERSION} ]; then # other stuff
echo "!! Cannot detect current version"
exit -1
fi
EDITOR=echo EDITOR=echo
export EDITOR export EDITOR
RELEASE_MODE=$1 RELEASE_MODE=$1
USER="sflphone" USER="sflphone"
WHOAMI=`whoami`
#PACKAGES=('sflphone-common' 'sflphone-client-gnome' 'sflphone-client-kde') # packages we will build
PACKAGES=('sflphone-common sflphone-client-gnome') PACKAGES=('sflphone-common sflphone-client-gnome')
GLOBAL_LOG=${PACKAGING_DIR}/sflphone-${OS_VERSION}-${ARCH_FLAG}.log # log file
LOG_ID="${OS_VERSION}"
# open log file if [ "${LOG_ID}" = "" ]; then
exec 3<>${GLOBAL_LOG} LOG_ID="${DISTRIBUTION}"
# 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;
fi fi
LOG_FILE=${PACKAGING_DIR}/sflphone-${LOG_ID}-${ARCH_FLAG}.log
if [ ${RELEASE_MODE} ]; then
echo "Release mode : ${RELEASE_MODE}"
else
echo "Snapshot mode"
fi
#!/bin/bash #!/bin/bash
##################################################### #####################################################
# File Name: build-package-opensuse.sh # File Name: build-packages-opensuse.sh
# #
# Purpose : # Purpose :
# #
# Author: Julien Bonjean (julien@bonjean.info) # Author: Julien Bonjean (julien@bonjean.info)
# #
# Creation Date: 2009-05-27 # 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 . ../globals
SRC_DIR=${HOME}/sflphone-packaging/build/sflphone
WORKING_DIR=${HOME}/sflphone-packaging
VERSION=`cat ${SRC_DIR}/sflphone-common/VERSION`
if [ ! ${VERSION} ]; then cd ${OPENSUSE_DIR}
echo "!! Cannot detect current version"
if [ "$?" -ne "0" ]; then
echo " !! Cannot cd to openSUSE directory"
exit -1 exit -1
fi fi
# create build directories
echo "Create directories" echo "Create directories"
mkdir -p ${BUILD_DIR}/BUILD mkdir -p ${BUILD_DIR}/BUILD
mkdir -p ${BUILD_DIR}/RPMS mkdir -p ${BUILD_DIR}/RPMS
...@@ -27,6 +27,7 @@ mkdir -p ${BUILD_DIR}/SOURCES ...@@ -27,6 +27,7 @@ mkdir -p ${BUILD_DIR}/SOURCES
mkdir -p ${BUILD_DIR}/SPECS mkdir -p ${BUILD_DIR}/SPECS
mkdir -p ${BUILD_DIR}/SRPMS mkdir -p ${BUILD_DIR}/SRPMS
# create rpm macros
echo "Create RPM macros" echo "Create RPM macros"
cat > ~/.rpmmacros << STOP cat > ~/.rpmmacros << STOP
%packager Julien Bonjean (julien.bonjean@savoirfairelinux.com) %packager Julien Bonjean (julien.bonjean@savoirfairelinux.com)
...@@ -44,29 +45,48 @@ cat > ~/.rpmmacros << STOP ...@@ -44,29 +45,48 @@ cat > ~/.rpmmacros << STOP
%_srcrpmdir %{_topdir}/SRPMS %_srcrpmdir %{_topdir}/SRPMS
STOP STOP
# create packages
for PACKAGE in ${PACKAGES[@]} for PACKAGE in ${PACKAGES[@]}
do do
echo "Prepare ${PACKAGE}" echo "Prepare ${PACKAGE}"
cd ${SRC_DIR} cd ${REPOSITORY_DIR}
echo " -> create source archive" echo " -> create source archive"
mv ${PACKAGE} ${PACKAGE}-${VERSION} 2>/dev/null mv ${PACKAGE} ${PACKAGE}-${VERSION} 2>/dev/null && \
tar cf ${PACKAGE}.tar.gz ${PACKAGE}-${VERSION} tar cf ${PACKAGE}.tar.gz ${PACKAGE}-${VERSION} && \
mv ${PACKAGE}-${VERSION} ${PACKAGE} mv ${PACKAGE}-${VERSION} ${PACKAGE}
if [ "$?" -ne "0" ]; then
echo "!! Cannot create source archive"
exit -1
fi
echo " -> move archive to source directory" echo " -> move archive to source directory"
mv ${PACKAGE}.tar.gz ${BUILD_DIR}/SOURCES 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" echo " -> update spec file"
sed "s/VERSION/${VERSION}/g" ${PACKAGE}.spec > ${BUILD_DIR}/SPECS/${PACKAGE}.spec 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 done
# launch build
echo "Launch build" echo "Launch build"
rpmbuild -ba ${BUILD_DIR}/SPECS/*.spec rpmbuild -ba ${BUILD_DIR}/SPECS/*.spec
exit 0 if [ "$?" -ne "0" ]; then
echo "!! Cannot build packages"
exit -1
fi
...@@ -7,11 +7,6 @@ ...@@ -7,11 +7,6 @@
. ../globals . ../globals
if [ ! ${PACKAGING_DIR} ];then
echo "!! Cannot source globals file"
exit -1
fi
cd ${UBUNTU_DIR} cd ${UBUNTU_DIR}
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
...@@ -20,7 +15,7 @@ if [ "$?" -ne "0" ]; then ...@@ -20,7 +15,7 @@ if [ "$?" -ne "0" ]; then
fi fi
PACKAGE_SYSVER="0ubuntu1" PACKAGE_SYSVER="0ubuntu1"
FULL_VERSION="${VERSION}-0ubuntu1" FULL_VERSION="${VERSION}-${PACKAGE_SYSVER}"
######################### #########################
# BEGIN # BEGIN
...@@ -39,21 +34,13 @@ echo "Do updates" ...@@ -39,21 +34,13 @@ echo "Do updates"
sudo apt-get update >/dev/null sudo apt-get update >/dev/null
sudo apt-get upgrade -y >/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[@]} for PACKAGE in ${PACKAGES[@]}
do do
echo "Process ${PACKAGE}" echo "Process ${PACKAGE}"
echo " -> prepare debian directories" echo " -> prepare debian directories"
mv ${UBUNTU_DIR}/debian-${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}/ mv ${UBUNTU_DIR}/debian-${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}/debian
# generate the changelog # generate the changelog
echo " -> generate changelog" echo " -> generate changelog"
...@@ -114,10 +101,3 @@ if [ "$?" -ne "0" ]; then ...@@ -114,10 +101,3 @@ if [ "$?" -ne "0" ]; then
exit -1 exit -1
fi fi
echo "All done"
# close file descriptor
exec 3>&-
exit 0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# Author: Julien Bonjean (julien@bonjean.info) # Author: Julien Bonjean (julien@bonjean.info)
# #
# Creation Date: 2009-04-20 # 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 ...@@ -228,7 +228,7 @@ if [ ${DO_PREPARE} ]; then
VERSION="${VERSION}~${RELEASE_MODE}" VERSION="${VERSION}~${RELEASE_MODE}"
fi fi
else else
VERSION="${VERSION}-snapshot-${SNAPSHOT_TAG}" VERSION="${VERSION}~snapshot${SNAPSHOT_TAG}"
fi fi
echo "Version is : ${VERSION}" echo "Version is : ${VERSION}"
...@@ -265,7 +265,7 @@ if [ ${DO_PREPARE} ]; then ...@@ -265,7 +265,7 @@ if [ ${DO_PREPARE} ]; then
# generate the changelog, according to the distribution and the git commit messages # generate the changelog, according to the distribution and the git commit messages
echo "Update debian changelogs (2/2)" echo "Update debian changelogs (2/2)"
cd ${REPOSITORY_DIR} cd ${REPOSITORY_DIR}
${SCRIPTS_DIR}/sfl-git-dch.sh ${RELEASE_MODE} ${SCRIPTS_DIR}/sfl-git-dch.sh ${VERSION} ${RELEASE_MODE}
if [ "$?" -ne "0" ]; then if [ "$?" -ne "0" ]; then
echo "!! Cannot update debian changelogs" echo "!! Cannot update debian changelogs"
...@@ -333,7 +333,7 @@ if [ ${DO_MAIN_LOOP} ]; then ...@@ -333,7 +333,7 @@ if [ ${DO_MAIN_LOOP} ]; then
fi fi
echo "Launch remote build" 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 if [ "$?" -ne "0" ]; then
echo " !! Error during remote packaging process" echo " !! Error during remote packaging process"
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# Author: Julien Bonjean (julien@bonjean.info) # Author: Julien Bonjean (julien@bonjean.info)
# #
# Creation Date: 2009-05-13 # 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 # set -x
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment