Project 'savoirfairelinux/ring-daemon' was moved to 'savoirfairelinux/jami-daemon'. Please update any links and bookmarks that may still have the old path.
Select Git revision
-
Guillaume Roguez authored
Following patch was not reviewed (bussiness pressure): 1dccd81b [multi-device: initial implementation] This patch repays it partially by fixing Call::addSubCall() and Call::merge() (and overloading) methods. Many weird and hard-to-debug errors are fixed, as example: when a device call is in ICE connection step and fails due to OpenDHT error, the device call is terminated but not the master call and client is not aware of the situation. It's a complex patch due to the interlacements of some changes. Consider it as a new implementation of multi-device inside Call/IM components. This is a lists of changes made: - add more documentation to indicate the intent. - use reference (&) rather than const shared_ptr<>& type as it's identical, if we know that we'll not keep a reference (like in merge). - add Call::getPtr() and SIPCall::getPtr() helper functions to simplify code when we need smart pointer on such objects. This also permits to make SIPCall::merge() private and more safe-to-bad-usage. This also removes the RTTI usage due to a dynamic cast and reduce API. - fix std::set() to use correct Compare method when type is a smart ptr. - use parent (Call&) rather than the "quiet" member, not always used as its name indicates and can reduce the code. - remove TRYING state set in addSubcall() as this call is already in this state. - lock callMutex at right places to ensure multi-thread safety. - replace "fat-lambda" by member method (lambda is an unnamed function, it's hard to debug in gdb, so keep it thin and simple to make sure we don't need to debug that). - better pending IM handling. - use "override" when we override a virtual method. - return immediately when instance maybe deleted as we relaxed smrt_ptr. - fix the incorrect state of the parent call when subcall is over. - do not send handle IM when subcall is being answered (it's the job of the parent call). - log pollution: replace RING_WARN by RING_DBG when we don't want to warn - remove/re-write log output to have consistency, useful and non-redundant information. - code cleanup, coding rules, logic blocks spacing, etc. Change-Id: I8da9747db6ca01d6a50dcde2378ecf8499cf6685 Reviewed-by:
Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Reviewed-by:
Aline Bonnet <aline.bonnet@savoirfairelinux.com>
Guillaume Roguez authoredFollowing patch was not reviewed (bussiness pressure): 1dccd81b [multi-device: initial implementation] This patch repays it partially by fixing Call::addSubCall() and Call::merge() (and overloading) methods. Many weird and hard-to-debug errors are fixed, as example: when a device call is in ICE connection step and fails due to OpenDHT error, the device call is terminated but not the master call and client is not aware of the situation. It's a complex patch due to the interlacements of some changes. Consider it as a new implementation of multi-device inside Call/IM components. This is a lists of changes made: - add more documentation to indicate the intent. - use reference (&) rather than const shared_ptr<>& type as it's identical, if we know that we'll not keep a reference (like in merge). - add Call::getPtr() and SIPCall::getPtr() helper functions to simplify code when we need smart pointer on such objects. This also permits to make SIPCall::merge() private and more safe-to-bad-usage. This also removes the RTTI usage due to a dynamic cast and reduce API. - fix std::set() to use correct Compare method when type is a smart ptr. - use parent (Call&) rather than the "quiet" member, not always used as its name indicates and can reduce the code. - remove TRYING state set in addSubcall() as this call is already in this state. - lock callMutex at right places to ensure multi-thread safety. - replace "fat-lambda" by member method (lambda is an unnamed function, it's hard to debug in gdb, so keep it thin and simple to make sure we don't need to debug that). - better pending IM handling. - use "override" when we override a virtual method. - return immediately when instance maybe deleted as we relaxed smrt_ptr. - fix the incorrect state of the parent call when subcall is over. - do not send handle IM when subcall is being answered (it's the job of the parent call). - log pollution: replace RING_WARN by RING_DBG when we don't want to warn - remove/re-write log output to have consistency, useful and non-redundant information. - code cleanup, coding rules, logic blocks spacing, etc. Change-Id: I8da9747db6ca01d6a50dcde2378ecf8499cf6685 Reviewed-by:
Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Reviewed-by:
Aline Bonnet <aline.bonnet@savoirfairelinux.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
deploy-packages.sh 7.73 KiB
#!/bin/bash
#
# Copyright (C) 2016-2017 Savoir-faire Linux Inc.
#
# Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
# Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#
# This script sings and deploys pacakges from packages/distro.
# It should be ran from the project root directory.
#
# Exit immediately if a command exits with a non-zero status
set -e
###############################
## Debian / Ubuntu packaging ##
###############################
function package_deb()
{
##################################################
## Create local repository for the given distro ##
##################################################
echo "#########################"
echo "## Creating repository ##"
echo "#########################"
DISTRIBUTION_REPOSITOIRY_FOLDER=$(realpath repositories)/${DISTRIBUTION}
rm -rf ${DISTRIBUTION_REPOSITOIRY_FOLDER}
mkdir -p ${DISTRIBUTION_REPOSITOIRY_FOLDER}/conf
# Distributions file
cat << EOF > ${DISTRIBUTION_REPOSITOIRY_FOLDER}/conf/distributions
Origin: ring
Label: Ring ${DISTRIBUTION} Repository
Codename: ring
Architectures: i386 amd64
Components: main
Description: This repository contains Ring ${DISTRIBUTION} packages
SignWith: ${KEYID}
EOF
# Options file
cat << EOF > ${DISTRIBUTION_REPOSITOIRY_FOLDER}/conf/options
basedir ${DISTRIBUTION_REPOSITOIRY_FOLDER}
EOF
####################################
## Add packages to the repository ##
####################################
for package in packages/${DISTRIBUTION}*/*.deb; do
# Sign the deb
echo "## signing: ${package} ##"
dpkg-sig -k ${KEYID} --sign builder ${package}
# Include the deb
echo "## including ${package} ##"
package_name=$(dpkg -I ${package} | grep -m 1 Package: | awk '{print $2}')
package_arch=$(dpkg -I ${package} | grep -m 1 Architecture: | awk '{print $2}')
if [ ${package_arch} = "all" ]; then
# Removing to avoid the error of adding the same deb twice.
# This happens with arch all packages, which are generated in amd64 and i386.
reprepro --verbose --basedir ${DISTRIBUTION_REPOSITOIRY_FOLDER} remove ring ${package_name}
fi
reprepro --verbose --basedir ${DISTRIBUTION_REPOSITOIRY_FOLDER} includedeb ring ${package}
done
# Rebuild the index
reprepro --verbose --basedir ${DISTRIBUTION_REPOSITOIRY_FOLDER} export ring
# Show the contents
reprepro --verbose --basedir ${DISTRIBUTION_REPOSITOIRY_FOLDER} list ring
#######################################
## create the manual download folder ##
#######################################
DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER=$(realpath manual-download)/${DISTRIBUTION}
mkdir -p ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}
for package in packages/${DISTRIBUTION}*/*.deb; do
cp ${package} ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}
package_name=$(dpkg -I ${package} | grep -m 1 Package: | awk '{print $2}')
package_arch=$(dpkg -I ${package} | grep -m 1 Architecture: | awk '{print $2}')
cp ${package} ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}/${package_name}_${package_arch}.deb
done
}
######################
## Fedora packaging ##
######################
function package_rpm()
{
##################################################
## Create local repository for the given distro ##
##################################################
echo "#########################"
echo "## Creating repository ##"
echo "#########################"
DISTRIBUTION_REPOSITOIRY_FOLDER=$(realpath repositories)/${DISTRIBUTION}
rm -rf ${DISTRIBUTION_REPOSITOIRY_FOLDER}
mkdir -p ${DISTRIBUTION_REPOSITOIRY_FOLDER}
# .repo file
cat << EOF > ${DISTRIBUTION_REPOSITOIRY_FOLDER}/ring-nightly.repo
[ring]
name=Ring \$releasever - \$basearch - ring
baseurl=https://dl.ring.cx/ring-nightly/fedora_\$releasever
gpgcheck=1
gpgkey=https://dl.ring.cx/ring.pub.key
enabled=1
EOF
####################################
## Add packages to the repository ##
####################################
# Sign the rpms
echo "##################"
echo "## signing rpms ##"
echo "##################"
# RPM macros
if [ ! -f ~/.rpmmacros ];
then
echo "%_signature gpg" > ~/.rpmmacros
echo "%_gpg_name ${KEYID}" >> ~/.rpmmacros
fi
for package in packages/${DISTRIBUTION}*/*.rpm; do
rpmsign --resign --key-id=${KEYID} ${package}
cp ${package} ${DISTRIBUTION_REPOSITOIRY_FOLDER}
done
# Create the repo
createrepo --update ${DISTRIBUTION_REPOSITOIRY_FOLDER}
#######################################
## create the manual download folder ##
#######################################
DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER=$(realpath manual-download)/${DISTRIBUTION}
mkdir -p ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}
for package in packages/${DISTRIBUTION}*/*.rpm; do
cp ${package} ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}
package_name=$(rpm -qp --queryformat '%{NAME}' ${package})
package_arch=$(rpm -qp --queryformat '%{ARCH}' ${package})
cp ${package} ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER}/${package_name}_${package_arch}.rpm
done
}
################################################
## Deploy packages on given remote repository ##
################################################
function deploy()
{
if [ -f "${SSH_IDENTIY_FILE}" ];
then
RSYNC_RSH="ssh -i ${SSH_IDENTIY_FILE}"
fi
# Deploy the repository
echo "##########################"
echo "## deploying repository ##"
echo "##########################"
echo "Using RSYNC_RSH='${RSYNC_RSH}'"
rsync --archive --recursive --verbose --delete ${DISTRIBUTION_REPOSITOIRY_FOLDER} ${REMOTE_REPOSITORY_LOCATION}
# deploy the manual download files
echo "#####################################"
echo "## deploying manual download files ##"
echo "#####################################"
rsync --archive --recursive --verbose --delete ${DISTRIBUTION_MANUAL_DOWNLOAD_FOLDER} ${REMOTE_MANUAL_DOWNLOAD_LOCATION}
# remove deployed files
rm -rf manual-download
rm -rf repositories
}
##########################################################
## Detect suitable packaging based on distribution name ##
##########################################################
function package()
{
if [[ "${DISTRIBUTION:0:6}" == "debian" || "${DISTRIBUTION:0:6}" == "ubuntu" ]];
then
package_deb
elif [[ "${DISTRIBUTION:0:6}" == "fedora" ]];
then
package_rpm
else
echo "ERROR: Distribution '${DISTRIBUTION}' is unsupported"
fi
}
for i in "$@"
do
case $i in
--distribution=*)
DISTRIBUTION="${i#*=}"
shift
;;
--keyid=*)
KEYID="${i#*=}"
shift
;;
--remote-repository-location=*)
REMOTE_REPOSITORY_LOCATION="${i#*=}"
shift
;;
--remote-manual-download-location=*)
REMOTE_MANUAL_DOWNLOAD_LOCATION="${i#*=}"
shift
;;
--remote-ssh-identity-file=*)
SSH_IDENTIY_FILE="${i#*=}"
shift
;;
*)
echo "Unrecognized option ${i}"
exit 1
;;
esac
done
package
deploy