mirror of
https://github.com/falk-werner/webfuse-provider
synced 2024-10-27 20:44:10 +00:00
fix(webfuse): fix macros (#18)
* fixes return code on error * fixes macro usage * adds clean target * fixes file mode * fixes image name * adds registry prefix to allow usage of custom registry (on-premise) * changes syntax in travis file for package installation * fixes duplicate settings discovery
This commit is contained in:
parent
0ac03b6150
commit
1d413456a2
14
.cproject
14
.cproject
@ -66,7 +66,6 @@
|
|||||||
<buildTargets>
|
<buildTargets>
|
||||||
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="check" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>check</buildTarget>
|
<buildTarget>check</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -74,7 +73,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="memcheck" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="memcheck" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>memcheck</buildTarget>
|
<buildTarget>memcheck</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -82,7 +80,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="distclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="distclean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>distclean</buildTarget>
|
<buildTarget>distclean</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -90,7 +87,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="discover-cc" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="discover-cc" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>discover-cc</buildTarget>
|
<buildTarget>discover-cc</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -98,7 +94,6 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>all</buildTarget>
|
<buildTarget>all</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
@ -106,12 +101,19 @@
|
|||||||
</target>
|
</target>
|
||||||
<target name="lint" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
<target name="lint" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
<buildCommand>make</buildCommand>
|
<buildCommand>make</buildCommand>
|
||||||
<buildArguments/>
|
|
||||||
<buildTarget>lint</buildTarget>
|
<buildTarget>lint</buildTarget>
|
||||||
<stopOnError>true</stopOnError>
|
<stopOnError>true</stopOnError>
|
||||||
<useDefaultCommand>true</useDefaultCommand>
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
<runAllBuilders>true</runAllBuilders>
|
<runAllBuilders>true</runAllBuilders>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="clean" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
|
||||||
|
<buildCommand>make</buildCommand>
|
||||||
|
<buildArguments/>
|
||||||
|
<buildTarget>clean</buildTarget>
|
||||||
|
<stopOnError>true</stopOnError>
|
||||||
|
<useDefaultCommand>true</useDefaultCommand>
|
||||||
|
<runAllBuilders>true</runAllBuilders>
|
||||||
|
</target>
|
||||||
</buildTargets>
|
</buildTargets>
|
||||||
</storageModule>
|
</storageModule>
|
||||||
</cproject>
|
</cproject>
|
||||||
|
10
.travis.yml
10
.travis.yml
@ -4,10 +4,12 @@ services:
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
update: true
|
update: true
|
||||||
before_install:
|
packages:
|
||||||
- sudo apt-get install -y curl openssl ca-certificates
|
- curl
|
||||||
- sudo apt-get install -y make
|
- openssl
|
||||||
- sudo apt-get install -y qemu-user-static
|
- ca-certificates
|
||||||
|
- make
|
||||||
|
- qemu-user-static
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PARALLELMFLAGS="-j2"
|
- PARALLELMFLAGS="-j2"
|
||||||
|
63
Makefile
63
Makefile
@ -26,6 +26,7 @@ UID ?= $(shell id -u)
|
|||||||
|
|
||||||
CONTAINER_USER ?= $(UID)
|
CONTAINER_USER ?= $(UID)
|
||||||
CONTAINER_GROUP ?= $(shell id -g)
|
CONTAINER_GROUP ?= $(shell id -g)
|
||||||
|
CONTAINER_CGROUP_PARENT ?=
|
||||||
|
|
||||||
HOST_CONTAINER ?= $(shell $(PROJECT_ROOT)/build/get_container_id.sh)
|
HOST_CONTAINER ?= $(shell $(PROJECT_ROOT)/build/get_container_id.sh)
|
||||||
HOST_CONTAINER := $(HOST_CONTAINER)
|
HOST_CONTAINER := $(HOST_CONTAINER)
|
||||||
@ -96,15 +97,17 @@ CMAKEFLAGS += '-GNinja'
|
|||||||
BUILDSILENT := $(if $(BUILDVERBOSE),,1)
|
BUILDSILENT := $(if $(BUILDVERBOSE),,1)
|
||||||
$(BUILDSILENT)NINJAFLAGS += -v
|
$(BUILDSILENT)NINJAFLAGS += -v
|
||||||
|
|
||||||
|
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
||||||
|
|
||||||
DOCKER_RUNFLAGS += --interactive
|
DOCKER_RUNFLAGS += --interactive
|
||||||
DOCKER_RUNFLAGS += --rm
|
DOCKER_RUNFLAGS += --rm
|
||||||
DOCKER_RUNFLAGS += --init
|
DOCKER_RUNFLAGS += --init
|
||||||
DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
|
DOCKER_RUNFLAGS += --user $(CONTAINER_USER):$(CONTAINER_GROUP)
|
||||||
DOCKER_RUNFLAGS += --device /dev/fuse --cap-add SYS_ADMIN --security-opt apparmor:unconfined
|
|
||||||
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
DOCKER_RUNFLAGS += --env SOURCE_DATE_EPOCH
|
||||||
DOCKER_RUNFLAGS += --env BUILDTIME
|
DOCKER_RUNFLAGS += --env BUILDTIME
|
||||||
DOCKER_RUNFLAGS += --env NINJA_STATUS
|
DOCKER_RUNFLAGS += --env NINJA_STATUS
|
||||||
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
|
DOCKER_RUNFLAGS += $(addprefix --volumes-from ,$(HOST_CONTAINER))
|
||||||
|
DOCKER_RUNFLAGS += $(addprefix --cgroup-parent ,$(CONTAINER_CGROUP_PARENT))
|
||||||
|
|
||||||
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
DOCKER_BUILDARGS += CODENAME=$(CODENAME)
|
||||||
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
|
DOCKER_BUILDARGS += PARALLELMFLAGS=$(PARALLELMFLAGS)
|
||||||
@ -139,60 +142,60 @@ $(VERBOSE)SILENT := @
|
|||||||
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
|
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(PROJECT_ROOT)):$(CONTAINER_PROJECT_ROOT):cached'
|
||||||
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
|
$(HOST_CONTAINER)container_run_volumes += '$(realpath $(OUT)/$1):$(CONTAINER_OUT)/$1:delegated'
|
||||||
|
|
||||||
|
container_name = $(REGISTRY_PREFIX)$(subst -,/,$1)/$(PROJECT_NAME):$(VERSION)
|
||||||
container_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
container_run = $(DOCKER) run $(DOCKER_RUNFLAGS) $3 \
|
||||||
$(addprefix --volume ,$(call container_run_volumes,$1)) \
|
$(addprefix --volume ,$(call container_run_volumes,$1)) \
|
||||||
--workdir '$(CONTAINER_OUT)/$1' \
|
--workdir '$(CONTAINER_OUT)/$1' \
|
||||||
$(PROJECT_NAME)-$1:$(VERSION) \
|
$(call container_name,$1) \
|
||||||
$2
|
$2
|
||||||
|
|
||||||
image_rule = \
|
image_rule = \
|
||||||
$$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; \
|
$$(OUT)/docker/$1: $$(OUT)/docker/$1.dockerfile $$(EXTRACT_TARGETS) $$(PROJECT_ROOT)/Makefile; \
|
||||||
$$(call image,$1)
|
$(SILENT)$$(call image,$1)
|
||||||
image = $(SILENT) \
|
image = \
|
||||||
$(call echo_if_silent,docker build $(PROJECT_NAME)-$1:$(VERSION) $(OUT)) \
|
$(call echo_if_silent,docker build $(call container_name,$1) $(OUT)) \
|
||||||
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(PROJECT_NAME)-$1:$(VERSION) $(OUT)
|
&& $(DOCKER) build $(DOCKER_BUILDFLAGS) --iidfile $@ --file $< --tag $(call container_name,$1) $(OUT)
|
||||||
|
|
||||||
run_rule = \
|
|
||||||
run-$1: $$(OUT)/docker/$1; \
|
|
||||||
$$(call run_recipe,$1,/bin/bash,--tty)
|
|
||||||
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
|
|
||||||
run_recipe = $(SILENT)-$(call run,$1,$2,$3)
|
|
||||||
|
|
||||||
configure_rule = \
|
configure_rule = \
|
||||||
$$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \
|
$$(OUT)/$1/CMakeCache.txt: $$(PROJECT_ROOT)/CMakeLists.txt $$(OUT)/docker/$1; \
|
||||||
$$(call configure,$1)
|
$(SILENT)$$(call configure,$1)
|
||||||
configure = $(SILENT) \
|
configure = \
|
||||||
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
|
$(call run,$1,sh -c 'cmake $(CMAKEFLAGS) $(CONTAINER_PROJECT_ROOT) && $(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $@) $(realpath $(dir $@))') \
|
||||||
&& touch $@
|
&& touch $(addprefix $(dir $@)/,include_dirs.txt) $@
|
||||||
|
|
||||||
build_rule = \
|
build_rule = \
|
||||||
build-$1: $$(OUT)/$1/CMakeCache.txt; \
|
build-$1: $$(OUT)/$1/CMakeCache.txt; \
|
||||||
$$(call build,$1)
|
$(SILENT)$$(call build,$1)
|
||||||
build = $(SILENT)$(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
|
build = $(call run,$1,ninja $(PARALLELMFLAGS) $(NINJAFLAGS) $(GOALS))
|
||||||
|
|
||||||
check_rule = \
|
check_rule = \
|
||||||
check-$1: build-$1;
|
check-$1: build-$1;
|
||||||
|
|
||||||
memcheck_rule = \
|
memcheck_rule = \
|
||||||
memcheck-$1: build-$1; \
|
memcheck-$1: build-$1; \
|
||||||
$$(call memcheck,$1)
|
$(SILENT)$$(call memcheck,$1)
|
||||||
memcheck = $(SILENT)$(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
memcheck = $(call run,$1,ctest -T memcheck $(CTESTFLAGS))
|
||||||
|
|
||||||
|
run_rule = \
|
||||||
|
run-$1: $$(OUT)/docker/$1; \
|
||||||
|
$(SILENT)$$(call run,$1,/bin/bash,--tty) || true
|
||||||
|
run = $(call echo_if_silent,TARGET=$1 $2) && $(call container_run,$1,$2,$3)
|
||||||
|
|
||||||
|
clean_rule = \
|
||||||
|
clean-$1: ; \
|
||||||
|
$(SILENT)-$$(call clean,$1)
|
||||||
|
clean = rm -rf $(OUT)/$1
|
||||||
|
|
||||||
discover_cc_settings_rule = \
|
discover_cc_settings_rule = \
|
||||||
$$(OUT)/$1/include_dirs.txt: $$(OUT)/$1/CMakeCache.txt; \
|
$$(OUT)/$1/include_dirs.txt: $$(OUT)/$1/CMakeCache.txt; \
|
||||||
$$(call discover_cc_settings,$1)
|
$(SILENT)$$(call discover_cc_settings,$1)
|
||||||
discover_cc_settings = $(SILENT) \
|
discover_cc_settings = \
|
||||||
$(call run,$1,$(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $<) $(realpath $(dir $<)))
|
$(call run,$1,$(CONTAINER_PROJECT_ROOT)/build/discover_cc_settings.sh $(notdir $<) $(realpath $(dir $<)))
|
||||||
|
|
||||||
discover_cc_rule = \
|
discover_cc_rule = \
|
||||||
discover-cc-$1: $$(OUT)/$1/include_dirs.txt; \
|
discover-cc-$1: $$(OUT)/$1/include_dirs.txt; \
|
||||||
$$(call discover_cc,$1)
|
$(SILENT)$$(call discover_cc,$1)
|
||||||
discover_cc = $(SILENT)cat $<
|
discover_cc = cat $<
|
||||||
|
|
||||||
clean_rule = \
|
|
||||||
clean-$1: ; \
|
|
||||||
$$(call clean,$1)
|
|
||||||
clean = $(SILENT)-rm -rf $(OUT)/$1
|
|
||||||
|
|
||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
@ -216,11 +219,11 @@ $(RULE_TARGETS): $(PROJECT_ROOT)/Makefile | $(OUT_DIRS)
|
|||||||
echo; \
|
echo; \
|
||||||
echo '$(call run_rule,$(TARGET))'; \
|
echo '$(call run_rule,$(TARGET))'; \
|
||||||
echo; \
|
echo; \
|
||||||
|
echo '$(call clean_rule,$(TARGET))'; \
|
||||||
|
echo; \
|
||||||
echo '$(call discover_cc_settings_rule,$(TARGET))'; \
|
echo '$(call discover_cc_settings_rule,$(TARGET))'; \
|
||||||
echo; \
|
echo; \
|
||||||
echo '$(call discover_cc_rule,$(TARGET))'; \
|
echo '$(call discover_cc_rule,$(TARGET))'; \
|
||||||
echo; \
|
|
||||||
echo '$(call clean_rule,$(TARGET))'; \
|
|
||||||
} > $@
|
} > $@
|
||||||
|
|
||||||
.PHONY: all build-%
|
.PHONY: all build-%
|
||||||
|
@ -33,7 +33,7 @@ impl_container_id_by_cgroup() {
|
|||||||
DOCKER="${DOCKER:-docker}"
|
DOCKER="${DOCKER:-docker}"
|
||||||
|
|
||||||
if [ -z "${CONTAINER+x}" ] && [ -n "$DOCKER" ]; then
|
if [ -z "${CONTAINER+x}" ] && [ -n "$DOCKER" ]; then
|
||||||
CONTAINER="$(container_id "$@")" || true
|
CONTAINER="$(container_id "$@")"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "$CONTAINER"
|
echo "$CONTAINER"
|
||||||
|
Loading…
Reference in New Issue
Block a user