You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2024/07/22 11:29:07 UTC

(celix) branch feature/685-refactor-manifest-format updated (26d14ff59 -> 203cbfc34)

This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a change to branch feature/685-refactor-manifest-format
in repository https://gitbox.apache.org/repos/asf/celix.git


    from 26d14ff59 gh-685: Refactor bundle manifest storage
     add a01495644 Make various lock guard deinit explicitly callable so that locks can be released manually.
     add 8b0e0e0c4 gh-685: Add bundle entry guard
     add f237f4b20 gh-685: Add rsa shm test case
     add 17a5adac5 Cleanup bundle cache on installation failure and fix use-after-free.
     add ad9e542c1 gh-685: Refactor launcher global framework handling
     add 621c2be4b gh-685: Improve error handling of launcher.
     add 8f4fafcdf gh-215: Implement async-signal-safe launcher shutdown.
     add 66ab9bc65 Resolve issue 749
     add 21172764c Use feature/promise to synchronize thread in unit test
     add 16579ba9b Merge pull request #752 from xuzhenbao/bugfix_749
     add 58860bbf1 Merge pull request #751 from apache/feature/685-update-container-config-properties-usage
     add 49a52527e Merge branch 'master' into feature/215-stop-launcher-by-signal
     add b5214cf99 gh-215: Reset launcher on error.
     add e07b2e812 gh-215: Remove all remaining scheduled events for an inactive dispatcher.
     add d384c8653 gh-215: Remove all remaining scheduled events for an inactive dispatcher.
     add 61d0f6900 gh-215: Minor documentation improvement.
     add 2378bac0e [CID 349739]: Release a lock guard manually.
     add 63683c03d Merge pull request #753 from apache/feature/215-stop-launcher-by-signal
     add 049efdd54 [CID 392574]: Destroy held lock.
     add f16b2d0b6 Merge pull request #755 from apache/hotfix/coverity-fix
     add 63445a3fa Avoid schedule event to an inactive framework.
     add 39e2282f8 Merge pull request #756 from apache/hotfix/shutdown-hang
     add 5712dabe2 Fix test_package error.
     add 1606b4993 Update to macOS-12.
     add f82223d6e Add test for failure to schedule the celix_shutdown_check event.
     add 758aa7916 Merge pull request #757 from apache/hotfix/test-package-failure
     add bfccf0e44 Update linux-build-apt to use ninja.
     add c533db4f1 Merge pull request #760 from apache/hotfix/update-ubuntu-CI
     add a62656d8d Fix header includes.
     add 81d3b6b31 Merge pull request #761 from apache/hotfix/header-includes
     new 203cbfc34 Merge remote-tracking branch 'origin/master' into feature/685-refactor-manifest-format

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/workflows/conan_create.yml                 |   2 +-
 .github/workflows/macos.yml                        |   2 +-
 .github/workflows/ubuntu.yml                       |   4 +-
 CMakeLists.txt                                     |   5 -
 .../gtest/src/CelixEventAdminTestSuite.cc          |  41 ++--
 .../gtest/src/CelixEventAdminTestSuiteBaseClass.h  |  17 +-
 .../gtest/src/RsaShmClientServerUnitTestSuite.cc   |  40 ++++
 .../rsa_shm/src/rsa_shm_client.c                   |   2 +
 .../rsa_shm/src/rsa_shm_server.c                   |   1 +
 bundles/shell/remote_shell/src/shell_mediator.c    |   2 -
 cmake/cmake_celix/ContainerPackaging.cmake         |   1 -
 libs/framework/gtest/CMakeLists.txt                |  10 +-
 .../BundleArchiveWithErrorInjectionTestSuite.cc    |   4 +-
 .../src/CelixBundleContextBundlesTestSuite.cc      |   9 +
 libs/framework/gtest/src/CelixLauncherTestSuite.cc |  24 +-
 .../framework/gtest/src/ScheduledEventTestSuite.cc |  37 +++
 ...activator_with_celix_err.c => activator_stop.c} |  12 +-
 libs/framework/include/celix_launcher.h            |  16 +-
 libs/framework/src/bundle.c                        |   2 +-
 libs/framework/src/bundle_archive.c                |   4 +-
 libs/framework/src/bundle_archive_private.h        |   2 +-
 libs/framework/src/bundle_context.c                |   2 +-
 libs/framework/src/celix_bundle_cache.c            |   8 +-
 libs/framework/src/celix_launcher.c                | 170 +++++++++-----
 libs/framework/src/celix_launcher_private.h        |  11 +-
 libs/framework/src/framework.c                     | 248 +++++++++++----------
 .../src/framework_bundle_lifecycle_handler.c       |  27 ++-
 libs/framework/src/framework_private.h             |  62 ++++--
 .../error_injector/celix_properties/CMakeLists.txt |   1 +
 .../celix_properties/include/celix_properties_ei.h |   1 +
 .../celix_properties/src/celix_properties_ei.cc    |   9 +
 libs/utils/include/celix_threads.h                 |   5 +-
 32 files changed, 514 insertions(+), 267 deletions(-)
 copy libs/framework/gtest/src/{activator_with_celix_err.c => activator_stop.c} (73%)


