summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xBuildTools/InstallSwiftDependencies.sh3
-rwxr-xr-xQA/CrossDistributionTest/VagrantCrossDistributionTest.py7
-rw-r--r--QA/CrossDistributionTest/playbook.yml4
-rw-r--r--Swiften/Network/MiniUPnPInterface.cpp2
4 files changed, 13 insertions, 3 deletions
diff --git a/BuildTools/InstallSwiftDependencies.sh b/BuildTools/InstallSwiftDependencies.sh
index 0522bbe..f957e3d 100755
--- a/BuildTools/InstallSwiftDependencies.sh
+++ b/BuildTools/InstallSwiftDependencies.sh
@@ -1,33 +1,36 @@
#!/usr/bin/env bash
# This script installs the external dependencies to build Swift with Qt5.
SYSTEM_NAME=$(uname)
if [ "$SYSTEM_NAME" == "Linux" ]
then
# handle linux distributions
SYSTEM_DISTRO=$(lsb_release -i -s)
if [ "$SYSTEM_DISTRO" == "Debian" ]
then
sudo apt-get install build-essential pkg-config libssl-dev qt5-default libqt5x11extras5-dev libqt5webkit5-dev qtmultimedia5-dev qttools5-dev-tools qt5-image-formats-plugins libqt5svg5-dev libminiupnpc-dev libnatpmp-dev libhunspell-dev
elif [ "$SYSTEM_DISTRO" == "Ubuntu" ]
then
sudo apt-get install build-essential pkg-config libssl-dev qt5-default libqt5x11extras5-dev libqt5webkit5-dev qtmultimedia5-dev qttools5-dev-tools qt5-image-formats-plugins libqt5svg5-dev libminiupnpc-dev libnatpmp-dev libhunspell-dev
elif [ "$SYSTEM_DISTRO" == "Arch" ]
then
sudo pacman -S qt5-base qt5-x11extras qt5-webkit qt5-multimedia qt5-tools qt5-svg hunspell
elif [ "$SYSTEM_DISTRO" == "openSUSE project" ] || [ "$SYSTEM_DISTRO" == "SUSE LINUX" ]
then
sudo zypper "$@" in --type pattern devel_basis
sudo zypper "$@" in pkg-config libopenssl-devel libQt5Core-devel libQt5WebKit5-devel libQt5WebKitWidgets-devel libqt5-qtmultimedia-devel libqt5-qtx11extras-devel libqt5-qttools-devel libQt5Gui-devel libQt5Network-devel libQt5DBus-devel libQt5Svg-devel libQt5Svg5 python-xml hunspell-devel
elif [ "$SYSTEM_DISTRO" == "Fedora" ]
then
sudo dnf groups install "C Development Tools and Libraries"
sudo dnf install openssl-devel qt5-qtbase-devel qt5-linguist qt5-qtwebkit-devel qt5-qtmultimedia-devel qt5-qtx11extras-devel qt5-qtsvg-devel hunspell-devel
+ elif [ "$SYSTEM_DISTRO" == "Sabayon" ]
+ then
+ sudo -E equo install sys-devel/autoconf sys-devel/automake sys-devel/gcc sys-devel/g++ virtual/os-headers virtual/pkgconfig sys-libs/glibc dev-qt/linguist-tools dev-qt/qtcore dev-qt/qtmultimedia dev-qt/qtdbus dev-qt/qtgui dev-qt/qtimageformats dev-qt/qtsvg dev-qt/qtwebkit dev-qt/qtwidgets dev-qt/qtx11extras dev-libs/openssl net-libs/miniupnpc net-libs/libnatpmp app-text/hunspell
else
echo "Unsupported Linux distribution."
fi
else
echo "Unsupported system."
fi
diff --git a/QA/CrossDistributionTest/VagrantCrossDistributionTest.py b/QA/CrossDistributionTest/VagrantCrossDistributionTest.py
index ed0639c..3530fe5 100755
--- a/QA/CrossDistributionTest/VagrantCrossDistributionTest.py
+++ b/QA/CrossDistributionTest/VagrantCrossDistributionTest.py
@@ -1,82 +1,87 @@
#!/usr/bin/env python
# Required Python libraries:
#
# pip install python-vagrant tqdm
#
# Purpose of this script:
#
# This script tests
# a) InstallSwiftDependencies.sh installs all required packages for Swift and Swiften on system and
# b) all Swift projects build successfully on the system and their tests pass.
from tqdm import tqdm
from time import sleep
import sys
import vagrant
testSystems = [
"bento/ubuntu-16.04",
"bento/ubuntu-15.04",
"bento/debian-8.5",
"bento/opensuse-leap-42.1",
"bento/fedora-24",
+ "Sabayon/spinbase-amd64"
]
progressBar = tqdm(testSystems)
successfulSystems = []
failedSystems = []
for testSystem in progressBar :
v = vagrant.Vagrant(quiet_stdout=False)
try :
progressBar.set_description("create Vagrantfile for %s" % testSystem)
with open('Vagrantfile', 'w') as vagrantfile :
vagrantfile.write("""
Vagrant.configure("2") do |config|
config.vm.box = "%s"
config.ssh.insert_key = false
config.vm.provider "virtualbox" do |v|
- v.memory = 3072
+ v.memory = 4096
v.cpus = 2
end
# This is needed because Fedora only comes with Python 3 and Ansible needs Python 2
# on the target system for some features.
if config.vm.box.include? "fedora"
config.vm.provision "shell", inline: "sudo dnf install -y python2 python2-dnf libselinux-python"
end
+ if config.vm.box.include? "Sabayon"
+ config.vm.provision "shell", inline: "sudo equo update && sudo env ACCEPT_LICENSE=* equo install dev-vcs/git sys-apps/lsb-release"
+ end
+
config.vm.synced_folder "../..", "/home/vagrant/swift-host", type: "rsync"
config.vm.synced_folder ".", "/vagrant", type: "rsync"
config.vm.provision "ansible" do |ansible|
#ansible.verbose = "vvv"
ansible.playbook = "playbook.yml"
end
end""" % testSystem)
progressBar.set_description("vagrant up")
v.up(testSystem, provision=True )
progressBar.set_description("start building swift on %s" % testSystem)
# unset QTDIR is needed, because Fedora 24 sets QTDIR to Qt 3, even though Qt 5 is installed.
# SCons will pick up the Qt installation from QTDIR if QTDIR is set.
v._call_vagrant_command(["ssh", "-c", "cd /home/vagrant/swift && unset QTDIR && ./scons test=unit -j 2"])
progressBar.set_description("vagrant destory %s" % testSystem)
v.destroy()
successfulSystems.append(testSystem)
except :
e = sys.exc_info()[0]
print("Exception: %s" % e)
progressBar.set_description("vagrant destory %s" % testSystem)
v.destroy()
failedSystems.append(testSystem)
for system in successfulSystems:
print("SUCCESS: %s" % system)
for system in failedSystems:
diff --git a/QA/CrossDistributionTest/playbook.yml b/QA/CrossDistributionTest/playbook.yml
index bad4d30..aa4b8f5 100644
--- a/QA/CrossDistributionTest/playbook.yml
+++ b/QA/CrossDistributionTest/playbook.yml
@@ -1,31 +1,33 @@
- hosts: all
tasks:
- name: Install required packages via apt
apt: name=git state=latest update_cache=yes
become: true
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install required packages via dnf
dnf: name={{item}} state=latest
with_items:
- git
- redhat-lsb
become: true
when: ansible_distribution == 'CentOS' or ansible_distribution == 'Red Hat Enterprise Linux' or ansible_distribution == 'RedHat' or ansible_distribution == 'Fedora'
- name: 'Install required packages via zypper'
zypper: name={{item}} state=latest
with_items:
- git-core
- lsb-release
become: true
when: ansible_distribution == 'openSUSE Leap'
- name: Clone git from host working directory
git: repo=/home/vagrant/swift-host dest=/home/vagrant/swift
- - name: 'Install Swift dependencies'
+ - name: 'Install Swift dependencies for openSUSE Leap'
shell: ./BuildTools/InstallSwiftDependencies.sh --non-interactive chdir=/home/vagrant/swift
become: true
when: ansible_distribution == 'openSUSE Leap'
- name: 'Install Swift dependencies'
+ environment:
+ ACCEPT_LICENSE: '*'
shell: yes | ./BuildTools/InstallSwiftDependencies.sh chdir=/home/vagrant/swift
become: true
when: ansible_distribution != 'openSUSE Leap'
diff --git a/Swiften/Network/MiniUPnPInterface.cpp b/Swiften/Network/MiniUPnPInterface.cpp
index 9006ceb..d63b69e 100644
--- a/Swiften/Network/MiniUPnPInterface.cpp
+++ b/Swiften/Network/MiniUPnPInterface.cpp
@@ -8,61 +8,61 @@
* Copyright (c) 2015-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swiften/Network/MiniUPnPInterface.h>
#include <memory>
#include <boost/lexical_cast.hpp>
#include <miniupnpc.h>
#include <upnpcommands.h>
#include <upnperrors.h>
#include <Swiften/Base/Log.h>
namespace Swift {
struct MiniUPnPInterface::Private {
bool isValid;
std::string localAddress;
UPNPDev* deviceList;
UPNPUrls urls;
IGDdatas data;
};
MiniUPnPInterface::MiniUPnPInterface() : p(new Private()) {
p->isValid = false;
int error = 0;
-#if MINIUPNPC_API_VERSION > 14
+#if MINIUPNPC_API_VERSION > 13
p->deviceList = upnpDiscover(1500 /* timeout in ms */, nullptr, nullptr, 0, 0 /* do IPv6? */, 2 /* default TTL */, &error);
#else
p->deviceList = upnpDiscover(1500 /* timeout in ms */, nullptr, nullptr, 0, 0 /* do IPv6? */, &error);
#endif
if (!p->deviceList) {
return;
}
char lanAddress[64];
if (!UPNP_GetValidIGD(p->deviceList, &p->urls, &p->data, lanAddress, sizeof(lanAddress))) {
return;
}
p->localAddress = std::string(lanAddress);
p->isValid = true;
}
MiniUPnPInterface::~MiniUPnPInterface() {
if (p->isValid) {
FreeUPNPUrls(&p->urls);
}
freeUPNPDevlist(p->deviceList);
}
boost::optional<HostAddress> MiniUPnPInterface::getPublicIP() {
if (!p->isValid) {
return boost::optional<HostAddress>();
}
char externalIPAddress[40];
int ret = UPNP_GetExternalIPAddress(p->urls.controlURL, p->data.first.servicetype, externalIPAddress);
if (ret != UPNPCOMMAND_SUCCESS) {