Browse Source

Merge remote-tracking branch 'upstream/1.0' into master

Stefan Profanter 5 years ago
parent
commit
bfdb9953dd

+ 1 - 1
.travis.yml

@@ -363,7 +363,7 @@ after_failure: |
 deploy:
   provider: releases
   api_key:
-    # Uses token from user open62541-travis-release (managed by @Pro)
+    # Uses token from user open62541-travis-release (managed by @Pro). Sets GITAUTH
     secure: dtn6ayBGoWzeVMM6xYpSRZly1XOhS/2jdiwEHd0hYZIr0dNq18CxTiqbGrUwW1JsSiXoHaGSZhUVr06O1P/tfC3Ma6i7ugyun+yXz6FdZiwirjURI8HQe+XwR4Ui3hqgQSOHLMK/xtOkjM28AN1jg9u3//Zep69xJVIGAqNT0bE=
   file:
     - open62541-win32.zip

+ 2 - 2
CMakeLists.txt

@@ -986,7 +986,7 @@ else()
     target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src)
 
     add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers})
-    add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport)
+    add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace)
     target_include_directories(open62541-plugins PRIVATE ${PROJECT_SOURCE_DIR}/plugins)
     target_include_directories(open62541-plugins PRIVATE ${PROJECT_BINARY_DIR}/src_generated)
     target_compile_definitions(open62541-plugins PRIVATE -DUA_DYNAMIC_LINKING_EXPORT)
@@ -1047,7 +1047,7 @@ if (UA_ENABLE_DISCOVERY_MULTICAST)
     target_compile_definitions(open62541 PRIVATE -DMDNSD_DYNAMIC_LINKING_EXPORT)
 endif()
 # Generate properly versioned shared library links on Linux
-SET_TARGET_PROPERTIES(open62541 PROPERTIES SOVERSION 0 VERSION "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}")
+SET_TARGET_PROPERTIES(open62541 PROPERTIES SOVERSION "${OPEN62541_VER_MAJOR}" VERSION "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}")
 
 ##################################
 #     Architectures changes      #

+ 5 - 5
debian/control

@@ -12,25 +12,25 @@ Homepage: https://open62541.org/
 Vcs-Git: https://github.com/open62541/open62541.git
 Vcs-Browser: https://github.com/open62541/open62541
 
-Package: open62541-dev
+Package: libopen62541-<soname>-dev
 Section: libdevel
 Architecture: any
 Multi-Arch: same
-Depends: open62541 (= ${binary:Version}), ${misc:Depends}
+Depends: libopen62541-<soname> (= ${binary:Version}), ${misc:Depends}
 Description: Development header files for open62541
  open62541 is an open source C (C99) implementation of the OPC UA standard
 
-Package: open62541
+Package: libopen62541-<soname>
 Architecture: any
 Multi-Arch: same
 Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541
  open62541 is an open source C (C99) implementation of the OPC UA standard
 
-Package: open62541-dbg
+Package: libopen62541-<soname>-dbg
 Section: debug
 Architecture: any
 Priority: extra
-Depends: open62541 (= ${binary:Version}), ${misc:Depends}
+Depends: libopen62541-<soname> (= ${binary:Version}), ${misc:Depends}
 Description: Debugging symbols for open62541
  open62541 is an open source C (C99) implementation of the OPC UA standard

debian/open62541-dev.install → debian/libopen62541-dev.install-template


debian/open62541.install → debian/libopen62541.install-template


+ 1 - 1
debian/rules

@@ -11,7 +11,7 @@ override_dh_auto_test:
 	dh_auto_test -- ARGS+=--output-on-failure
 
 override_dh_strip:
-	dh_strip --dbg-package=open62541-dbg
+	dh_strip --dbg-package=libopen62541-<soname>-dbg
 
 %:
 	dh $@ --buildsystem=cmake --parallel

+ 0 - 48
debian/update_changelog.py

