From 1ea64d33f04f9201a44899385807f3271ee65e1b Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Wed, 28 Jun 2017 12:14:03 +0100 Subject: [PATCH] pkg: use Jessie-era compatible git command for calculating $(HASH) The current rune for $(HASH) returns nothing with the Jessie version of git (2.1.4). Using `--full-tree` works corectly but requires an absolute path (else it produces e.g. "fatal: ../init: '../init' is outside repository"). Both `ls-tree` and `diff-index` are happy with a full absolute path, which simplifies things since we can use `$(CURDIR)` directly. Tested with a dirty `pkg/init` on both Jessie (git 2.1.4) and Stretch (git 2.11.0) with the following command, which produces identical output in both cases: $ for pkg in init containerd ; do make -C pkg/$pkg --no-print-directory show-tag; ( cd pkg/$pkg && make show-tag ); done linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389-dirty linuxkit/init:36c56f0664d49c5a6adc1120d1bf5ba6ac30b389-dirty linuxkit/containerd:1e3e8f207421de8deac8cedc26a138d6b1661a0d linuxkit/containerd:1e3e8f207421de8deac8cedc26a138d6b1661a0d Signed-off-by: Ian Campbell --- pkg/package.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/package.mk b/pkg/package.mk index e169a1353..6f32c4eb1 100644 --- a/pkg/package.mk +++ b/pkg/package.mk @@ -2,10 +2,10 @@ default: push ORG?=linuxkit -HASH?=$(shell git ls-tree HEAD -- ../$(notdir $(CURDIR)) | awk '{print $$3}') +HASH?=$(shell git ls-tree --full-tree HEAD -- $(CURDIR) | awk '{print $$3}') BASE_DEPS=Dockerfile Makefile -DIRTY=$(shell git diff-index --quiet HEAD -- ../$(notdir $(CURDIR)) || echo "-dirty") +DIRTY=$(shell git diff-index --quiet HEAD -- $(CURDIR) || echo "-dirty") TAG=$(ORG)/$(IMAGE):$(HASH)$(DIRTY) # Get a release tag, if present