From 44cfde02d5d694a6f0eced12333d2350acb498d1 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Sat, 7 Nov 2020 15:52:56 -0700 Subject: [PATCH] util/docker: Minor Makefile updates - Update url for docker install instructions. - Update docker-cleanall target to require verification. - Update docker-jenkins-attach target to check for docker and use docker variable. - Update spaces to tabs in the docs targets. Signed-off-by: Martin Roth Change-Id: Ic1e1a545024fe1fdc37d7d8c7e6f54f124d1697b Reviewed-on: https://review.coreboot.org/c/coreboot/+/47342 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- util/docker/Makefile | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/util/docker/Makefile b/util/docker/Makefile index eaa26e1760..8b1d0efb8d 100644 --- a/util/docker/Makefile +++ b/util/docker/Makefile @@ -31,8 +31,8 @@ GID ?= $(shell id -g) test-docker: $(if $(DOCKER),,\ - $(warning Docker command not found. Please install docker) \ - $(warning https://docs.docker.com/engine/installation ) \ + $(warning Error: Docker command not found. Please install docker) \ + $(warning Instructions: https://docs.docker.com/engine/install/ ) \ $(error halting)) test-docker-login: test-docker @@ -82,14 +82,19 @@ clean-coreboot-images: docker-killall docker-clean: clean-coreboot-containers @$(MAKE) clean-coreboot-images -docker-cleanall: +docker-cleanall: test-docker +ifeq($(Y),1) @if [ -n "$$($(DOCKER) ps -a | grep -v "CONTAINER")" ]; then \ - $(DOCKER) kill $$($(DOCKER) ps -a | grep -v "CONTAINER" | sed 's|\s.*$$||'); \ + $(DOCKER) kill $$($(DOCKER) ps | grep -v "CONTAINER" | sed 's|\s.*$$||') ; \ $(DOCKER) rm $$($(DOCKER) ps -a | grep -v "CONTAINER" | sed 's|\s.*$$||'); \ fi @if [ -n "$$($(DOCKER) images | grep -v "REPOSITORY")" ]; then \ $(DOCKER) rmi $$($(DOCKER) images | grep -v "REPOSITORY" | tr -s ' ' | cut -f3 -d ' '); \ fi +else + echo "This will remove *ALL* docker containers from your machine." + echo "If this is what you want, run 'make docker-cleanall Y=1'" +endif $(DOCKER_CCACHE): @mkdir -p $@ @@ -153,8 +158,8 @@ docker-shell: test-docker /bin/bash -l docker-jenkins-attach: USER=root -docker-jenkins-attach: - docker exec --user $(USER) \ +docker-jenkins-attach: test-docker + $(DOCKER) exec --user $(USER) \ -e COLUMNS=$(shell tput cols) -e LINES=$(shell tput lines) -e TERM=$(TERM) \ -it "$$(docker ps | grep coreboot-jenkins-node | cut -f1 -d' ')" \ /bin/bash -l @@ -162,16 +167,16 @@ docker-jenkins-attach: docker-build-docs: test-docker docker-build-docs: $(DOCKER) run -it --rm \ - --user $(UID):$(GID) \ - -v "$(top)/:/data-in/:ro" \ - -v "$(top)/Documentation/_build/:/data-out/" \ - doc.coreboot.org + --user $(UID):$(GID) \ + -v "$(top)/:/data-in/:ro" \ + -v "$(top)/Documentation/_build/:/data-out/" \ + doc.coreboot.org docker-livehtml-docs: test-docker docker-livehtml-docs: $(DOCKER) run -it --rm \ - --net=host -v "$(top)/:/data-in/:ro" \ - doc.coreboot.org livehtml + --net=host -v "$(top)/:/data-in/:ro" \ + doc.coreboot.org livehtml help: @echo "Commands for working with docker images:"