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.
This commit is contained in:
Cory Fields 2014-12-11 15:40:41 -05:00
parent 422f873ef3
commit d546191dc2
2 changed files with 14 additions and 11 deletions

View File

@ -31,6 +31,7 @@ endif
base_build_dir=$(BASEDIR)/work/build base_build_dir=$(BASEDIR)/work/build
base_staging_dir=$(BASEDIR)/work/staging base_staging_dir=$(BASEDIR)/work/staging
base_download_dir=$(BASEDIR)/work/download
canonical_host:=$(shell ./config.sub $(HOST)) canonical_host:=$(shell ./config.sub $(HOST))
build:=$(shell ./config.sub $(BUILD)) build:=$(shell ./config.sub $(BUILD))

View File

@ -20,18 +20,19 @@ $(sort $(foreach dep,$(2),$(2) $(call int_get_all_dependencies,$(1),$($(dep)_dep
endef endef
define fetch_file define fetch_file
(test -f $(SOURCES_PATH)/$(4) || \ (test -f $$($(1)_source_dir)/$(4) || \
( mkdir -p $$($(1)_extract_dir) && \ ( mkdir -p $$($(1)_download_dir) && echo Fetching $(1)... && \
( $(build_DOWNLOAD) "$$($(1)_extract_dir)/$(4).temp" "$(2)/$(3)" || \ ( $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(2)/$(3)" || \
$(build_DOWNLOAD) "$$($(1)_extract_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \ $(build_DOWNLOAD) "$$($(1)_download_dir)/$(4).temp" "$(FALLBACK_DOWNLOAD_PATH)/$(3)" ) && \
echo "$(5) $$($(1)_extract_dir)/$(4).temp" > $$($(1)_extract_dir)/.$(4).hash && \ echo "$(5) $$($(1)_download_dir)/$(4).temp" > $$($(1)_download_dir)/.$(4).hash && \
$(build_SHA256SUM) -c $$($(1)_extract_dir)/.$(4).hash && \ $(build_SHA256SUM) -c $$($(1)_download_dir)/.$(4).hash && \
mv $$($(1)_extract_dir)/$(4).temp $(SOURCES_PATH)/$(4) )) mv $$($(1)_download_dir)/$(4).temp $$($(1)_source_dir)/$(4) && \
rm -rf $$($(1)_download_dir) ))
endef endef
define int_get_build_recipe_hash define int_get_build_recipe_hash
$(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches)))) $(eval $(1)_all_file_checksums:=$(shell $(build_SHA256SUM) $(meta_depends) packages/$(1).mk $(addprefix $(PATCHES_PATH)/$(1)/,$($(1)_patches))))
$(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | $(build_SHA256SUM))) $(eval $(1)_recipe_hash:=$(shell echo -n "$($(1)_all_file_checksums)" | cut -d" " -f1 | $(build_SHA256SUM)))
endef endef
define int_get_build_id define int_get_build_id
@ -45,17 +46,19 @@ final_build_id_long+=$($(package)_build_id_long)
#compute package-specific paths #compute package-specific paths
$(1)_build_subdir?=. $(1)_build_subdir?=.
$(1)_download_file?=$($(1)_file_name) $(1)_download_file?=$($(1)_file_name)
$(1)_source:=$(SOURCES_PATH)/$($(1)_file_name) $(1)_source_dir:=$(SOURCES_PATH)
$(1)_source:=$$($(1)_source_dir)/$($(1)_file_name)
$(1)_staging_dir=$(base_staging_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id) $(1)_staging_dir=$(base_staging_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
$(1)_staging_prefix_dir:=$$($(1)_staging_dir)$($($(1)_type)_prefix) $(1)_staging_prefix_dir:=$$($(1)_staging_dir)$($($(1)_type)_prefix)
$(1)_extract_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id) $(1)_extract_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)
$(1)_download_dir:=$(base_download_dir)/$(1)-$($(1)_version)
$(1)_build_dir:=$$($(1)_extract_dir)/$$($(1)_build_subdir) $(1)_build_dir:=$$($(1)_extract_dir)/$$($(1)_build_subdir)
$(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id) $(1)_patch_dir:=$(base_build_dir)/$(host)/$(1)/$($(1)_version)-$($(1)_build_id)/.patches-$($(1)_build_id)
$(1)_prefixbin:=$($($(1)_type)_prefix)/bin/ $(1)_prefixbin:=$($($(1)_type)_prefix)/bin/
$(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz $(1)_cached:=$(BASE_CACHE)/$(host)/$(1)/$(1)-$($(1)_version)-$($(1)_build_id).tar.gz
#stamps #stamps
$(1)_fetched=$$($(1)_extract_dir)/.stamp_fetched $(1)_fetched=$$($(1)_source_dir)/download-stamps/.stamp_fetched-$(1)-$($(1)_file_name)
$(1)_extracted=$$($(1)_extract_dir)/.stamp_extracted $(1)_extracted=$$($(1)_extract_dir)/.stamp_extracted
$(1)_preprocessed=$$($(1)_extract_dir)/.stamp_preprocessed $(1)_preprocessed=$$($(1)_extract_dir)/.stamp_preprocessed
$(1)_cleaned=$$($(1)_extract_dir)/.stamp_cleaned $(1)_cleaned=$$($(1)_extract_dir)/.stamp_cleaned
@ -150,7 +153,6 @@ endef
define int_add_cmds define int_add_cmds
$($(1)_fetched): $($(1)_fetched):
$(AT)echo Fetching $(1)...
$(AT)mkdir -p $$(@D) $(SOURCES_PATH) $(AT)mkdir -p $$(@D) $(SOURCES_PATH)
$(AT)cd $$(@D); $(call $(1)_fetch_cmds,$(1)) $(AT)cd $$(@D); $(call $(1)_fetch_cmds,$(1))
$(AT)touch $$@ $(AT)touch $$@