(celix) 01/01: Merge remote-tracking branch 'origin/master' into feature/685-refactor-manifest-format

Posted by pn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch feature/685-refactor-manifest-format
in repository https://gitbox.apache.org/repos/asf/celix.git

commit 203cbfc341bdfca361d424d025feba4cb889e3cf
Merge: 26d14ff59 81d3b6b31
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Mon Jul 22 13:28:47 2024 +0200

    Merge remote-tracking branch 'origin/master' into feature/685-refactor-manifest-format

 .github/workflows/conan_create.yml                 |   2 +-
 .github/workflows/macos.yml                        |   2 +-
 .github/workflows/ubuntu.yml                       |   4 +-
 CMakeLists.txt                                     |   5 -
 .../gtest/src/CelixEventAdminTestSuite.cc          |  41 ++--
 .../gtest/src/CelixEventAdminTestSuiteBaseClass.h  |  17 +-
 .../gtest/src/RsaShmClientServerUnitTestSuite.cc   |  40 ++++
 .../rsa_shm/src/rsa_shm_client.c                   |   2 +
 .../rsa_shm/src/rsa_shm_server.c                   |   1 +
 bundles/shell/remote_shell/src/shell_mediator.c    |   2 -
 cmake/cmake_celix/ContainerPackaging.cmake         |   1 -
 libs/framework/gtest/CMakeLists.txt                |  10 +-
 .../BundleArchiveWithErrorInjectionTestSuite.cc    |   4 +-
 .../src/CelixBundleContextBundlesTestSuite.cc      |   9 +
 libs/framework/gtest/src/CelixLauncherTestSuite.cc |  24 +-
 .../framework/gtest/src/ScheduledEventTestSuite.cc |  37 +++
 libs/framework/gtest/src/activator_stop.c          |  36 +++
 libs/framework/include/celix_launcher.h            |  16 +-
 libs/framework/src/bundle.c                        |   2 +-
 libs/framework/src/bundle_archive.c                |   4 +-
 libs/framework/src/bundle_archive_private.h        |   2 +-
 libs/framework/src/bundle_context.c                |   2 +-
 libs/framework/src/celix_bundle_cache.c            |   8 +-
 libs/framework/src/celix_launcher.c                | 170 +++++++++-----
 libs/framework/src/celix_launcher_private.h        |  11 +-
 libs/framework/src/framework.c                     | 248 +++++++++++----------
 .../src/framework_bundle_lifecycle_handler.c       |  27 ++-
 libs/framework/src/framework_private.h             |  62 ++++--
 .../error_injector/celix_properties/CMakeLists.txt |   1 +
 .../celix_properties/include/celix_properties_ei.h |   1 +
 .../celix_properties/src/celix_properties_ei.cc    |   9 +
 libs/utils/include/celix_threads.h                 |   5 +-
 32 files changed, 546 insertions(+), 259 deletions(-)

