From 29de05185c4f3b6ec5a2a6a7c52c268c499a2882 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 11 Nov 2020 10:04:08 +0100 Subject: [PATCH 1/4] Add reference to pEpEngine project in Windows project --- libpEpAdapter/libpEpAdapter.vcxproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpEpAdapter/libpEpAdapter.vcxproj b/libpEpAdapter/libpEpAdapter.vcxproj index 1240878..b52c63b 100644 --- a/libpEpAdapter/libpEpAdapter.vcxproj +++ b/libpEpAdapter/libpEpAdapter.vcxproj @@ -119,6 +119,11 @@ XCOPY "$(SolutionDir)libpEpAdapter\*.hxx" "$(SolutionDir)pEp\" /I/F/Y + + + {146e69f8-e1da-456a-b048-6dd29d9acf6b} + + From e9ff229630fcc2ec066b1acb51cc4c969c7abcf5 Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Wed, 27 Jan 2021 01:31:15 +0100 Subject: [PATCH 2/4] ci: create initial gitlab-ci jobs Adds two simple jobs for building the library for Debian 10 and CentOS 8 They will pull down docker images containing the dependencies needed for libpEpAdapter, then proceed with the build. Upon successful compilation, an image containing the ouput (and dependencies) will be pushed to a docker registry on the CI infrastructure. Note about the docker images in use: Currently they pull the latest docker images containing pEpEngine, Sequoia, and other dependencies. We want to specify the exact required version in future updates to the jobs. --- .gitlab-ci-files/common-prepare.yml | 34 +++++++++++++++++++ .gitlab-ci.yml | 25 ++++++++++++++ scripts/centos8/Makefile | 15 ++++++++ scripts/centos8/build_libpEpAdapter.sh | 8 +++++ .../centos8/libpEpAdapter.centos8.Dockerfile | 23 +++++++++++++ scripts/debian10/Makefile | 15 ++++++++ scripts/debian10/build_libpEpAdapter.sh | 8 +++++ .../libpEpAdapter.debian10.Dockerfile | 23 +++++++++++++ 8 files changed, 151 insertions(+) create mode 100644 .gitlab-ci-files/common-prepare.yml create mode 100644 .gitlab-ci.yml create mode 100644 scripts/centos8/Makefile create mode 100755 scripts/centos8/build_libpEpAdapter.sh create mode 100644 scripts/centos8/libpEpAdapter.centos8.Dockerfile create mode 100644 scripts/debian10/Makefile create mode 100755 scripts/debian10/build_libpEpAdapter.sh create mode 100644 scripts/debian10/libpEpAdapter.debian10.Dockerfile diff --git a/.gitlab-ci-files/common-prepare.yml b/.gitlab-ci-files/common-prepare.yml new file mode 100644 index 0000000..14567f1 --- /dev/null +++ b/.gitlab-ci-files/common-prepare.yml @@ -0,0 +1,34 @@ +.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 )' + +.enable_insecure_docker_registries: &enable_insecure_docker_registries + # Enable "insecure" docker registries + - | + cat < /tmp/docker-daemon.json + { + "insecure-registries" : ["${DOCKER_REGISTRY_HOST}"] + } + EOD + - sudo cp /tmp/docker-daemon.json /etc/docker/daemon.json + - sudo systemctl restart docker.service + +.standard_job: + tags: [kvm] + before_script: + - *ensure_docker + - *ensure_rsync + - *enable_insecure_docker_registries + +.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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..ea90745 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,25 @@ +include: + - '.gitlab-ci-files/common-prepare.yml' + +stages: + - build + + +# CentOS/RHEL + +centos8:build: + extends: .make_in_docker + stage: build + variables: + CI_MAKE_TARGET: libpepadapter + CI_DISTRO_TARGET: centos8 + +# Debian + +debian10:build: + extends: .make_in_docker + stage: build + variables: + CI_MAKE_TARGET: libpepadapter + CI_DISTRO_TARGET: debian10 + DEBIAN_FRONTEND: noninteractive diff --git a/scripts/centos8/Makefile b/scripts/centos8/Makefile new file mode 100644 index 0000000..8e10078 --- /dev/null +++ b/scripts/centos8/Makefile @@ -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 diff --git a/scripts/centos8/build_libpEpAdapter.sh b/scripts/centos8/build_libpEpAdapter.sh new file mode 100755 index 0000000..1f4a6c5 --- /dev/null +++ b/scripts/centos8/build_libpEpAdapter.sh @@ -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}" diff --git a/scripts/centos8/libpEpAdapter.centos8.Dockerfile b/scripts/centos8/libpEpAdapter.centos8.Dockerfile new file mode 100644 index 0000000..a2fe8a3 --- /dev/null +++ b/scripts/centos8/libpEpAdapter.centos8.Dockerfile @@ -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}/* diff --git a/scripts/debian10/Makefile b/scripts/debian10/Makefile new file mode 100644 index 0000000..8e10078 --- /dev/null +++ b/scripts/debian10/Makefile @@ -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 diff --git a/scripts/debian10/build_libpEpAdapter.sh b/scripts/debian10/build_libpEpAdapter.sh new file mode 100755 index 0000000..1f4a6c5 --- /dev/null +++ b/scripts/debian10/build_libpEpAdapter.sh @@ -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}" diff --git a/scripts/debian10/libpEpAdapter.debian10.Dockerfile b/scripts/debian10/libpEpAdapter.debian10.Dockerfile new file mode 100644 index 0000000..a2fe8a3 --- /dev/null +++ b/scripts/debian10/libpEpAdapter.debian10.Dockerfile @@ -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}/* From f50e785cd8c13f35bca34ffbe91633f7bdd0bd66 Mon Sep 17 00:00:00 2001 From: Devan Carpenter Date: Fri, 29 Jan 2021 14:29:56 +0100 Subject: [PATCH 3/4] convert .hgignore to .gitignore very small change to the contents of the file. primarily just a file rename. --- .hgignore => .gitignore | 1 - 1 file changed, 1 deletion(-) rename .hgignore => .gitignore (89%) diff --git a/.hgignore b/.gitignore similarity index 89% rename from .hgignore rename to .gitignore index e5cac49..72122ef 100644 --- a/.hgignore +++ b/.gitignore @@ -1,4 +1,3 @@ -syntax: glob *.o *.a *.d From e785f234f83c73a5c2e93ef64e1d69fe8a2dea8a Mon Sep 17 00:00:00 2001 From: heck Date: Fri, 4 Dec 2020 23:20:11 +0100 Subject: [PATCH 4/4] Use compiler to generate .d files instead of using sed. --- Makefile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 3c72e78..6eac3c6 100644 --- a/Makefile +++ b/Makefile @@ -13,15 +13,10 @@ SOURCE=$(wildcard *.cc) HEADERS=$(wildcard *.hh *.hxx) OBJECTS=$(subst .cc,.o,$(SOURCE)) DEPENDS=$(subst .cc,.d,$(SOURCE)) +CXXFLAGS+= -MMD -MP all: $(TARGET) -%.d: %.cc - @set -e; rm -f $@; \ - $(CXX) -MM $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ - rm -f $@.$$$$ - ifneq ($(MAKECMDGOALS),clean) -include $(DEPENDS) endif