mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
package: Do not add an arch suffix if an explicit HASH is given
During development I tend to do: make -C pkg/foo tag HASH=dev ORG=ijc and I expect to get an image `ijc/foo:dev` and not `ijc/foo:dev-amd64`. In general I think if the HASH has been explicitly provided the build should just honour that. To compensate and avoid mistaken pushes adjust the check for dirtiness to also insist on a non-empty suffix. Signed-off-by: Ian Campbell <ijc@docker.com>
This commit is contained in:
parent
0635ef9569
commit
0469901778
@ -4,6 +4,8 @@ default: push
|
|||||||
ORG?=linuxkit
|
ORG?=linuxkit
|
||||||
SOURCE ?= .
|
SOURCE ?= .
|
||||||
|
|
||||||
|
ARCH := $(shell uname -m)
|
||||||
|
|
||||||
# Hash is of $(CURDIR) not $(CURDIR)$(SOURCE) to allow autogenerated
|
# Hash is of $(CURDIR) not $(CURDIR)$(SOURCE) to allow autogenerated
|
||||||
# source subdirectories (which would not be covered by ls-tree, but
|
# source subdirectories (which would not be covered by ls-tree, but
|
||||||
# the code which autogenerates should be in $(CURDIR) so that is what
|
# the code which autogenerates should be in $(CURDIR) so that is what
|
||||||
@ -15,14 +17,7 @@ HASH?=$(shell git ls-tree --full-tree $(HASH_COMMIT) -- $(CURDIR) | awk '{print
|
|||||||
ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition
|
ifneq ($(HASH_COMMIT),HEAD) # Others can't be dirty by definition
|
||||||
DIRTY:=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty")
|
DIRTY:=$(shell git update-index -q --refresh && git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty")
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# Makefiles can specify specific architectures they compile for. Default: all
|
|
||||||
ifeq ($(ARCHES),)
|
|
||||||
ARCHES:=x86_64 aarch64
|
|
||||||
endif
|
|
||||||
|
|
||||||
ARCH := $(shell uname -m)
|
|
||||||
ifeq ($(ARCH), x86_64)
|
ifeq ($(ARCH), x86_64)
|
||||||
SUFFIX=-amd64
|
SUFFIX=-amd64
|
||||||
endif
|
endif
|
||||||
@ -30,6 +25,13 @@ ifeq ($(ARCH), aarch64)
|
|||||||
SUFFIX=-arm64
|
SUFFIX=-arm64
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Makefiles can specify specific architectures they compile for. Default: all
|
||||||
|
ifeq ($(ARCHES),)
|
||||||
|
ARCHES:=x86_64 aarch64
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($(filter $(ARCH),$(ARCHES)),)
|
ifneq ($(filter $(ARCH),$(ARCHES)),)
|
||||||
REAL:=-y
|
REAL:=-y
|
||||||
else
|
else
|
||||||
@ -87,6 +89,9 @@ check-dirty:
|
|||||||
ifneq ($(DIRTY),)
|
ifneq ($(DIRTY),)
|
||||||
$(error Your repository is not clean. Will not push package image)
|
$(error Your repository is not clean. Will not push package image)
|
||||||
endif
|
endif
|
||||||
|
ifeq ($(SUFFIX),)
|
||||||
|
$(error Refusing to push without a SUFFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
push-y: tag-y check-dirty
|
push-y: tag-y check-dirty
|
||||||
docker pull $(TAG)$(SUFFIX) || \
|
docker pull $(TAG)$(SUFFIX) || \
|
||||||
|
Loading…
Reference in New Issue
Block a user