Skip to content

Commit d546191

Browse files
committed
depends: Move source stamps to source dir and misc cleanups
Since the last commit will force rebuilds of all depends, take the opportunity to clean up a few other things that would trigger rebuilds as well. - Move source stamps to the sources dir so that SOURCES_PATH is respected for "make download". - Only print "fetching..." when actually downloading a file. - Avoid using non-deterministic paths for the recipe hash (patch location). This should ensure that all builders get the same resulting build-ids. - Use a per-package source paths. This will allow for removing old source files in the future. - Use a host-agnostic path for downloads which gets cleaned up properly.
1 parent 422f873 commit d546191

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

depends/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ endif
3131

3232
base_build_dir=$(BASEDIR)/work/build
3333
base_staging_dir=$(BASEDIR)/work/staging
34+
base_download_dir=$(BASEDIR)/work/download
3435
canonical_host:=$(shell ./config.sub $(HOST))
3536
build:=$(shell ./config.sub $(BUILD))
3637

depends/funcs.mk

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,19 @@ $(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dep
2020
endef
2121

2222
define fetch_file
23-
(test -f $(SOURCES_PATH)/$(4) || \
24-
( mkdir -p $$($(1)_extract_dir) && \
25-
( $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(4).temp" "$(2)/$(3)" || \
26-
$(build_DOWNLOAD) "$$($(1)_extract_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \
27-
echo "$(5) $$($(1)_extract_dir)/$(4).temp" > $$($(1)_extract_dir)/.$(4).hash && \
28-
$(build_SHA256SUM) -c $$($(1)_extract_dir)/.$(4).hash && \
29-
mv $$($(1)_extract_dir)/$(4).temp $(SOURCES_PATH)/$(4) ))
23+
(test -f $$($(1)_source_dir)/$(4) || \
24+
( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
25+
( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" || \
26+
$(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \
27+
echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
28+
$(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
29+
mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
30+
rm -rf $$($(1)_download_dir) ))
3031
endef
3132

3233
define int_get_build_recipe_hash
3334
$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches))))
34-
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM)))
35+
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | cut -d" " -f1 | $(build_SHA256SUM)))
3536
endef
3637

3738
define int_get_build_id
@@ -45,17 +46,19 @@ final_build_id_long+=$($(package)_build_id_long)
4546
#compute package-specific paths
4647
$(1)_build_subdir?=.
4748
$(1)_download_file?=$($(1)_file_name)
48-
$(1)_source:=$(SOURCES_PATH)/$($(1)_file_name)
49+
$(1)_source_dir:=$(SOURCES_PATH)
50+
$(1)_source:=$$($(1)_source_dir)/$($(1)_file_name)
4951
$(1)_staging_dir=$(base_staging_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
5052
$(1)_staging_prefix_dir:=$$($(1)_staging_dir)$($($(1)_type)_prefix)
5153
$(1)_extract_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
54+
$(1)_download_dir:=$(base_download_dir)/$(1)-$($(1)_version)
5255
$(1)_build_dir:=$$($(1)_extract_dir)/$$($(1)_build_subdir)
5356
$(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id)
5457
$(1)_prefixbin:=$($($(1)_type)_prefix)/bin/
5558
$(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz
5659

5760
#stamps
58-
$(1)_fetched=$$($(1)_extract_dir)/.stamp_fetched
61+
$(1)_fetched=$$($(1)_source_dir)/download-stamps/.stamp_fetched-$(1)-$($(1)_file_name)
5962
$(1)_extracted=$$($(1)_extract_dir)/.stamp_extracted
6063
$(1)_preprocessed=$$($(1)_extract_dir)/.stamp_preprocessed
6164
$(1)_cleaned=$$($(1)_extract_dir)/.stamp_cleaned
@@ -150,7 +153,6 @@ endef
150153

151154
define int_add_cmds
152155
$($(1)_fetched):
153-
$(AT)echo Fetching $(1)...
154156
$(AT)mkdir -p $$(@D) $(SOURCES_PATH)
155157
$(AT)cd $$(@D); $(call $(1)_fetch_cmds,$(1))
156158
$(AT)touch $$@

0 commit comments

Comments
 (0)