diff --git a/src/Makefile.am b/src/Makefile.am index d762b02c8ad2404df860c7d660f0b46974eb0cf3..ff6fd42780a356f7ccf1616738ea7bf360a953fe 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -111,11 +111,6 @@ libring_la_SOURCES = \ utf8_utils.cpp \ ice_transport.cpp \ ice_transport.h \ - plugin_manager.cpp \ - plugin_loader_dl.cpp \ - ring_plugin.h \ - plugin_loader.h \ - plugin_manager.h \ threadloop.h \ thread_pool.h \ conference.h \ diff --git a/src/manager.cpp b/src/manager.cpp index 1f76b02bad75a23ba85587098a0ccabe2c1020b4..a8a1eb4567d552349abd033b15819b1075d4c025 100644 --- a/src/manager.cpp +++ b/src/manager.cpp @@ -34,7 +34,6 @@ #include "logger.h" #include "account_schema.h" -#include "plugin_manager.h" #include "thread_pool.h" #include "fileutils.h" @@ -349,8 +348,6 @@ struct Manager::ManagerPimpl */ std::unique_ptr<RingBufferPool> ringbufferpool_; - std::unique_ptr<PluginManager> pluginManager_; - std::map<uintptr_t, Manager::EventHandler> eventHandlerMap_; decltype(eventHandlerMap_)::iterator nextEventHandler_; @@ -388,7 +385,6 @@ Manager::ManagerPimpl::ManagerPimpl(Manager& base) , waitingCallsMutex_() , path_() , ringbufferpool_(new RingBufferPool) - , pluginManager_(new PluginManager) , conferenceMap_() , ice_tf_() #ifdef RING_VIDEO diff --git a/src/plugin_loader.h b/src/plugin_loader.h deleted file mode 100644 index c0419439a54fe1938e6d153ae4892aeec41724d5..0000000000000000000000000000000000000000 --- a/src/plugin_loader.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2004-2018 Savoir-faire Linux Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ -#ifndef PLUGIN_LOADER_H -#define PLUGIN_LOADER_H - -#include "ring_plugin.h" - -#include <string> - -namespace ring { - -class Plugin -{ - public: - virtual ~Plugin() = default; - - static Plugin* load(const std::string& path, std::string& error); - - virtual void* getSymbol(const char* name) const = 0; - virtual RING_PluginInitFunc getInitFunction() const { - return reinterpret_cast<RING_PluginInitFunc>(getSymbol(RING_DYN_INIT_FUNC_NAME)); - }; - - protected: - Plugin() = default; -}; - -} // namespace ring - -#endif /* PLUGIN_LOADER_H */ diff --git a/src/plugin_loader_dl.cpp b/src/plugin_loader_dl.cpp deleted file mode 100644 index ccd17a1062de12d6fe943d3267d1d2f3d2c4fa69..0000000000000000000000000000000000000000 --- a/src/plugin_loader_dl.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2004-2018 Savoir-faire Linux Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "plugin_loader.h" - -#include <dlfcn.h> -#include <memory> - -namespace ring { - -class DLPlugin : public Plugin -{ - public: - DLPlugin(void* handle) : handle_(handle, ::dlclose) {}; - void* getSymbol(const char* name) const; - - private: - std::unique_ptr<void, int(*)(void*)> handle_; -}; - -void* -DLPlugin::getSymbol(const char* name) const -{ - if (!handle_) - return nullptr; - - return ::dlsym(handle_.get(), name); -} - -Plugin* -Plugin::load(const std::string& path, std::string& error) -{ - if (path.empty()) { - error = "Empty path"; - return nullptr; - } - - // Clear any existing error - ::dlerror(); - - void* handle = ::dlopen(path.c_str(), RTLD_NOW); - if (!handle) { - error += "Failed to load \"" + path + '"'; - - std::string dlError = ::dlerror(); - if(dlError.size()) - error += " (" + dlError + ")"; - return nullptr; - } - - return new DLPlugin(handle); -} - -} // namespace ring diff --git a/src/plugin_manager.cpp b/src/plugin_manager.cpp deleted file mode 100644 index 91602bd8e765826e335a69e2821376331e77d99d..0000000000000000000000000000000000000000 --- a/src/plugin_manager.cpp +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2004-2018 Savoir-faire Linux Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include "plugin_manager.h" -#include "plugin_loader.h" -#include "logger.h" - -#include <utility> - -namespace ring { - -PluginManager::PluginManager() -{ - pluginApi_.context = reinterpret_cast<void*>(this); -} - -PluginManager::~PluginManager() -{ - for (auto func : exitFuncVec_) { - try { - (*func)(); - } catch (...) { - RING_WARN("Exception caught during plugin exit"); - } - } - - dynPluginMap_.clear(); - exactMatchMap_.clear(); - wildCardVec_.clear(); - exitFuncVec_.clear(); -} - -bool -PluginManager::load(const std::string& path) -{ - // TODO: Resolve symbolic links and make path absolute - - // Don't load the same dynamic library twice - if (dynPluginMap_.find(path) != dynPluginMap_.end()) { - RING_WARN("plugin: already loaded"); - return true; - } - - std::string error; - std::unique_ptr<Plugin> plugin(Plugin::load(path, error)); - if (!plugin) { - RING_ERR("plugin: %s", error.c_str()); - return false; - } - - const auto& init_func = plugin->getInitFunction(); - if (!init_func) { - RING_ERR("plugin: no init symbol"); - return false; - } - - if (!registerPlugin(init_func)) - return false; - - dynPluginMap_[path] = std::move(plugin); - return true; -} - -bool -PluginManager::registerPlugin(RING_PluginInitFunc initFunc) -{ - RING_PluginExitFunc exitFunc = nullptr; - - try { - exitFunc = initFunc(&pluginApi_); - } catch (const std::runtime_error& e) { - RING_ERR("%s", e.what()); - } - - if (!exitFunc) { - tempExactMatchMap_.clear(); - tempWildCardVec_.clear(); - RING_ERR("plugin: init failed"); - return false; - } - - exitFuncVec_.push_back(exitFunc); - exactMatchMap_.insert(tempExactMatchMap_.begin(), - tempExactMatchMap_.end()); - wildCardVec_.insert(wildCardVec_.end(), - tempWildCardVec_.begin(), - tempWildCardVec_.end()); - return true; -} - -bool -PluginManager::registerService(const std::string& name, - ServiceFunction&& func) -{ - services_[name] = std::forward<ServiceFunction>(func); - return true; -} - -void -PluginManager::unRegisterService(const std::string& name) -{ - services_.erase(name); -} - -int32_t -PluginManager::invokeService(const std::string& name, void* data) -{ - const auto& iterFunc = services_.find(name); - if (iterFunc == services_.cend()) { - RING_ERR("Services not found: %s", name.c_str()); - return -1; - } - - const auto& func = iterFunc->second; - - try { - return func(data); - } catch (const std::runtime_error &e) { - RING_ERR("%s", e.what()); - return -1; - } -} - -/* WARNING: exposed to plugins through RING_PluginAPI */ -bool -PluginManager::registerObjectFactory(const char* type, - const RING_PluginObjectFactory& factoryData) -{ - if (!type) - return false; - - if (!factoryData.create || !factoryData.destroy) - return false; - - // Strict compatibility on ABI - if (factoryData.version.abi != pluginApi_.version.abi) - return false; - - // Backward compatibility on API - if (factoryData.version.api < pluginApi_.version.api) - return false; - - const std::string key(type); - auto deleter = [factoryData](void* o) { - factoryData.destroy(o, factoryData.closure); - }; - ObjectFactory factory = {factoryData, deleter}; - - // wildcard registration? - if (key == "*") { - wildCardVec_.push_back(factory); - return true; - } - - // fails on duplicate for exactMatch map - if (exactMatchMap_.find(key) != exactMatchMap_.end()) - return false; - - exactMatchMap_[key] = factory; - return true; -} - -std::unique_ptr<void, PluginManager::ObjectDeleter> -PluginManager::createObject(const std::string& type) -{ - if (type == "*") - return {nullptr, nullptr}; - - RING_PluginObjectParams op = { - /*.pluginApi = */&pluginApi_, - /*.type = */type.c_str(), - }; - - // Try to find an exact match - const auto& factoryIter = exactMatchMap_.find(type); - if (factoryIter != exactMatchMap_.end()) { - const auto& factory = factoryIter->second; - auto object = factory.data.create(&op, factory.data.closure); - if (object) - return {object, factory.deleter}; - } - - // Try to find a wildcard match - for (const auto& factory : wildCardVec_) - { - auto object = factory.data.create(&op, factory.data.closure); - if (object) { - // promote registration to exactMatch_ - // (but keep also wildcard registration for other object types) - int32_t res = registerObjectFactory(op.type, factory.data); - if (res < 0) { - RING_ERR("failed to register object %s", op.type); - return {nullptr, nullptr}; - } - - return {object, factory.deleter}; - } - } - - return {nullptr, nullptr}; -} - -/* WARNING: exposed to plugins through RING_PluginAPI */ -int32_t -PluginManager::registerObjectFactory_(const RING_PluginAPI* api, - const char* type, void* data) -{ - auto manager = reinterpret_cast<PluginManager*>(api->context); - if (!manager) { - RING_ERR("registerObjectFactory called with null plugin API"); - return -1; - } - - if (!data) { - RING_ERR("registerObjectFactory called with null factory data"); - return -1; - } - - const auto factory = reinterpret_cast<RING_PluginObjectFactory*>(data); - return manager->registerObjectFactory(type, *factory) ? 0 : -1; -} - -/* WARNING: exposed to plugins through RING_PluginAPI */ -int32_t -PluginManager::invokeService_(const RING_PluginAPI* api, const char* name, - void* data) -{ - auto manager = reinterpret_cast<PluginManager*>(api->context); - if (!manager) { - RING_ERR("invokeService called with null plugin API"); - return -1; - } - - return manager->invokeService(name, data); -} - -} // namespace ring diff --git a/src/plugin_manager.h b/src/plugin_manager.h deleted file mode 100644 index c066ba67a70a0c9753f75d9a9667194ca7db5b8c..0000000000000000000000000000000000000000 --- a/src/plugin_manager.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2004-2018 Savoir-faire Linux Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef PLUGIN_MANAGER_H -#define PLUGIN_MANAGER_H - -#include "ring_plugin.h" -#include "noncopyable.h" - -#include <map> -#include <vector> -#include <memory> -#include <mutex> -#include <functional> -#include <string> - -#include <inttypes.h> - -namespace ring { - -class Plugin; - -class PluginManager -{ - public: - using ObjectDeleter = std::function<void(void*)>; - using ServiceFunction = std::function<int32_t(void*)>; - - private: - struct ObjectFactory { - RING_PluginObjectFactory data; - ObjectDeleter deleter; - }; - - using PluginMap = std::map<std::string, std::shared_ptr<Plugin>>; - using ExitFuncVec = std::vector<RING_PluginExitFunc>; - using ObjectFactoryVec = std::vector<ObjectFactory>; - using ObjectFactoryMap = std::map<std::string, ObjectFactory>; - - public: - PluginManager(); - ~PluginManager(); - - /** - * Load a dynamic plugin by filename. - * - * @param path fully qualified pathname on a loadable plugin binary - * @return true if success - */ - bool load(const std::string& path); - - /** - * Register a plugin. - * - * @param initFunc plugin init function - * @return true if success - */ - bool registerPlugin(RING_PluginInitFunc initFunc); - - /** - * Register a new service for plugin. - * - * @param name The service name - * @param func The function called by Ring_PluginAPI.invokeService - * @return true if success - */ - bool registerService(const std::string& name, ServiceFunction&& func); - - void unRegisterService(const std::string& name); - - /** - * Register a new public objects factory. - * - * @param type unique identifier of the object - * @param params object factory details - * @return true if success - * - * Note: type can be the string "*" meaning that the factory - * will be called if no exact match factories are found for a given type. - */ - bool registerObjectFactory(const char* type, - const RING_PluginObjectFactory& factory); - - /** - * Create a new plugin's exported object. - * - * @param type unique identifier of the object to create. - * @return unique pointer on created object. - */ - std::unique_ptr<void, ObjectDeleter> createObject(const std::string& type); - - const RING_PluginAPI& getPluginAPI() const { - return pluginApi_; - } - - private: - NON_COPYABLE(PluginManager); - - /** - * Implements RING_PluginAPI.registerObjectFactory(). - * Must be C accessible. - */ - static int32_t registerObjectFactory_(const RING_PluginAPI* api, - const char* type, - void* data); - - /** - * Implements RING_PluginAPI.invokeService(). - * Must be C accessible. - */ - static int32_t invokeService_(const RING_PluginAPI* api, - const char* name, - void* data); - - int32_t invokeService(const std::string& name, void* data); - - std::mutex mutex_ {}; - RING_PluginAPI pluginApi_ = { - { RING_PLUGIN_ABI_VERSION, RING_PLUGIN_API_VERSION }, - nullptr, // set by PluginManager constructor - registerObjectFactory_, invokeService_, - }; - PluginMap dynPluginMap_ {}; // Only dynamic loaded plugins - ExitFuncVec exitFuncVec_ {}; - ObjectFactoryMap exactMatchMap_ {}; - ObjectFactoryVec wildCardVec_ {}; - - // Storage used during plugin initialisation. - // Will be copied into previous ones only if the initialisation success. - ObjectFactoryMap tempExactMatchMap_ {}; - ObjectFactoryVec tempWildCardVec_ {}; - - // registered services - std::map<std::string, ServiceFunction> services_ {}; -}; - -} // namespace ring - -#endif /* PLUGIN_MANAGER_H */ diff --git a/src/ring_plugin.h b/src/ring_plugin.h deleted file mode 100644 index e0283219f485f9174c2be3f38e5ae96ee4641abd..0000000000000000000000000000000000000000 --- a/src/ring_plugin.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2004-2018 Savoir-faire Linux Inc. - * - * 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, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#ifndef RING_PLUGIN_H -#define RING_PLUGIN_H - -#include <inttypes.h> - -#ifdef __cplusplus -# define EXTERNAL_C_LINKAGE extern "C" -# define C_INTERFACE_START EXTERNAL_C_LINKAGE { -# define C_INTERFACE_END } -#else -# define C_LINKAGE -# define C_INTERFACE_START -# define C_INTERFACE_END -#endif - -#define RING_PLUGIN_ABI_VERSION 1 /* 0 doesn't exist, considered as error */ -#define RING_PLUGIN_API_VERSION 1 /* 0 doesn't exist, considered as error */ - -C_INTERFACE_START; - -typedef struct RING_PluginVersion { - /* plugin is not loadable if this number differs from one - * stored in the plugin loader */ - uint32_t abi; - - /* a difference on api number may be acceptable, see the loader code */ - uint32_t api; -} RING_PluginVersion; - -struct RING_PluginAPI; - -/* RING_PluginCreateFunc parameters */ -typedef struct RING_PluginObjectParams { - const RING_PluginAPI* pluginApi; /* this API */ - const char* type; -} RING_PluginObjectParams; - -typedef void* (*RING_PluginCreateFunc)(RING_PluginObjectParams* params, void* closure); - -typedef void (*RING_PluginDestroyFunc)(void *object, void* closure); - -/* RING_PluginAPI.registerObjectFactory data */ -typedef struct RING_PluginObjectFactory { - RING_PluginVersion version; - void* closure; /* closure for create */ - RING_PluginCreateFunc create; - RING_PluginDestroyFunc destroy; -} RING_PluginObjectFactory; - -/* Plugins exposed API prototype */ -typedef int32_t (*RING_PluginFunc)(const RING_PluginAPI* api, - const char* name, - void* data); - -/* RING_PluginInitFunc parameters. - * This structure is filled by the Plugin manager. - * For backware compatibility, never c - */ -typedef struct RING_PluginAPI { - RING_PluginVersion version; /* structure version, always the first data */ - void* context; /* opaque structure used by next functions */ - - /* API usable by plugin implementors */ - RING_PluginFunc registerObjectFactory; - RING_PluginFunc invokeService; -} RING_PluginAPI; - -typedef void (*RING_PluginExitFunc)(void); - -typedef RING_PluginExitFunc (*RING_PluginInitFunc)(const RING_PluginAPI *api); - -C_INTERFACE_END; - -#define RING_DYN_INIT_FUNC_NAME "RING_dynPluginInit" -#define RING_PLUGIN_INIT_STATIC(fname, pname) RING_PLUGIN_INIT(fname, pname) -#define RING_PLUGIN_INIT_DYNAMIC(pname) RING_PLUGIN_INIT(RING_dynPluginInit, pname) - -/* Define here platform dependent way to export a declaration x to the dynamic - * loading system. - */ - -/* Default case (like POSIX/.so) */ - -#define RING_PLUGIN_INIT(fname, pname) \ - EXTERNAL_C_LINKAGE RING_PluginExitFunc fname(const RING_PluginAPI *pname) -#define RING_PLUGIN_EXIT(fname) \ - EXTERNAL_C_LINKAGE void fname(void) - -#endif /* RING_PLUGIN_H */ diff --git a/tools/git-gerrit b/tools/git-gerrit deleted file mode 100755 index 7326d264537d388a69af5fa38e9878a373e04661..0000000000000000000000000000000000000000 --- a/tools/git-gerrit +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -# -# Copyright 2014 Savoir-faire Linux Inc. -# Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> -# Licensed under the terms of the GNU GPL v3, or at your option, any later version. -# -# You can install this script as a Git subcommand with one of the 2 methods below: -# -# 1) git config alias.gerrit '!tools/git-gerrit' -# 2) or put this script in your $PATH - -usage () { - echo "Usage:" - echo " $0 <url|open|fetch> [<git-rev>]" - echo " $0 help" - echo - echo "Examples:" - echo " git gerrit open" - echo " git gerrit url HEAD~2" - echo " git gerrit fetch ; git diff FETCH_HEAD" -} - -test $# -ge 1 -a $# -le 2 || { - echo "Invalid syntax." - usage - exit 1 -} - -test "$1" = "help" && { - usage - exit -} - -GERRIT_USER=`git config gerrit.user` -GERRIT_HOST=`git config gerrit.host` -GERRIT_PORT=`git config gerrit.port` - -test -n "$GERRIT_USER" -a -n "$GERRIT_HOST" -a -n "$GERRIT_PORT" || { - echo "You must configure your Gerrit host, e.g.:" - echo - echo " git config gerrit.user vivien" - echo " git config gerrit.host gerrit-ring.savoirfairelinux.com" - echo " git config gerrit.port 29420" - echo - exit 1 -} - -alias _gerrit="ssh -p $GERRIT_PORT $GERRIT_HOST gerrit query" - -CHANGE_ID=`git show --summary --format=%b $2 | perl -n -e '/^Change-Id: (I[0-9a-f]+)$/ && print $1'` - -test -n "$CHANGE_ID" || { - echo "no Change ID!" - exit 1 -} - -test "$1" = "fetch" && { - GERRIT_REMOTE=`git config gerrit.remote` - - test -n "$GERRIT_REMOTE" || { - echo "You must specify the Git remote pointing to Gerrit, e.g.:" - echo - echo " git config gerrit.remote origin" - echo - exit 1 - } - - _gerrit --current-patch-set $CHANGE_ID | awk '/ref:/ { print $2 }' | while read ref ; do - git fetch $GERRIT_REMOTE $ref:$ref - done - exit -} - -URL=`_gerrit $CHANGE_ID | awk '/url:/ { print $2 }'` - -case $1 in - url) echo $URL ;; - open) xdg-open $URL ;; - *) echo "Oops, bad command" ; usage ; exit 1 ;; -esac - -exit diff --git a/tools/git-redmine b/tools/git-redmine deleted file mode 100755 index db1ee0b86ef8573869910e33ffbebb43c12087e5..0000000000000000000000000000000000000000 --- a/tools/git-redmine +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh -# -# Copyright 2014 Savoir-faire Linux Inc. -# Author: Vivien Didelot <vivien.didelot@savoirfairelinux.com> -# Licensed under the terms of the GNU GPL v3, or at your option, any later version. -# -# You can install this script as a Git subcommand with one of the 2 methods below: -# -# 1) git config alias.redmine '!tools/git-redmine' -# 2) or put this script in your $PATH - -usage () { - echo "Usage:" - echo " $0 <url|open> [<git-rev>]" - echo " $0 help" - echo - echo "Examples:" - echo " git redmine open # open the Redmine ticket related to the current commit" - echo " git redmine url HEAD~2" -} - -test $# -ge 1 -a $# -le 2 || { - echo "Invalid syntax." - usage - exit 1 -} - -test "$1" = "help" && { - usage - exit -} - -REDMINE_URL=`git config redmine.url` - -test -n "$REDMINE_URL" || { - echo "You must configure your Redmine URL, e.g.:" - echo - echo " git config redmine.url https://projects.savoirfairelinux.com" - echo - exit 1 -} - -ISSUE=`git show --summary --format=%b $2 | perl -n -e '/^(Refs|Issue:) #(\d+)$/ && print $2'` - -test -n "$ISSUE" || { - echo "no issue ID!" - exit 1 -} - -URL=$REDMINE_URL/issues/$ISSUE - -case $1 in - url) echo $URL ;; - open) xdg-open $URL ;; - *) echo "Oops, bad command" ; usage ; exit 1 ;; -esac - -exit diff --git a/tools/sflphone-callto b/tools/sflphone-callto deleted file mode 100755 index c652a776f06831ecd818a80bb2d1a999ae66e0c3..0000000000000000000000000000000000000000 --- a/tools/sflphone-callto +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# -# This script can be used as a callto: (or other) protocol handler in -# Mozilla Firefox-based browser. -# In Firefox use Preferences > Applications and set the callto handler -# to this script. - -# The sflphone daemon config file -RESFILE=~/.config/sflphone/sflphoned.yml - -# Parse sflphonedrc and get default account id string -if [ -f "$RESFILE" ]; then - -# Test if a SFLphone client is already open, if not open a new one -# Opening a new client will start sflphoned if not already running -SFLPHONEC=`ps -A | grep ring-client` -if [ "$SFLPHONEC" = "" ]; then - ring-client-gnome& -fi - -# FIXME: this doesn't check if account is enabled, and is unreadable/unmaintainable. -# D-Bus API should be fixed so that we can simply dial and let the daemon worry -# about which account (default account? most recently used?) should place the -# call. -# -# Use first ID -ACCOUNTID=`grep order $RESFILE | sed -e 's/order: IP2IP\///' -e 's/\/.*//' | tr -d ' '` - -else - echo Fatal: Can't find sflphoned.yml config file. - exit 1 -fi - -# Check 1st argument (phone number) -if [ -z $1 ]; then - echo "Error: argument 1 (phone number) not provided." - exit 1 -fi - -# Cleanup destination, keeping numbers only -TO="`echo $1 | sed -e 's/[^0123456789]//g'`" - -# Generate call id. -CALLID=${RANDOM}$$ - -dbus-send \ - --type="method_call" \ - --dest="org.sflphone.SFLphone" \ - "/org/sflphone/SFLphone/CallManager" \ - "org.sflphone.SFLphone.CallManager.placeCall" \ - string:"$ACCOUNTID" \ - string:"$CALLID" \ - string:"$TO" - -exit 0 - -# EOF diff --git a/tools/translations/sflphone-translation-push-template b/tools/translations/sflphone-translation-push-template deleted file mode 100755 index e2f52903dd1dfcf4f4718f954113501977ee1eae..0000000000000000000000000000000000000000 --- a/tools/translations/sflphone-translation-push-template +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -# -# Script to push up-to-date template file to Launchpad. -# -# Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - -set -x - -# This is an environment variable provided by Jenkins. It points to the repository's root -cd ${WORKSPACE} - -WORKING_DIR=${WORKSPACE}/gnome/po -BZR_DIR=${WORKING_DIR}/tmp -BZR=bzr -BZR_BRANCH="lp:sflphone" - -# Clone Bazaar branch that contains Launchpad translations -cd ${WORKING_DIR} -if [ -e $BZR_DIR ] ; then - # Remove the directory first - rm -rf $BZR_DIR -fi -$BZR branch $BZR_BRANCH $BZR_DIR - -# Update the template file with the latest strings -cd ${WORKSPACE}/gnome -./autogen.sh -./configure --prefix=/usr -cd ${WORKING_DIR} -make sflphone.pot - -# Add the new template file to the Bazaar repository -cp sflphone.pot $BZR_DIR/sflphone -cd $BZR_DIR/sflphone -$BZR commit sflphone.pot --message "[Translations] Update POT file" -$BZR push $BZR_BRANCH - -exit 0; diff --git a/tools/translations/sflphone-translation-update b/tools/translations/sflphone-translation-update deleted file mode 100755 index bcde044e2b1e245779a0cca5b0bec18c79d57b19..0000000000000000000000000000000000000000 --- a/tools/translations/sflphone-translation-update +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -# -# Script to update translations from Launchpad, create a patch and send by email -# @See git-format-patch -# @See git-send-email -# -# Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> - -set -x - -# This is an environment variable provided by Jenkins. It points to the repository's root -cd ${WORKSPACE} - -WORKING_DIR=${WORKSPACE}/gnome/po -BZR_DIR=${WORKING_DIR}/tmp -BZR=bzr -MAKE=make -BZR_BRANCH="lp:sflphone" -EMAIL_TO="sflphone-dev@lists.savoirfairelinux.net" -COMMIT_MSG="intl: automatic translations update" -PATCH="0001-intl-automatic-translations-update.patch" - -# Clone Bazaar branch that contains Launchpad translations -cd ${WORKING_DIR} -if [ -e $BZR_DIR ] ; then - # Remove the directory first - rm -rf $BZR_DIR -fi -$BZR branch $BZR_BRANCH $BZR_DIR - -# Update the po files with the latest translations -cd ${WORKSPACE}/gnome -./autogen.sh -./configure --prefix=/usr -cd ${WORKING_DIR} -cp $BZR_DIR/sflphone/*.po ${WORKING_DIR} -# Compile the po files -$MAKE - -# Build the patch -git status -if git diff-index HEAD . ; then - git add *.po - git commit -a -m "$COMMIT_MSG" - git format-patch --to $EMAIL_TO HEAD~..HEAD - # Send the patch - git send-email \ - --8bit-encoding "utf-8" \ - --from "Jenkins CI <jenkins@savoirfairelinux.com>" \ - --to "<emmanuel.milou@savoirfairelinux.com>" \ - --confirm=never \ - $PATCH -fi - -exit 0