Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit 2b8e543

Browse files
kolyshkinTibor Vass
authored andcommitted
rpm/Makefile: simplify and fix
1. A symbol % is not working as expected in PHONY targets, so e.g. fedora-30 was not being rebuild each time, because fedora-30 directory exists. The fix is to explicitly mark every fedora-NN target as phony. 2. Remove code duplication for making packages for different distros. 3. As a side effect, bash completion now lists all the distros to be build. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> (cherry picked from commit 62a8258) Signed-off-by: Guillaume Lours <guillaume.lours@docker.com> Upstream-commit: 6049c977f10e172db63baa1c6e32fb7c2d4850c9 Component: packaging
1 parent c6c1776 commit 2b8e543

1 file changed

Lines changed: 7 additions & 13 deletions

File tree

components/packaging/rpm/Makefile

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ RUN?=$(RPMBUILD) rpmbuild-$@/$(ARCH) $(RPMBUILD_FLAGS)
4242
SOURCE_FILES=engine-image engine.tgz cli.tgz docker.service docker.socket distribution_based_engine.json plugin-installers.tgz
4343
SOURCES=$(addprefix rpmbuild/SOURCES/, $(SOURCE_FILES))
4444

45+
FEDORA_RELEASES := fedora-31 fedora-30 fedora-29 fedora-28
46+
CENTOS_RELEASES := centos-7
47+
4548
.PHONY: help
4649
help: ## show make targets
4750
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
@@ -61,22 +64,13 @@ clean: ## remove build artifacts
6164
rpm: fedora centos ## build all rpm packages
6265

6366
.PHONY: fedora
64-
fedora: fedora-31 fedora-30 fedora-29 fedora-28 ## build all fedora rpm packages
67+
fedora: $(FEDORA_RELEASES) ## build all fedora rpm packages
6568

6669
.PHONY: centos
67-
centos: centos-7 ## build all centos rpm packages
68-
69-
.PHONY: fedora-%
70-
fedora-%: ## build fedora rpm packages
71-
fedora-%: $(SOURCES)
72-
$(CHOWN) -R root:root rpmbuild
73-
$(BUILD)
74-
$(RUN)
75-
$(CHOWN) -R $(shell id -u):$(shell id -g) rpmbuild
70+
centos: $(CENTOS_RELEASES) ## build all centos rpm packages
7671

77-
.PHONY: centos-7
78-
centos-7: ## build centos-7 rpm packages
79-
centos-7: $(SOURCES)
72+
.PHONY: $(FEDORA_RELEASES) $(CENTOS_RELEASES)
73+
$(FEDORA_RELEASES) $(CENTOS_RELEASES): $(SOURCES)
8074
$(CHOWN) -R root:root rpmbuild
8175
$(BUILD)
8276
$(RUN)

0 commit comments

Comments
 (0)