@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import subprocess
-import os
-import re
-from email.utils import formatdate
-
-git_describe_version = subprocess.check_output(["git", "describe", "--tags", "--dirty", "--match", "v*"]).decode('utf-8').strip()
-
-# v1.2
-# v1.2.3
-# v1.2.3-rc1
-# v1.2.3-rc1-dirty
-# v1.2.3-5-g4538abcd
-# v1.2.3-5-g4538abcd-dirty
-# git_describe_version = "v1.2.3"
-
-m = re.match(r"^v([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-(.*)+)?$", git_describe_version)
-version_major = m.group(1) if m.group(1) is not None else "0"
-version_minor = m.group(2).replace(".", "") if m.group(2) is not None else "0"
-version_patch = m.group(3).replace(".", "") if m.group(3) is not None else "0"
-version_label = m.group(4) if m.group(4) is not None else ""
-#print("major {} minor {} patch {} label {}".format(version_major, version_minor, version_patch, version_label))
-
-debian_distribution = "unstable"
-if version_label is not "":
-    debian_distribution = "UNRELEASED"
-
-dirpath = os.path.dirname(os.path.realpath(__file__))
-changelog_file = os.path.join(dirpath, "changelog")
-
-# remove leading 'v'
-changelog_version = git_describe_version[1:] if git_describe_version[0] == 'v' else git_describe_version
-
-with open(changelog_file, 'r') as original: data = original.read()
-with open(changelog_file, 'w') as modified:
-    new_entry = """open62541 ({version}) {distribution}; urgency=medium
-
-  * Full changelog is available here: https://github.com/open62541/open62541/blob/master/CHANGELOG
-
- -- open62541 Team <open62541-core@googlegroups.com>  {time}
-""".format(version=changelog_version, time=formatdate(), distribution = debian_distribution)
-
-    modified.write(new_entry + "\n" + data)

+ 5 - 0
doc/building.rst

@@ -3,6 +3,11 @@
 Building open62541
 ==================
 
+open62541 uses CMake to build the library and binaries. The library version is automatically
+detected using ``git describe``. This command returns a valid version string based on the current tag.
+If you did not directly clone the sources, but use the tar or zip package from a release, you need
+to manually specify the version. In that case use e.g. ``cmake -DOPEN62541_VERSION=v1.0.3``.
+
 Building the Examples
 ---------------------
 

+ 9 - 0
doc/installing.rst

@@ -78,3 +78,12 @@ Debian packages can be found in our official PPA:
 
  * Daily Builds (based on master branch): https://launchpad.net/~open62541-team/+archive/ubuntu/daily
  * Release Builds (starting with Version 0.4): https://launchpad.net/~open62541-team/+archive/ubuntu/ppa
+
+Install them with:
+
+
+.. code-block:: bash
+
+    sudo add-apt-repository ppa:open62541-team/ppa
+    sudo apt-get update
+    sudo apt-get install libopen62541-dev

+ 5 - 4
include/open62541/server.h

@@ -547,8 +547,8 @@ UA_Server_unregister_discovery(UA_Server *server, struct UA_Client *client);
   * @param client the client which is used to call the RegisterServer.
   *         It must not yet be connected and will be connected for every register call
   *         to the given discoveryServerUrl.
-  * @param discoveryServerUrl if set to NULL, the default value
-  *        'opc.tcp://localhost:4840' will be used
+  * @param discoveryServerUrl where this server should register itself.
+  *        The string will be copied internally. Therefore you can free it after calling this method.
   * @param intervalMs
   * @param delayFirstRegisterMs
   * @param periodicCallbackId */
