From c8f0a1e617e4ebef8b32e03c62e214d2e1f5a6e1 Mon Sep 17 00:00:00 2001 From: Andrew Koerner Date: Tue, 19 Sep 2023 15:36:50 +0200 Subject: [PATCH 1/5] bugfix: changed externals output arcive diretory permissions to docker gorup so that any user can RW archives. --- libadore/external/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libadore/external/Makefile b/libadore/external/Makefile index 3b72742..23c2c87 100644 --- a/libadore/external/Makefile +++ b/libadore/external/Makefile @@ -32,11 +32,14 @@ CSAPS_CPP_TAG=${CSAPS_CPP_PROJECT}:${CSAPS_CPP_VERSION} DOCKER_REPOSITORY=andrewkoerner/adore -EXTERNALS_DOCKER_ARCHIVE="/var/tmp/libadore_externals.tar" +EXTERNALS_DOCKER_DIRECTORY=/var/tmp/docker +EXTERNALS_DOCKER_ARCHIVE=${EXTERNALS_DOCKER_DIRECTORY}/libadore_externals.tar .PHONY: save_docker_images save_docker_images: - @docker save -o "${EXTERNALS_DOCKER_ARCHIVE}" "${QPOASES_TAG}" "${DLIB_TAG}" "${CATCH2_TAG}" "${OSQP_TAG}" "${XODR_TAG}" + @mkdir -p ${EXTERNALS_DOCKER_DIRECTORY} && \ + docker save -o "${EXTERNALS_DOCKER_ARCHIVE}" "${QPOASES_TAG}" "${DLIB_TAG}" "${CATCH2_TAG}" "${OSQP_TAG}" "${XODR_TAG}" && \ + chgrp -R docker ${EXTERNALS_DOCKER_DIRECTORY} && chmod -R 2775 ${EXTERNALS_DOCKER_DIRECTORY} || true .PHONY: load_docker_images load_docker_images: From 46f79a87a0ae9016c0c2053043c83743a7d43abd Mon Sep 17 00:00:00 2001 From: Andrew Koerner Date: Wed, 20 Sep 2023 09:16:25 +0200 Subject: [PATCH 2/5] documented external lib cache in /var/tmp/docker and added make target to delete it --- Makefile | 6 +++--- README.md | 11 +++++++++-- libadore.mk | 4 ++++ libadore/external/Makefile | 5 +++++ libadore/external/README.md | 9 ++++++++- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 26d1593..2fa6bec 100644 --- a/Makefile +++ b/Makefile @@ -75,9 +75,9 @@ test: set_env ## run libadore unit tests build_external: ## builds all libadore external libraries cd "${ROOT_DIR}/libadore/external/" && make -.PHONY: clean_external -clean_external: ## clean all libadore external libraries - cd "${ROOT_DIR}/libadore/external/" && make clean +.PHONY: clean_external_cache +clean_external_cache: ## clean all libadore external library cache located in /var/tmp. Note: This is never done automatically and must be manually invoked. + cd "${ROOT_DIR}/libadore/external/" && make clean_cache .PHONY: static_checks diff --git a/README.md b/README.md index 55b653c..4ae2954 100644 --- a/README.md +++ b/README.md @@ -122,8 +122,15 @@ you would like to build in the `.gitmodules` file. > by modifying the `.gitmodules` and invoking 'git submodue update --init'. > **ℹ️ INFO:** -> By default external libraries are not built. They are sourced as pre-compiled -> docker images from docker.io. +> By default external libraries are not built. They are sourced first from local +> cache in /var/tmp/docker and seconds as pre-compiled docker images from docker.io. + +The external libraries cache is not deleted or cleaned automatically. In order +to clean the external libriary cache located in `/var/tmp/docker` invoke the +provided target: +```bash +make clean_external_cache +``` ## License The source code and the accompanying material is licensed under the terms of the [EPL v2](https://www.eclipse.org/legal/epl-2.0/). diff --git a/libadore.mk b/libadore.mk index 2d0321d..59d60fe 100644 --- a/libadore.mk +++ b/libadore.mk @@ -54,6 +54,10 @@ test_libadore: ## run libadore unit tests clean_libadore: ## Clean libadore build artifacts cd "${LIBADORE_MAKEFILE_PATH}" && make clean +.PHONY: clean_external_library_cache +clean_external_library_cache: ## Clean/delete libadore system wide cache in /var/tmp/docker. Note: this is never done automatically and must be manually invoked. + cd "${LIBADORE_MAKEFILE_PATH}" && make clean + .PHONY: branch_libadore branch_libadore: ## Returns the current docker safe/sanitized branch for libadore @printf "%s\n" ${LIBADORE_TAG} diff --git a/libadore/external/Makefile b/libadore/external/Makefile index 23c2c87..b86eb7f 100644 --- a/libadore/external/Makefile +++ b/libadore/external/Makefile @@ -162,6 +162,11 @@ clean: (cd csaps-cpp && make clean) 2>/dev/null || true (cd xodr && make clean) 2>/dev/null || true +.PHONY: clean_cache +clean_cache: + rm "${EXTERNALS_DOCKER_ARCHIVE}" 2> /dev/null || true + + .PHONY: docker_publish docker_publish: docker tag "${QPOASES_TAG}" "${DOCKER_REPOSITORY}:${QPOASES_PROJECT}_${QPOASES_VERSION}" diff --git a/libadore/external/README.md b/libadore/external/README.md index ad354e9..fa4ca9d 100644 --- a/libadore/external/README.md +++ b/libadore/external/README.md @@ -19,8 +19,15 @@ you would like to build in the `.gitmodules` file. > **ℹ️ INFO:** > By default external libraries are not built. They are sourced as pre-compiled -> docker images from docker.io. +> docker images from docker.io and saved to a local system wide cache in +> /var/tmp. +The external libraries cache is not deleted or cleaned automatically. In order +to clean the external library cache located in `/var/tmp/docker` invoke the +provided target: +```bash +make clean_cache +``` ## Getting Started Docker and Make are required From 46b4cc90e0669d391eaaa88b1733df368a5a9472 Mon Sep 17 00:00:00 2001 From: Andrew Koerner Date: Wed, 20 Sep 2023 09:39:38 +0200 Subject: [PATCH 3/5] updated ci path to external cache --- ci.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci.env b/ci.env index 713fd76..f4c88e7 100644 --- a/ci.env +++ b/ci.env @@ -17,7 +17,7 @@ build_artifacts=( "${build_directory}/install/lib/libmad.a" "${build_directory}/install/lib/libqpOASES.a" "${build_directory}/install/lib/libxodr.a" - "${build_directory}/${project}*.tar" + "${build_directory}/docker/${project}*.tar" ) log_files=( From 65aff1d5a693a2d4dc53004a3150aca452656df0 Mon Sep 17 00:00:00 2001 From: Andrew Koerner Date: Wed, 20 Sep 2023 09:42:54 +0200 Subject: [PATCH 4/5] readded clean_external target --- Makefile | 4 ++++ ci.env | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2fa6bec..b051066 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,10 @@ build_external: ## builds all libadore external libraries clean_external_cache: ## clean all libadore external library cache located in /var/tmp. Note: This is never done automatically and must be manually invoked. cd "${ROOT_DIR}/libadore/external/" && make clean_cache +.PHONY: clean_external +clean_external: ## clean all libadore external libraries + cd "${ROOT_DIR}/libadore/external/" && make clean + .PHONY: static_checks static_checks: lint lizard cppcheck diff --git a/ci.env b/ci.env index f4c88e7..713fd76 100644 --- a/ci.env +++ b/ci.env @@ -17,7 +17,7 @@ build_artifacts=( "${build_directory}/install/lib/libmad.a" "${build_directory}/install/lib/libqpOASES.a" "${build_directory}/install/lib/libxodr.a" - "${build_directory}/docker/${project}*.tar" + "${build_directory}/${project}*.tar" ) log_files=( From c608885c0cd1b13ee3b7080b288dcd4b43642e19 Mon Sep 17 00:00:00 2001 From: Andrew Koerner Date: Wed, 20 Sep 2023 10:10:23 +0200 Subject: [PATCH 5/5] update external clean target --- libadore.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libadore.mk b/libadore.mk index 59d60fe..a58d6d3 100644 --- a/libadore.mk +++ b/libadore.mk @@ -56,7 +56,7 @@ clean_libadore: ## Clean libadore build artifacts .PHONY: clean_external_library_cache clean_external_library_cache: ## Clean/delete libadore system wide cache in /var/tmp/docker. Note: this is never done automatically and must be manually invoked. - cd "${LIBADORE_MAKEFILE_PATH}" && make clean + cd "${LIBADORE_MAKEFILE_PATH}" && make clean_external_library_cache .PHONY: branch_libadore branch_libadore: ## Returns the current docker safe/sanitized branch for libadore