diff --cc bundles/shell/remote_shell/src/shell_mediator.c
index c4ae07ced,5ad3e6212..8d6e02f32
--- a/bundles/shell/remote_shell/src/shell_mediator.c
+++ b/bundles/shell/remote_shell/src/shell_mediator.c
@@@ -78,48 -83,51 +78,46 @@@ celix_status_t shellMediator_stop(shell
  }
  
  celix_status_t shellMediator_destroy(shell_mediator_pt instance) {
 -	celix_status_t status = CELIX_SUCCESS;
 +    celix_status_t status = CELIX_SUCCESS;
  
-     celixThreadMutex_lock(&instance->mutex);
- 
 -	instance->shellService = NULL;
 -	serviceTracker_destroy(instance->tracker);
 +    instance->shellService = NULL;
 +    serviceTracker_destroy(instance->tracker);
      celix_logHelper_destroy(instance->loghelper);
 -	celixThreadMutex_destroy(&instance->mutex);
 +    celixThreadMutex_destroy(&instance->mutex);
  
 +    free(instance);
  
 -	free(instance);
 -
 -
 -	return status;
 +    return status;
  }
  
 -celix_status_t shellMediator_executeCommand(shell_mediator_pt instance, char *command, FILE *out, FILE *err) {
 -	celix_status_t status = CELIX_SUCCESS;
 -
 -	celixThreadMutex_lock(&instance->mutex);
 +celix_status_t shellMediator_executeCommand(shell_mediator_pt instance, char* command, FILE* out, FILE* err) {
 +    celix_status_t status = CELIX_SUCCESS;
  
 +    celixThreadMutex_lock(&instance->mutex);
  
 -	if (instance->shellService != NULL) {
 -		instance->shellService->executeCommand(instance->shellService->handle, command, out, err);
 -	}
 +    if (instance->shellService != NULL) {
 +        instance->shellService->executeCommand(instance->shellService->handle, command, out, err);
 +    }
  
 -	celixThreadMutex_unlock(&instance->mutex);
 +    celixThreadMutex_unlock(&instance->mutex);
  
 -	return status;
 +    return status;
  }
  
 -static celix_status_t shellMediator_addedService(void *handler, service_reference_pt reference, void * service) {
 -	celix_status_t status = CELIX_SUCCESS;
 -	shell_mediator_pt instance = (shell_mediator_pt) handler;
 -	celixThreadMutex_lock(&instance->mutex);
 -	instance->shellService = (celix_shell_t*) service;
 -	celixThreadMutex_unlock(&instance->mutex);
 -	return status;
 +static celix_status_t shellMediator_addedService(void* handler, service_reference_pt reference, void* service) {
 +    celix_status_t status = CELIX_SUCCESS;
 +    shell_mediator_pt instance = (shell_mediator_pt)handler;
 +    celixThreadMutex_lock(&instance->mutex);
 +    instance->shellService = (celix_shell_t*)service;
 +    celixThreadMutex_unlock(&instance->mutex);
 +    return status;
  }
  
 -
 -static celix_status_t shellMediator_removedService(void *handler, service_reference_pt reference, void * service) {
 -	celix_status_t status = CELIX_SUCCESS;
 -	shell_mediator_pt instance = (shell_mediator_pt) handler;
 -	celixThreadMutex_lock(&instance->mutex);
 -	instance->shellService = NULL;
 -	celixThreadMutex_unlock(&instance->mutex);
 -	return status;
 +static celix_status_t shellMediator_removedService(void* handler, service_reference_pt reference, void* service) {
 +    celix_status_t status = CELIX_SUCCESS;
 +    shell_mediator_pt instance = (shell_mediator_pt)handler;
 +    celixThreadMutex_lock(&instance->mutex);
 +    instance->shellService = NULL;
 +    celixThreadMutex_unlock(&instance->mutex);
 +    return status;
  }
 -
diff --cc libs/framework/gtest/CMakeLists.txt
index 6770f7e03,3efab0dac..3a5016756
--- a/libs/framework/gtest/CMakeLists.txt
+++ b/libs/framework/gtest/CMakeLists.txt
@@@ -19,12 -19,12 +19,14 @@@ add_celix_bundle(simple_test_bundle1 NO
  celix_bundle_name(simple_test_bundle1 "Simple Test Bundle")
  celix_bundle_group(simple_test_bundle1 "test/group")
  celix_bundle_description(simple_test_bundle1 "Test Description")
 +celix_bundle_headers(simple_test_bundle1 "Extra-Header1: value1" "Extra-Header2: value2")
 +celix_bundle_headers(simple_test_bundle1 "Extra-Header3: value3")
  
+ add_celix_bundle(dup_symbolic_name_bundle NO_ACTIVATOR VERSION 1.0.0 SYMBOLIC_NAME simple_test_bundle1)
+ 
  add_celix_bundle(simple_test_bundle2 NO_ACTIVATOR VERSION 1.0.0)
  add_celix_bundle(simple_test_bundle3 NO_ACTIVATOR VERSION 1.0.0)
 -add_celix_bundle(bundle_with_exception SOURCES src/nop_activator.c VERSION 1.0.0)
 +add_celix_bundle(bundle_with_exception SOURCES src/activator_with_exception.c VERSION 1.0.0)
  add_celix_bundle(bundle_with_bad_export NO_ACTIVATOR VERSION 1.0.0)
  celix_bundle_headers(bundle_with_bad_export "Export-Library: $<SEMICOLON>")
  add_celix_bundle(simple_cxx_bundle SOURCES src/HelloWorldCxxActivator.cc VERSION 1.0.0)
@@@ -34,8 -34,9 +36,9 @@@ add_celix_bundle(cmp_test_bundle SOURCE
  add_celix_bundle(cond_test_bundle SOURCES src/CondTestBundleActivator.cc VERSION 1.0.0)
  add_subdirectory(subdir) #simple_test_bundle4, simple_test_bundle5 and sublib
  add_celix_bundle(celix_err_test_bundle SOURCES src/activator_with_celix_err.c VERSION 1.0.0)
+ add_celix_bundle(immediate_stop_bundle SOURCES src/activator_stop.c VERSION 1.0.0)
  
 -add_celix_bundle(unresolvable_bundle SOURCES src/nop_activator.c VERSION 1.0.0)
 +add_celix_bundle(unresolvable_bundle SOURCES src/activator_with_exception.c VERSION 1.0.0)
  if (CMAKE_BUILD_TYPE STREQUAL "Debug")
      set(POSTFIX ${CMAKE_DEBUG_POSTFIX})
  endif()
diff --cc libs/framework/src/framework.c
index 459834532,4706a4ae6..e36a928ff
--- a/libs/framework/src/framework.c
+++ b/libs/framework/src/framework.c
@@@ -262,10 -263,10 +263,10 @@@ celix_status_t framework_create(framewo
      framework->registry = celix_serviceRegistry_create(framework);
      bundle_context_t *context = NULL;
      status = CELIX_DO_IF(status, bundleContext_create(framework, framework->logger, framework->bundle, &context));
 -    status = CELIX_DO_IF(status, bundle_setContext(framework->bundle, context));
 +    CELIX_DO_IF(status, celix_bundle_setContext(framework->bundle, context));
  
      //create framework bundle entry
-     celix_framework_bundle_entry_t *entry = fw_bundleEntry_create(framework->bundle);
+     celix_bundle_entry_t*entry = fw_bundleEntry_create(framework->bundle);
      celixThreadMutex_lock(&framework->installedBundles.mutex);
      celix_arrayList_add(framework->installedBundles.entries, entry);
      celixThreadMutex_unlock(&framework->installedBundles.mutex);
@@@ -730,76 -729,76 +730,76 @@@ bool celix_framework_isBundleAlreadyIns
      return alreadyExists;
  }
  
 -celix_status_t fw_getDependentBundles(framework_pt framework, bundle_pt exporter, celix_array_list_t** list) {
 -    celix_status_t status = CELIX_SUCCESS;
 -
 -    if (*list != NULL || exporter == NULL || framework == NULL) {
 -        return CELIX_ILLEGAL_ARGUMENT;
 -    }
 -
 -    celix_array_list_t* modules;
 -    unsigned int modIdx = 0;
 -    *list = celix_arrayList_create();
 -
 -    modules = bundle_getModules(exporter);
 -    for (modIdx = 0; modIdx < celix_arrayList_size(modules); modIdx++) {
 -        module_pt module = (module_pt)celix_arrayList_get(modules, modIdx);
 -        celix_array_list_t* dependents = module_getDependents(module);
 -        if (dependents != NULL) {
 -            unsigned int depIdx = 0;
 -            for (depIdx = 0; depIdx < celix_arrayList_size(dependents); depIdx++) {
 -                module_pt dependent = (module_pt)celix_arrayList_get(dependents, depIdx);
 -                celix_arrayList_add(*list, module_getBundle(dependent));
 -            }
 -            celix_arrayList_destroy(dependents);
 -        }
 -    }
 -
 -    framework_logIfError(framework->logger, status, NULL, "Cannot get dependent bundles");
 -
 -    return status;
 -}
 -
 -celix_status_t fw_populateDependentGraph(framework_pt framework, bundle_pt exporter, hash_map_pt* map) {
 -    celix_status_t status = CELIX_SUCCESS;
 -
 -    if (framework == NULL || exporter == NULL) {
 -        return CELIX_ILLEGAL_ARGUMENT;
 -    }
 -
 -    celix_array_list_t* dependents = NULL;
 -    if ((status = fw_getDependentBundles(framework, exporter, &dependents)) == CELIX_SUCCESS) {
 -        if (dependents != NULL) {
 -            unsigned int depIdx = 0;
 -            for (depIdx = 0; depIdx < celix_arrayList_size(dependents); depIdx++) {
 -                if (!hashMap_containsKey(*map, celix_arrayList_get(dependents, depIdx))) {
 -                    hashMap_put(*map, celix_arrayList_get(dependents, depIdx), celix_arrayList_get(dependents, depIdx));
 -                    fw_populateDependentGraph(framework, (bundle_pt)celix_arrayList_get(dependents, depIdx), map);
 -                }
 -            }
 -            celix_arrayList_destroy(dependents);
 -        }
 -    }
 -
 -    framework_logIfError(framework->logger, status, NULL, "Cannot populate dependent graph");
 -
 -    return status;
 -}
 +//celix_status_t fw_getDependentBundles(framework_pt framework, bundle_pt exporter, celix_array_list_t** list) {
 +//    celix_status_t status = CELIX_SUCCESS;
 +//
 +//    if (*list != NULL || exporter == NULL || framework == NULL) {
 +//        return CELIX_ILLEGAL_ARGUMENT;
 +//    }
 +//
 +//    celix_array_list_t* modules;
 +//    unsigned int modIdx = 0;
 +//    *list = celix_arrayList_create();
 +//
 +//    modules = bundle_getModules(exporter);
 +//    for (modIdx = 0; modIdx < celix_arrayList_size(modules); modIdx++) {
 +//        celix_module_t* module = celix_arrayList_get(modules, modIdx);
 +//        celix_array_list_t* dependents = module_getDependents(module);
 +//        if (dependents != NULL) {
 +//            unsigned int depIdx = 0;
 +//            for (depIdx = 0; depIdx < celix_arrayList_size(dependents); depIdx++) {
 +//                celix_module_t* dependent = celix_arrayList_get(dependents, depIdx);
 +//                celix_arrayList_add(*list, module_getBundle(dependent));
 +//            }
 +//            celix_arrayList_destroy(dependents);
 +//        }
 +//    }
 +//
 +//    framework_logIfError(framework->logger, status, NULL, "Cannot get dependent bundles");
 +//
 +//    return status;
 +//}
 +
 +//celix_status_t fw_populateDependentGraph(framework_pt framework, bundle_pt exporter, hash_map_pt* map) {
 +//    celix_status_t status = CELIX_SUCCESS;
 +//
 +//    if (framework == NULL || exporter == NULL) {
 +//        return CELIX_ILLEGAL_ARGUMENT;
 +//    }
 +//
 +//    celix_array_list_t* dependents = NULL;
 +//    if ((status = fw_getDependentBundles(framework, exporter, &dependents)) == CELIX_SUCCESS) {
 +//        if (dependents != NULL) {
 +//            unsigned int depIdx = 0;
 +//            for (depIdx = 0; depIdx < celix_arrayList_size(dependents); depIdx++) {
 +//                if (!hashMap_containsKey(*map, celix_arrayList_get(dependents, depIdx))) {
 +//                    hashMap_put(*map, celix_arrayList_get(dependents, depIdx), celix_arrayList_get(dependents, depIdx));
 +//                    fw_populateDependentGraph(framework, (bundle_pt)celix_arrayList_get(dependents, depIdx), map);
 +//                }
 +//            }
 +//            celix_arrayList_destroy(dependents);
 +//        }
 +//    }
 +//
 +//    framework_logIfError(framework->logger, status, NULL, "Cannot populate dependent graph");
 +//
 +//    return status;
 +//}
  
  celix_status_t fw_registerService(framework_pt framework, service_registration_pt *registration, long bndId, const char* serviceName, const void* svcObj, celix_properties_t *properties) {
- 	celix_status_t status = CELIX_SUCCESS;
- 	char *error = NULL;
- 	if (serviceName == NULL || svcObj == NULL) {
- 	    status = CELIX_ILLEGAL_ARGUMENT;
- 	    error = "ServiceName and SvcObj cannot be null";
- 	}
+     celix_status_t status = CELIX_SUCCESS;
+     char *error = NULL;
+     if (serviceName == NULL || svcObj == NULL) {
+         status = CELIX_ILLEGAL_ARGUMENT;
+         error = "ServiceName and SvcObj cannot be null";
+     }
  
-     celix_framework_bundle_entry_t *entry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework,
-                                                                                                           bndId);
+     celix_bundle_entry_t*entry = celix_framework_bundleEntry_getBundleEntryAndIncreaseUseCount(framework,
+                                                                                                bndId);
      status = CELIX_DO_IF(status, serviceRegistry_registerService(framework->registry, entry->bnd, serviceName, svcObj, properties, registration));
-     celix_framework_bundleEntry_decreaseUseCount(entry);
+     celix_bundleEntry_decreaseUseCount(entry);
      framework_logIfError(framework->logger, status, error, "Cannot register service: %s", serviceName);
- 	return status;
+     return status;
  }
  
  celix_status_t fw_registerServiceFactory(framework_pt framework, service_registration_pt *registration, long bndId, const char* serviceName, service_factory_pt factory,  celix_properties_t* properties) {