namespace toolchain commands, add dist caching and git-restore-mtime support

This commit is contained in:
Lance Vick 2023-09-21 10:55:57 -07:00
parent ec9175bf45
commit d8ce33f628
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
2 changed files with 18 additions and 7 deletions

View File

@ -57,7 +57,7 @@ include $(CONFIG_DIR)/make.env
export $(shell sed 's/=.*//' $(CONFIG_DIR)/make.env) export $(shell sed 's/=.*//' $(CONFIG_DIR)/make.env)
## Use env vars from existing release if present ## Use env vars from existing release if present
ifeq ($(REPRODUCE),"true") ifeq ($(TOOLCHAIN_REPRODUCE),"true")
include $(DIST_DIR)/release.env include $(DIST_DIR)/release.env
export export
endif endif
@ -87,6 +87,17 @@ toolchain-update:
$(FETCH_DIR)/apt $(FETCH_DIR)/apt
$(MAKE) $(CONFIG_DIR)/apt-hashes-x86_64.list $(MAKE) $(CONFIG_DIR)/apt-hashes-x86_64.list
.PHONY: toolchain-restore-mtime
toolchain-restore-mtime:
$(call toolchain," \
git restore-mtime \
&& echo "Git mtime restored" \
")
.PHONY: toolchain-dist-cache
toolchain-dist-cache:
cp -Rp $(DIST_DIR)/* $(OUT_DIR)/
$(CONFIG_DIR)/apt-base.list: $(CONFIG_DIR)/apt-base.list:
touch $(CONFIG_DIR)/apt-base.list touch $(CONFIG_DIR)/apt-base.list
@ -138,15 +149,15 @@ toolchain-clean:
fi fi
docker image rm -f $(IMAGE) || : docker image rm -f $(IMAGE) || :
.PHONY: reproduce .PHONY: toolchain-reproduce
reproduce: toolchain-clean toolchain-reproduce: toolchain-clean
mkdir -p $(OUT_DIR) mkdir -p $(OUT_DIR)
$(MAKE) REPRODUCE="true" $(MAKE) TOOLCHAIN_REPRODUCE="true"
diff -q $(OUT_DIR) $(DIST_DIR) \ diff -q $(OUT_DIR) $(DIST_DIR) \
&& echo "Success: $(OUT_DIR) and $(DIST_DIR) are identical" && echo "Success: $(OUT_DIR) and $(DIST_DIR) are identical"
.PHONY: $(DIST_DIR) .PHONY: toolchain-dist
$(DIST_DIR): toolchain-dist: toolchain-restore-mtime toolchain-dist-cache
git ls-files -o --exclude-standard | grep . \ git ls-files -o --exclude-standard | grep . \
&& { echo "Error: Git has untracked files present"; exit 1; } || : && { echo "Error: Git has untracked files present"; exit 1; } || :
git diff --name-only | grep . \ git diff --name-only | grep . \

View File

@ -23,7 +23,7 @@ apt-get install -y --download-only $( \
apt-get install \ apt-get install \
-y \ -y \
--download-only \ --download-only \
sudo gettext dpkg-dev \ sudo gettext dpkg-dev git-restore-mtime \
$(cat /config/apt-base.list) $(cat /config/apt-base.list)
( cd /var/cache/apt/archives \ ( cd /var/cache/apt/archives \