@@ -564,8 +564,9 @@ typedef void (*UA_Server_registerServerCallback)(const UA_RegisteredServer *regi
                                                  void* data);
 
 /* Set the callback which is called if another server registeres or unregisters
- * with this instance. If called multiple times, previous data will be
- * overwritten.
+ * with this instance. This callback is called every time the server gets a register
+ * call. This especially means that for every periodic server register the callback will
+ * be called.
  *
  * @param server
  * @param cb the callback

+ 2 - 0
src/server/ua_discovery_manager.c

@@ -162,6 +162,8 @@ UA_DiscoveryManager_deleteMembers(UA_DiscoveryManager *dm, UA_Server *server) {
     periodicServerRegisterCallback_entry *ps, *ps_tmp;
     LIST_FOREACH_SAFE(ps, &dm->periodicServerRegisterCallbacks, pointers, ps_tmp) {
         LIST_REMOVE(ps, pointers);
+        if (ps->callback->discovery_server_url)
+            UA_free(ps->callback->discovery_server_url);
         UA_free(ps->callback);
         UA_free(ps);
     }

+ 9 - 0
src/server/ua_discovery_manager.h

@@ -31,6 +31,15 @@ typedef struct registeredServer_list_entry {
     UA_DateTime lastSeen;
 } registeredServer_list_entry;
 
+struct PeriodicServerRegisterCallback {
+    UA_UInt64 id;
+    UA_Double this_interval;
+    UA_Double default_interval;
+    UA_Boolean registered;
+    struct UA_Client* client;
+    char* discovery_server_url;
+};
+
 typedef struct periodicServerRegisterCallback_entry {
 #ifdef UA_ENABLE_MULTITHREADING
     UA_DelayedCallback delayedCleanup;

+ 9 - 1
src/server/ua_server_discovery_mdns.c

@@ -488,8 +488,16 @@ mdns_record_received(const struct resource *r, void *data) {
     entry->lastSeen = UA_DateTime_nowMonotonic();
 
     /* TXT and SRV are already set */
-    if(entry->txtSet && entry->srvSet)
+    if(entry->txtSet && entry->srvSet) {
+        // call callback for every mdns package we received.
+        // This will also call the callback multiple times
+        if (server->discoveryManager.serverOnNetworkCallback &&
+            !mdns_is_self_announce(server, entry))
+            server->discoveryManager.
+                serverOnNetworkCallback(&entry->serverOnNetwork, true, entry->txtSet,
+                                        server->discoveryManager.serverOnNetworkCallbackData);
         return;
+    }
 
     /* Add the resources */
     if(r->type == QTYPE_TXT && !entry->txtSet)

+ 18 - 25
src/server/ua_services_discovery.c

@@ -441,15 +441,19 @@ process_RegisterServer(UA_Server *server, UA_Session *session,
 #else
         UA_atomic_addSize(&server->discoveryManager.registeredServersSize, 1);
 #endif
-
-        if(server->discoveryManager.registerServerCallback)
-            server->discoveryManager.
-                registerServerCallback(requestServer,
-                                       server->discoveryManager.registerServerCallbackData);
     } else {
         UA_RegisteredServer_deleteMembers(&registeredServer_entry->registeredServer);
     }
 
+    // Always call the callback, if it is set.
+    // Previously we only called it if it was a new register call. It may be the case that this endpoint
+    // registered before, then crashed, restarts and registeres again. In that case the entry is not deleted
+    // and the callback would not be called.
+    if(server->discoveryManager.registerServerCallback)
+        server->discoveryManager.
+            registerServerCallback(requestServer,
+                                   server->discoveryManager.registerServerCallbackData);
+
     // copy the data from the request into the list
     UA_RegisteredServer_copy(requestServer, &registeredServer_entry->registeredServer);
     registeredServer_entry->lastSeen = UA_DateTime_nowMonotonic();
@@ -541,15 +545,6 @@ void UA_Discovery_cleanupTimedOut(UA_Server *server, UA_DateTime nowMonotonic) {
     }
 }
 
