Commit 781f54d2 authored by Julien Bonjean's avatar Julien Bonjean
Browse files

[#1317] Refactoring for new distributions

parent 23188b80
#####################################################
# File Name: globals
#
# Purpose :
#
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-05-28
# Last Modified: 2009-05-28 15:55:14 -0400
#####################################################
ROOT_DIR="/home/sflphone"
PACKAGING_DIR="${ROOT_DIR}/sflphone-packaging"
UBUNTU_DIR="${PACKAGING_DIR}/ubuntu"
OPENSUSE="${PACKAGING_DIR}/opensuse"
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"
ARCH_FLAG=`getconf -a|grep LONG_BIT | sed -e 's/LONG_BIT\s*//'`
OS_VERSION=`lsb_release -d -s -c | sed -e '1d'`
VERSION=`cat ${BUILD_DIR}/VERSION`
if [ ! ${VERSION} ]; then
echo "!! Cannot detect current version"
exit -1
fi
EDITOR=echo
export EDITOR
RELEASE_MODE=$1
USER="sflphone"
#PACKAGES=('sflphone-common' 'sflphone-client-gnome' 'sflphone-client-kde')
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;
fi
if [ ${RELEASE_MODE} ]; then
echo "Release mode : ${RELEASE_MODE}"
else
echo "Snapshot mode"
fi
......@@ -7,7 +7,7 @@
# Author: Julien Bonjean (julien@bonjean.info)
#
# Creation Date: 2009-05-27
# Last Modified: 2009-05-28 15:35:07 -0400
# Last Modified: 2009-05-28 16:32:54 -0400
#####################################################
BUILD_DIR=/tmp/sflphone
......@@ -20,9 +20,6 @@ if [ ! ${VERSION} ]; then
exit -1
fi
#PACKAGES=('sflphone-common' 'sflphone-client-gnome' 'sflphone-client-kde')
PACKAGES=('sflphone-common sflphone-client-gnome')
echo "Create directories"
mkdir -p ${BUILD_DIR}/BUILD
mkdir -p ${BUILD_DIR}/RPMS
......
#!/bin/bash
#
# @author: Yun Liu <yun.liu@savoirfairelinux.com>, Julien Bonjean <julien.bonjean@savoirfairelinux.com>
#
# Refer to http://www.sflphone.org for futher information
#
. ../globals
if [ ! ${PACKAGING_DIR} ];then
echo "!! Cannot source globals file"
exit -1
fi
cd ${UBUNTU_DIR}
if [ "$?" -ne "0" ]; then
echo " !! Cannot cd to Ubuntu directory"
exit -1
fi
PACKAGE_SYSVER="0ubuntu1"
FULL_VERSION="${VERSION}-0ubuntu1"
#########################
# BEGIN
#########################
DIST="dist"
if [ ${RELEASE_MODE} ]; then
if [ "${RELEASE_MODE}" != "release" ]; then
DIST="${DIST}-testing"
fi
else
DIST="${DIST}-daily"
fi
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}/
# generate the changelog
echo " -> generate changelog"
sed -i 's/SYSTEM/'${OS_VERSION}'/g' ${REPOSITORY_DIR}/${PACKAGE}/debian/changelog && \
sed -i 's/SYSVER/'${PACKAGE_SYSVER}'/g' ${REPOSITORY_DIR}/${PACKAGE}/debian/changelog
if [ "$?" -ne "0" ]; then
echo "!! Cannot generate changelog"
exit -1
fi
# copy the appropriate control file based on architecture
echo " -> generate control file"
cp ${REPOSITORY_DIR}/${PACKAGE}/debian/control.$OS_VERSION ${REPOSITORY_DIR}/${PACKAGE}/debian/control && \
sed -i "s/VERSION/${FULL_VERSION}/g" ${REPOSITORY_DIR}/${PACKAGE}/debian/control
if [ "$?" -ne "0" ]; then
echo "!! Cannot generate control file"
exit -1
fi
# provide prerequisite directories used by debuild
echo " -> prepare directories"
cp -r ${REPOSITORY_DIR}/${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}-${FULL_VERSION}.orig && \
mv ${REPOSITORY_DIR}/${PACKAGE} ${REPOSITORY_DIR}/${PACKAGE}-${FULL_VERSION}
# build package sflphone-common
cd ${REPOSITORY_DIR}/${PACKAGE}-${FULL_VERSION}/debian && \
debuild -us -uc
if [ "$?" -ne "0" ]; then
echo "!! Cannot generate package ${PACKAGE}"
exit -1
fi
done
# move to dist
echo "Deploy files in dist directories"
BINARY_DIR=""
if [ "${ARCH_FLAG}" -eq "32" ]; then
BINARY_DIR="binary-i386"
else
BINARY_DIR="binary-amd64"
fi
mkdir -p ${DIST_DIR}/${DIST}/universe/source
mkdir -p ${DIST_DIR}/${DIST}/universe/${BINARY_DIR}
mv ${REPOSITORY_DIR}/sflphone*.deb ${DIST_DIR}/${DIST}/universe/${BINARY_DIR} && \
mv ${REPOSITORY_DIR}/sflphone*.dsc ${DIST_DIR}/${DIST}/universe/source/ && \
mv ${REPOSITORY_DIR}/sflphone*.build ${DIST_DIR}/${DIST}/universe/source/ && \
mv ${REPOSITORY_DIR}/sflphone*.changes ${DIST_DIR}/${DIST}/universe/source/ && \
mv ${REPOSITORY_DIR}/sflphone*.orig.tar.gz ${DIST_DIR}/${DIST}/universe/source/ && \
mv ${REPOSITORY_DIR}/sflphone*.diff.gz ${DIST_DIR}/${DIST}/universe/source/
if [ "$?" -ne "0" ]; then
echo "!! Cannot copy dist files"
exit -1
fi
echo "All done"
# close file descriptor
exec 3>&-
exit 0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment