Branch "Release_2.1" will be patch only release branch for Release_2.1 Branch "master" can now be main branch and the next libpEpAdapter release will be Release_3.0.0 We are deliberately doing a major release bump, to make it clear that the version numbers are decoupled from now on.pull/8/head Release_3.0-RC0
@ -0,0 +1,39 @@ | |||
*.o | |||
*.a | |||
*.d | |||
*.swp | |||
ws | |||
test_adapter | |||
.gnupg | |||
.pEp* | |||
lib | |||
local.conf | |||
build/ | |||
# Default ignored files | |||
?idea/ | |||
# Windows | |||
build-windows/Debug/ | |||
build-windows/Release/ | |||
build-windows/libpEpAdapter.vcxproj.user | |||
/test/test_adapter.dSYM/Contents/Info.plist | |||
/test/test_adapter_cxx.dSYM/Contents/Info.plist | |||
/test/test_ensure_passphrase.dSYM/Contents/Info.plist | |||
/test/test_leave_device_group.dSYM/Contents/Info.plist | |||
/test/test_library.dSYM/Contents/Info.plist | |||
/test/test_message_cache.dSYM/Contents/Info.plist | |||
/test/test_passphrase_cache.dSYM/Contents/Info.plist | |||
/test/test_semaphore.dSYM/Contents/Info.plist | |||
/test/test_adapter_cxx.dSYM/Contents/Resources/DWARF/test_adapter_cxx | |||
/test/test_adapter_cxx | |||
/test/test_ensure_passphrase.dSYM/Contents/Resources/DWARF/test_ensure_passphrase | |||
/test/test_ensure_passphrase | |||
/test/test_leave_device_group.dSYM/Contents/Resources/DWARF/test_leave_device_group | |||
/test/test_leave_device_group | |||
/test/test_library.dSYM/Contents/Resources/DWARF/test_library | |||
/test/test_library | |||
/test/test_message_cache.dSYM/Contents/Resources/DWARF/test_message_cache | |||
/test/test_message_cache | |||
/test/test_passphrase_cache.dSYM/Contents/Resources/DWARF/test_passphrase_cache | |||
/test/test_passphrase_cache | |||
/test/test_semaphore.dSYM/Contents/Resources/DWARF/test_semaphore | |||
/test/test_semaphore |
@ -0,0 +1,22 @@ | |||
.ensure_docker: &ensure_docker | |||
# Check for docker and install if missing | |||
- 'which docker || ( sudo apt-get update -y && sudo apt-get install docker.io -y )' | |||
.ensure_rsync: &ensure_rsync | |||
# Install rsync and deps if missing | |||
- 'which ssh-agent || ( sudo apt-get update -y && sudo apt-get install openssh-client -y )' | |||
- 'which rsync || ( sudo apt-get update -y && sudo apt-get install rsync -y )' | |||
- 'which make || ( sudo apt-get update -y && sudo apt-get install make -y )' | |||
.standard_job: | |||
tags: [kvm] | |||
before_script: | |||
- *ensure_docker | |||
- *ensure_rsync | |||
.make_in_docker: | |||
extends: .standard_job | |||
script: | |||
- docker login -u ${DOCKER_REGISTRY_USER} -p ${DOCKER_REGISTRY_PASS} ${DOCKER_REGISTRY_HOST} | |||
- cd scripts/${CI_DISTRO_TARGET} | |||
- make |
@ -0,0 +1,27 @@ | |||
include: | |||
- '.gitlab-ci-files/common-prepare.yml' | |||
stages: | |||
- build | |||
# Debian | |||
debian10:build: | |||
extends: .make_in_docker | |||
stage: build | |||
variables: | |||
CI_DISTRO_TARGET: "debian10" | |||
DEBIAN_FRONTEND: "noninteractive" | |||
rules: | |||
- if: '$CI_COMMIT_TAG !~ /^Release_[0-9]+\.[0-9]+\.[0-9]+$/' | |||
debian10:tagged-build: | |||
extends: .make_in_docker | |||
stage: build | |||
variables: | |||
CI_DISTRO_TARGET: "debian10" | |||
DEBIAN_FRONTEND: "noninteractive" | |||
TAGGED_BUILD: "true" | |||
rules: | |||
- if: '$CI_COMMIT_TAG =~ /^Release_[0-9]+\.[0-9]+\.[0-9]+$/' |
@ -1,14 +0,0 @@ | |||
syntax: glob | |||
*.o | |||
*.a | |||
*.d | |||
*.swp | |||
ws | |||
test_adapter | |||
.gnupg | |||
.pEp* | |||
lib | |||
local.conf | |||
build/ | |||
# Default ignored files | |||
.idea/workspace.xml |
@ -0,0 +1,5 @@ | |||
# 1st Party Dependencies | |||
## Prefer git tags instead of SHA hashes when possible. | |||
pEpEngine=Release_2.1.18 | |||
sequoia=365d00a08bec6a5a48d48a7c7893d78c27092b59 |
@ -0,0 +1,40 @@ | |||
// This file is under GNU General Public License 3.0 | |||
// see LICENSE.txt | |||
#include "pEpLog.hh" | |||
#include <iostream> | |||
#include <sstream> | |||
#include <mutex> | |||
#include <atomic> | |||
namespace pEp { | |||
namespace Adapter { | |||
namespace pEpLog { | |||
std::mutex mtx; | |||
std::atomic_bool is_enabled{false}; | |||
void set_enabled(bool enabled) { | |||
is_enabled.store(enabled); | |||
} | |||
bool get_enabled() { | |||
return is_enabled.load(); | |||
} | |||
void log(std::string msg) { | |||
if (is_enabled.load()) { | |||
std::lock_guard<std::mutex> l(mtx); | |||
#ifdef ANDROID | |||
__android_log_print(ANDROID_LOG_DEBUG, "pEpDebugLog", "%s", msg.c_str()); | |||
#else | |||
std::cout << msg << std::endl; //std::endl also flushes | |||
#endif | |||
} | |||
} | |||
} // pEpLog | |||
} // Adapter | |||
} // pEp |
@ -1,7 +1,62 @@ | |||
// TODO: put into not yet existing libpEpAdapter_utils.h, to be across whole libpEpAdapter | |||
// This file is under GNU General Public License 3.0 | |||
// see LICENSE.txt | |||
#ifndef LIBPEPADAPTER_PEPLOG_HH | |||
#define LIBPEPADAPTER_PEPLOG_HH | |||
#include <sstream> | |||
#include <thread> | |||
// pEpLog | |||
// ====== | |||
// a "to be kept ultra small and simple" logging unit. | |||
// featuring: | |||
// * pEpLog macro that will be eliminated in release-builds (-DNDEBUG=1) | |||
// * thread safe (no interleave when logging from diff threads) | |||
// * OS dependent backend switches: | |||
// * android: __android_log_print | |||
// * all other OS: cout | |||
// * runtime enabled/disabled switch (global) | |||
// | |||
// You might want more and more features, but the feature-policy is very restrictive, and there is a | |||
// primary design goal to keep it simple, maintainable and portable. | |||
// | |||
// How to use: | |||
// include <pEpLog.hh> | |||
// use the macro pEpLog(msg) to do logging | |||
// use NDEBUG=1 to turn logging on/off at compile-time | |||
// use set_enabled(bool) to turn logging on/off at runtime | |||
// use set_enabled_<backend>(bool) to turn logging on/off per backend | |||
#ifdef NDEBUG | |||
#define pEpLog(msg) do{}while(0) | |||
#else | |||
#include <iostream> | |||
#define pEpLog(msg) do{std::cerr << __FILE__ << "::" << __FUNCTION__ << " - " << msg << '\n';} while(0) | |||
#endif | |||
#ifdef ANDROID | |||
#include <android/log.h> | |||
#endif | |||
#define pEpLog(msg) \ | |||
do { \ | |||
std::stringstream msg_ss; \ | |||
msg_ss << std::this_thread::get_id() << " - " << __FILE__ << "::" << __FUNCTION__ << " - " << msg; \ | |||
pEp::Adapter::pEpLog::log(msg_ss.str()); \ | |||
} while(0) | |||
#endif // NDEBUG | |||
namespace pEp { | |||
namespace Adapter { | |||
namespace pEpLog { | |||
void log(std::string msg); | |||
void set_enabled(bool is_enabled); | |||
bool get_enabled(); | |||
} // pEpLog | |||
} // Adapter | |||
} // pEp | |||
#endif // LIBPEPADAPTER_PEPLOG_HH | |||
@ -0,0 +1,15 @@ | |||
CURRENT_DISTRO=$(shell basename $(shell pwd)) | |||
LIBPEPADAPTER_VERSION=$(shell git rev-parse --short=8 HEAD) | |||
IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-libpepadapter | |||
DOCKERFILE=libpEpAdapter.$(CURRENT_DISTRO).Dockerfile | |||
all: | |||
-docker pull $(IMAGE_NAME):latest | |||
cd ../../ && docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \ | |||
--build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \ | |||
--build-arg LIBPEPADAPTER_VERSION=$(LIBPEPADAPTER_VERSION) \ | |||
--cache-from $(IMAGE_NAME):latest \ | |||
--tag=$(IMAGE_NAME):$(LIBPEPADAPTER_VERSION) \ | |||
--tag=$(IMAGE_NAME):latest \ | |||
-f scripts/${CURRENT_DISTRO}/$(DOCKERFILE) . | |||
docker push $(IMAGE_NAME):${LIBPEPADAPTER_VERSION} | |||
docker push $(IMAGE_NAME):latest |
@ -0,0 +1,8 @@ | |||
#!/usr/bin/env sh | |||
set -exo | |||
echo "ENGINE_LIB_PATH=${INSTPREFIX}/lib" >> local.conf | |||
echo "ENGINE_INC_PATH=${INSTPREFIX}/include" >> local.conf | |||
make | |||
make install PREFIX="${INSTPREFIX}" |
@ -0,0 +1,23 @@ | |||
ARG DOCKER_REGISTRY_HOST | |||
ARG CURRENT_DISTRO | |||
ARG PEPENGINE_VERSION=latest | |||
FROM ${DOCKER_REGISTRY_HOST}/pep-${CURRENT_DISTRO}-engine:${PEPENGINE_VERSION} | |||
ENV BUILDROOT /build | |||
ENV INSTPREFIX /install | |||
ENV OUTDIR /out | |||
### Setup working directory | |||
RUN mkdir ${BUILDROOT}/libpEpAdapter | |||
COPY . ${BUILDROOT}/libpEpAdapter | |||
USER root | |||
RUN chown -R pep-builder:pep-builder ${BUILDROOT}/libpEpAdapter | |||
USER pep-builder | |||
WORKDIR ${BUILDROOT}/libpEpAdapter | |||
ARG LIBPEPADAPTER_VERSION | |||
ARG CURRENT_DISTRO | |||
### Build libpEpAdapter | |||
RUN sh ./scripts/${CURRENT_DISTRO}/build_libpEpAdapter.sh && \ | |||
rm -rf ${BUILDROOT}/* |
@ -0,0 +1,27 @@ | |||
include ../../DEPENDENCIES | |||
export | |||
PEPENGINE_VERSION=${pEpEngine} | |||
CURRENT_DISTRO=$(shell basename $(shell pwd)) | |||
IMAGE_NAME=${DOCKER_REGISTRY_HOST}/pep-$(CURRENT_DISTRO)-libpepadapter | |||
DOCKERFILE=libpEpAdapter.$(CURRENT_DISTRO).Dockerfile | |||
IS_TAGGED=${TAGGED_BUILD} | |||
ifeq ($(IS_TAGGED), true) | |||
# $CI_COMMIT_TAG is a predefined environment variable from Gitlab | |||
LIBPEPADAPTER_VERSION=${CI_COMMIT_TAG} | |||
else | |||
LIBPEPADAPTER_VERSION=$(shell git rev-parse --short=8 HEAD) | |||
endif | |||
all: | |||
-docker pull $(IMAGE_NAME):latest | |||
cd ../../ && docker build --build-arg CURRENT_DISTRO=$(CURRENT_DISTRO) \ | |||
--build-arg DOCKER_REGISTRY_HOST=${DOCKER_REGISTRY_HOST} \ | |||
--build-arg PEPENGINE_VERSION=$(PEPENGINE_VERSION) \ | |||
--build-arg LIBPEPADAPTER_VERSION=$(LIBPEPADAPTER_VERSION) \ | |||
--cache-from $(IMAGE_NAME):latest \ | |||
--tag=$(IMAGE_NAME):$(LIBPEPADAPTER_VERSION) \ | |||
--tag=$(IMAGE_NAME):${LIBPEPADAPTER_VERSION}_engine-${PEPENGINE_VERSION} \ | |||
--tag=$(IMAGE_NAME):latest \ | |||
-f scripts/${CURRENT_DISTRO}/$(DOCKERFILE) . | |||
docker push $(IMAGE_NAME):${LIBPEPADAPTER_VERSION} | |||
docker push $(IMAGE_NAME):${LIBPEPADAPTER_VERSION}_engine-${PEPENGINE_VERSION} | |||
docker push $(IMAGE_NAME):latest |
@ -0,0 +1,8 @@ | |||
#!/usr/bin/env sh | |||
set -exo | |||
echo "ENGINE_LIB_PATH=${INSTPREFIX}/lib" >> local.conf | |||
echo "ENGINE_INC_PATH=${INSTPREFIX}/include" >> local.conf | |||
make | |||
make install PREFIX="${INSTPREFIX}" |
@ -0,0 +1,23 @@ | |||
ARG DOCKER_REGISTRY_HOST | |||
ARG CURRENT_DISTRO | |||
ARG PEPENGINE_VERSION=latest | |||
FROM ${DOCKER_REGISTRY_HOST}/pep-${CURRENT_DISTRO}-engine:${PEPENGINE_VERSION} | |||
ENV BUILDROOT /build | |||
ENV INSTPREFIX /install | |||
ENV OUTDIR /out | |||
### Setup working directory | |||
RUN mkdir ${BUILDROOT}/libpEpAdapter | |||
COPY . ${BUILDROOT}/libpEpAdapter | |||
USER root | |||
RUN chown -R pep-builder:pep-builder ${BUILDROOT}/libpEpAdapter | |||
USER pep-builder | |||
WORKDIR ${BUILDROOT}/libpEpAdapter | |||
ARG LIBPEPADAPTER_VERSION | |||
ARG CURRENT_DISTRO | |||
### Build libpEpAdapter | |||
RUN sh ./scripts/${CURRENT_DISTRO}/build_libpEpAdapter.sh && \ | |||
rm -rf ${BUILDROOT}/* |