-struct PeriodicServerRegisterCallback {
-    UA_UInt64 id;
-    UA_Double this_interval;
-    UA_Double default_interval;
-    UA_Boolean registered;
-    UA_Client* client;
-    const char* discovery_server_url;
-};
-
 /* Called by the UA_Server callback. The OPC UA specification says:
  *
  * > If an error occurs during registration (e.g. the Discovery Server is not running) then the Server
@@ -565,14 +560,7 @@ periodicServerRegister(UA_Server *server, void *data) {
 
     struct PeriodicServerRegisterCallback *cb = (struct PeriodicServerRegisterCallback *)data;
 
-    /* Which URL to register on */
-    // fixme: remove magic url
-    const char * server_url;
-    if(cb->discovery_server_url != NULL)
-        server_url = cb->discovery_server_url;
-    else
-        server_url = "opc.tcp://localhost:4840";
-    UA_StatusCode retval = UA_Client_connect_noSession(cb->client, server_url);
+    UA_StatusCode retval = UA_Client_connect_noSession(cb->client, cb->discovery_server_url);
     if (retval == UA_STATUSCODE_GOOD) {
         /* Register
            You can also use a semaphore file. That file must exist. When the file is
@@ -656,6 +644,7 @@ UA_Server_addPeriodicServerRegisterCallback(UA_Server *server,
                             "There is already a register callback for '%s' in place. Removing the older one.", discoveryServerUrl);
                 UA_Server_removeRepeatedCallback(server, rs->callback->id);
                 LIST_REMOVE(rs, pointers);
+                UA_free(rs->callback->discovery_server_url);
                 UA_free(rs->callback);
                 UA_free(rs);
                 break;
@@ -677,9 +666,13 @@ UA_Server_addPeriodicServerRegisterCallback(UA_Server *server,
     cb->default_interval = intervalMs;
     cb->registered = false;
     cb->client = client;
-    cb->discovery_server_url = discoveryServerUrl;
-
-
+    size_t len = strlen(discoveryServerUrl);
+    cb->discovery_server_url = (char*)UA_malloc(len+1);
+    if (!cb->discovery_server_url) {
+        UA_free(cb);
+        return UA_STATUSCODE_BADOUTOFMEMORY;
+    }
+    memcpy(cb->discovery_server_url, discoveryServerUrl, len+1);
 
     /* Add the callback */
     UA_StatusCode retval =

+ 40 - 41
tools/cmake/SetGitBasedVersion.cmake

@@ -15,7 +15,6 @@ function(set_open62541_version)
             OUTPUT_STRIP_TRAILING_WHITESPACE
         )
         if(NOT GIT_DESCRIBE_ERROR_CODE)
-            set(OPEN62541_VERSION ${GIT_DESCRIBE_VERSION})
 
             # Example values can be:
             # v1.2
@@ -25,57 +24,57 @@ function(set_open62541_version)
             # v1.2.3-5-g4538abcd
             # v1.2.3-5-g4538abcd-dirty
 
-            STRING(REGEX REPLACE "^(v[0-9\\.]+)(.*)$"
-                   "\\1"
-                   GIT_VERSION_NUMBERS
-                   "${GIT_DESCRIBE_VERSION}" )
-            STRING(REGEX REPLACE "^v([0-9\\.]+)(.*)$"
-                   "\\2"
-                   GIT_VERSION_LABEL
-                   "${GIT_DESCRIBE_VERSION}" )
+            set(OPEN62541_VERSION ${GIT_DESCRIBE_VERSION})
+        endif()
+    endif()
+
+    if(OPEN62541_VERSION)
+        STRING(REGEX REPLACE "^(v[0-9\\.]+)(.*)$"
+               "\\1"
+               GIT_VERSION_NUMBERS
+               "${OPEN62541_VERSION}" )
+        STRING(REGEX REPLACE "^v([0-9\\.]+)(.*)$"
+               "\\2"
+               GIT_VERSION_LABEL
+               "${OPEN62541_VERSION}" )
 
-            if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)(.*)$")
-                STRING(REGEX REPLACE "^v([0-9]+)\\.?(.*)$"
-                       "\\1"
-                       GIT_VER_MAJOR
+        if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)(.*)$")
+            STRING(REGEX REPLACE "^v([0-9]+)\\.?(.*)$"
+                   "\\1"
+                   GIT_VER_MAJOR
+                   "${GIT_VERSION_NUMBERS}" )
+            if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)\\.([0-9]+)(.*)$")
+                STRING(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)(.*)$"
+                       "\\2"
+                       GIT_VER_MINOR
                        "${GIT_VERSION_NUMBERS}" )
-                if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)\\.([0-9]+)(.*)$")
-                    STRING(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)(.*)$"
-                           "\\2"
-                           GIT_VER_MINOR
+                if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$")
+                    STRING(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$"
+                           "\\3"
+                           GIT_VER_PATCH
                            "${GIT_VERSION_NUMBERS}" )
-                    if("${GIT_VERSION_NUMBERS}" MATCHES "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$")
-                        STRING(REGEX REPLACE "^v([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)$"
-                               "\\3"
-                               GIT_VER_PATCH
-                               "${GIT_VERSION_NUMBERS}" )
-                    else()
-                        set(GIT_VER_PATCH 0)
-                    endif()
                 else()
-                    set(GIT_VER_MINOR 0)
                     set(GIT_VER_PATCH 0)
                 endif()
-
             else()
-                set(GIT_VER_MAJOR 0)
                 set(GIT_VER_MINOR 0)
                 set(GIT_VER_PATCH 0)
             endif()
-            set(OPEN62541_VER_MAJOR ${GIT_VER_MAJOR} PARENT_SCOPE)
-            set(OPEN62541_VER_MINOR ${GIT_VER_MINOR} PARENT_SCOPE)
-            set(OPEN62541_VER_PATCH ${GIT_VER_PATCH} PARENT_SCOPE)
-            set(OPEN62541_VER_LABEL "${GIT_VERSION_LABEL}" PARENT_SCOPE)
-        endif()
-        set(OPEN62541_VER_COMMIT ${GIT_DESCRIBE_VERSION} PARENT_SCOPE)
-
 
-    endif()
-
-    # Final fallback: Just use a bogus version string that is semantically older
-    # than anything else and spit out a warning to the developer.
-    if(NOT DEFINED OPEN62541_VERSION)
-        set(OPEN62541_VERSION "v0.0.0-unknown")
+        else()
+            set(GIT_VER_MAJOR 0)
+            set(GIT_VER_MINOR 0)
+            set(GIT_VER_PATCH 0)
+        endif()
+        set(OPEN62541_VER_MAJOR ${GIT_VER_MAJOR} PARENT_SCOPE)
+        set(OPEN62541_VER_MINOR ${GIT_VER_MINOR} PARENT_SCOPE)
+        set(OPEN62541_VER_PATCH ${GIT_VER_PATCH} PARENT_SCOPE)
+        set(OPEN62541_VER_LABEL "${GIT_VERSION_LABEL}" PARENT_SCOPE)
+        set(OPEN62541_VER_COMMIT ${OPEN62541_VERSION} PARENT_SCOPE)
+    else()
+        # Final fallback: Just use a bogus version string that is semantically older
+        # than anything else and spit out a warning to the developer.
+        set(OPEN62541_VERSION "v0.0.0-unknown" PARENT_SCOPE)
         set(OPEN62541_VER_MAJOR 0 PARENT_SCOPE)
         set(OPEN62541_VER_MINOR 0 PARENT_SCOPE)
         set(OPEN62541_VER_PATCH 0 PARENT_SCOPE)

+ 96 - 0
tools/prepare_packaging.py

@@ -0,0 +1,96 @@
+#!/usr/bin/env python
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+import subprocess
+import os
+import re
+from email.utils import formatdate
+
+
+dirpath = os.path.join(os.path.dirname(os.path.realpath(__file__)),"..")
+
+git_describe_version = subprocess.check_output(["git", "describe", "--tags", "--dirty", "--match", "v*"]).decode('utf-8').strip()
+
+# v1.2
+# v1.2.3
+# v1.2.3-rc1
+# v1.2.3-rc1-dirty
+# v1.2.3-5-g4538abcd
+# v1.2.3-5-g4538abcd-dirty
+# git_describe_version = "v1.2.3"
+
+m = re.match(r"^v([0-9]+)(\.[0-9]+)?(\.[0-9]+)?(-(.*)+)?$", git_describe_version)
+version_major = m.group(1) if m.group(1) is not None else "0"
+version_minor = m.group(2).replace(".", "") if m.group(2) is not None else "0"
+version_patch = m.group(3).replace(".", "") if m.group(3) is not None else "0"
+version_label = m.group(4) if m.group(4) is not None else ""
+#print("major {} minor {} patch {} label {}".format(version_major, version_minor, version_patch, version_label))
+
+debian_distribution = "unstable"
+if version_label is not "":
+    debian_distribution = "UNRELEASED"
+
+debian_path = os.path.join(dirpath, "debian")
+changelog_file = os.path.join(debian_path, "changelog")
+
+# remove leading 'v'
+changelog_version = git_describe_version[1:] if git_describe_version[0] == 'v' else git_describe_version
+
+with open(changelog_file, 'r') as original: data = original.read()
+with open(changelog_file, 'w') as modified:
+    new_entry = """open62541 ({version}) {distribution}; urgency=medium
+
+  * Full changelog is available here: https://github.com/open62541/open62541/blob/master/CHANGELOG
+
+ -- open62541 Team <open62541-core@googlegroups.com>  {time}
+""".format(version=changelog_version, time=formatdate(), distribution = debian_distribution)
+
+    modified.write(new_entry + "\n" + data)
+
+# Create control file and replace template variables
+control_file_template = os.path.join(debian_path, "control-template")
+control_file = os.path.join(debian_path, "control")
+os.rename(control_file_template, control_file)
+
+with open(control_file, 'r+') as f:
+    content = f.read()
+    f.seek(0)
+    f.truncate()
+    f.write(content.replace('<soname>', "{}".format(version_major)))
+
+
+# rename the install template to match the soname
+install_file_template = os.path.join(debian_path, "libopen62541.install-template")
+install_file = os.path.join(debian_path, "libopen62541-{}.install".format(version_major))
+os.rename(install_file_template, install_file)
+
+install_file_template = os.path.join(debian_path, "libopen62541-dev.install-template")
+install_file = os.path.join(debian_path, "libopen62541-{}-dev.install".format(version_major))
+os.rename(install_file_template, install_file)
+
+
+# Create rule file and replace template variables
+rule_file_template = os.path.join(debian_path, "rules-template")
+rule_file = os.path.join(debian_path, "rules")
+os.rename(rule_file_template, rule_file)
+
+with open(rule_file, 'r+') as f:
+    content = f.read()
+    f.seek(0)
+    f.truncate()
+    content = content.replace('<soname>', "{}".format(version_major))
+    f.write(content)
+
+# Update CMakeLists.txt to include full version string
+
+with open(os.path.join(dirpath,"CMakeLists.txt"), 'r+') as f:
+    lines = f.readlines()
+    f.seek(0)
+    f.truncate()
+    for idx, line in enumerate(lines):
+        if idx == 2:
+            f.write('set(OPEN62541_VERSION "{}")\n'.format(git_describe_version))
+        f.write(line)

+ 39 - 6
tools/travis/travis_linux_script.sh

@@ -437,16 +437,20 @@ echo -en 'travis_fold:end:script.build.unit_test_ns0_full\\r'
 
 if ! [ -z ${DEBIAN+x} ]; then
     echo -e "\r\n== Building the Debian package =="  && echo -en 'travis_fold:start:script.build.debian\\r'
-    /usr/bin/$PYTHON ./debian/update_changelog.py
+    /usr/bin/$PYTHON ./tools/prepare_packaging.py
     echo -e "\r\n --- New debian changelog content ---"
-    echo -e "--------------------------------------"
+    echo "--------------------------------------"
     cat ./debian/changelog
-    echo -e "--------------------------------------"
+    echo "--------------------------------------"
+    # Create a backup copy. We need the clean debian directory for later packaging
+    cp -r debian debian_bak
     dpkg-buildpackage -b
     if [ $? -ne 0 ] ; then exit 1 ; fi
-    cp ../open62541*.deb .
+    rm -rf debian
+    mv debian_bak debian
+    cp ../libopen62541*.deb .
     # Copy for github release script
-    cp ../open62541*.deb ../..
+    cp ../libopen62541*.deb ../..
     echo -en 'travis_fold:end:script.build.debian\\r'
 fi
 
@@ -510,7 +514,36 @@ if [ "$CC" != "tcc" ]; then
 
         echo -en "\r\n==   Building coveralls for ${TRAVIS_REPO_SLUG} ==" && echo -en 'travis_fold:start:script.build.coveralls\\r'
         coveralls -E '.*/build/CMakeFiles/.*' -E '.*/examples/.*' -E '.*/tests/.*' -E '.*\.h' -E '.*CMakeCXXCompilerId\.cpp' -E '.*CMakeCCompilerId\.c' -r ../ || true # ignore result since coveralls is unreachable from time to time
+        cd .. && rm build -rf
         echo -en 'travis_fold:end:script.build.coveralls\\r'
+
+		if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then
+			if [ "${TRAVIS_BRANCH}" = "master" ] || [ "${TRAVIS_BRANCH}" = "1.0" ]; then
+				# Create a separate branch with the `pack/` prefix. This branch has the correct debian/changelog set, and
+				# The submodules are directly copied
+				echo -e "\r\n== Pushing 'pack/${TRAVIS_BRANCH}' branch =="  && echo -en 'travis_fold:start:script.build.pack-branch\\r'
+
+				git checkout -b pack-tmp/${TRAVIS_BRANCH}
+				cp -r deps/mdnsd deps/mdnsd_back
+				cp -r deps/ua-nodeset deps/ua-nodeset_back
+				git rm -rf --cached deps/mdnsd
+				git rm -rf --cached deps/ua-nodeset
+				mv deps/mdnsd_back deps/mdnsd
+				rm -rf deps/mdnsd/.git
+				mv deps/ua-nodeset_back deps/ua-nodeset
+				rm -rf deps/ua-nodeset/.git
+				rm -rf .gitmodules
+				git add deps/*
+				git add debian/*
+				git add CMakeLists.txt
+				git commit -m "[ci skip] Pack with inline submodules"
+				git remote add origin-auth https://$GITAUTH@github.com/${TRAVIS_REPO_SLUG}
+				git push -uf origin-auth pack-tmp/${TRAVIS_BRANCH}:pack/${TRAVIS_BRANCH}
+
+				echo -en 'travis_fold:end:script.build.pack-branch\\r'
+			fi
+        fi
+
+
     fi
-    cd .. && rm build -rf
 fi

+ 2 - 2
tools/travis/travis_push_release.sh

@@ -33,7 +33,7 @@ if [ ! -e "releases/$TAG.zip" ]; then
     cp ./../../README.md .
     cp ./../../LICENSE .
     cp ./../../AUTHORS .
-    cp ./../../open62541*.deb .
+    cp ./../../libopen62541*.deb .
 
     zip -r "$TAG.zip" open62541.c open62541.h open62541.pdf README.md LICENSE AUTHORS open62541*.deb
     rm open62541.c
@@ -42,7 +42,7 @@ if [ ! -e "releases/$TAG.zip" ]; then
     rm README.md
     rm LICENSE
     rm AUTHORS
-    rm open62541*.deb
+    rm libopen62541*.deb
     git add "$TAG.zip"
 
     echo "$TAG.zip" | cat - raw.txt > temp && mv temp raw.txt