OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 17... | Line 17... | |||
17 | PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz |
17 | PKG_SOURCE ?= $(PKG_SOURCE_SUBDIR).tar.xz |
|
18 | endif |
18 | endif |
|
Line 19... | Line 19... | |||
19 | |
19 | |
|
Line 20... | Line -... | |||
20 | DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) |
- | ||
21 | |
- | ||
22 | define dl_method_git |
- | ||
23 | $(if $(filter https://github.com/% git://github.com/%,$(1)),github_archive,git) |
- | ||
24 | endef |
20 | DOWNLOAD_RDEP=$(STAMP_PREPARED) $(HOST_STAMP_PREPARED) |
|
25 | |
21 | |
|
26 | # Try to guess the download method from the URL |
22 | # Try to guess the download method from the URL |
|
27 | define dl_method |
- | ||
28 | $(strip \ |
23 | define dl_method |
|
29 | $(if $(filter git,$(2)),$(call dl_method_git,$(1),$(2)), |
24 | $(strip \ |
|
30 | $(if $(2),$(2), \ |
25 | $(if $(2),$(2), \ |
|
31 | $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ |
26 | $(if $(filter @APACHE/% @GITHUB/% @GNOME/% @GNU/% @KERNEL/% @SF/% @SAVANNAH/% ftp://% http://% https://% file://%,$(1)),default, \ |
|
32 | $(if $(filter git://%,$(1)),$(call dl_method_git,$(1),$(2)), \ |
27 | $(if $(filter git://%,$(1)),git, \ |
|
33 | $(if $(filter svn://%,$(1)),svn, \ |
28 | $(if $(filter svn://%,$(1)),svn, \ |
|
34 | $(if $(filter cvs://%,$(1)),cvs, \ |
29 | $(if $(filter cvs://%,$(1)),cvs, \ |
|
35 | $(if $(filter hg://%,$(1)),hg, \ |
30 | $(if $(filter hg://%,$(1)),hg, \ |
|
36 | $(if $(filter sftp://%,$(1)),bzr, \ |
- | ||
37 | unknown \ |
31 | $(if $(filter sftp://%,$(1)),bzr, \ |
|
38 | ) \ |
32 | unknown \ |
|
39 | ) \ |
33 | ) \ |
|
40 | ) \ |
34 | ) \ |
|
41 | ) \ |
35 | ) \ |
|
Line 60... | Line 54... | |||
60 | |
54 | |
|
61 | ifdef CHECK |
55 | ifdef CHECK |
|
62 | check_escape=$(subst ','\'',$(1)) |
56 | check_escape=$(subst ','\'',$(1)) |
|
Line 63... | Line -... | |||
63 | #') |
- | ||
64 | |
- | ||
65 | # $(1): suffix of the F_, C_ variables, e.g. hash_deprecated, hash_mismatch, etc. |
- | ||
66 | # $(2): filename |
- | ||
67 | # $(3): expected hash value |
57 | #') |
|
68 | # $(4): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH} |
58 | |
|
69 | check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))')) |
59 | check_warn_nofix = $(info $(shell printf "$(_R)WARNING: %s$(_N)" '$(call check_escape,$(call C_$(1),$(2),$(3),$(4)))')) |
|
70 | ifndef FIXUP |
60 | ifndef FIXUP |
|
71 | check_warn = $(check_warn_nofix) |
61 | check_warn = $(check_warn_nofix) |
|
Line 79... | Line 69... | |||
79 | F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) |
69 | F_hash_deprecated = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile fix-hash $(3) $(call gen_sha256sum,$(1)) $(2) |
|
80 | F_hash_mismatch = $(F_hash_deprecated) |
70 | F_hash_mismatch = $(F_hash_deprecated) |
|
81 | F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1)) |
71 | F_hash_missing = $(SCRIPT_DIR)/fixup-makefile.pl $(CURDIR)/Makefile add-hash $(3) $(call gen_sha256sum,$(1)) |
|
82 | endif |
72 | endif |
|
Line 83... | Line -... | |||
83 | |
- | ||
84 | # $(1): filename |
- | ||
85 | # $(2): expected hash value |
- | ||
86 | # $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH} |
73 | |
|
87 | C_download_missing = $(1) is missing, please run make download before re-running this check |
74 | C_download_missing = $(1) is missing, please run make download before re-running this check |
|
88 | C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1)) |
75 | C_hash_mismatch = $(3) does not match $(1) hash $(call gen_sha256sum,$(1)) |
|
89 | C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1)) |
76 | C_hash_deprecated = $(3) uses deprecated hash, set to $(call gen_sha256sum,$(1)) |
|
Line 90... | Line -... | |||
90 | C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1)) |
- | ||
91 | |
- | ||
92 | # $(1): filename |
- | ||
93 | # $(2): expected hash value |
77 | C_hash_missing = $(3) is missing, set to $(call gen_sha256sum,$(1)) |
|
94 | # $(3): var name of the the form: {PKG_,Download/<name>:}{,MIRROR_}{HASH,MIRROR_HASH} |
78 | |
|
95 | check_hash = \ |
79 | check_hash = \ |
|
96 | $(if $(wildcard $(DL_DIR)/$(1)), \ |
80 | $(if $(wildcard $(DL_DIR)/$(1)), \ |
|
97 | $(if $(filter-out x,$(2)), \ |
81 | $(if $(filter-out x,$(2)), \ |
|
Line 130... | Line 114... | |||
130 | $(call check_hash,$(FILE),$(HASH),$(2)$(call hash_var,$(MD5SUM))) \ |
114 | $(call check_hash,$(FILE),$(HASH),$(2)$(call hash_var,$(MD5SUM))) \ |
|
131 | $(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \ |
115 | $(call check_md5,$(MD5SUM),$(2)MD5SUM,$(2)HASH) \ |
|
132 | ) |
116 | ) |
|
133 | endef |
117 | endef |
|
Line 134... | Line -... | |||
134 | |
- | ||
135 | # $(1): "check" |
- | ||
136 | # $(2): "PKG_" if <name> as in Download/<name> is "default", otherwise "Download/<name>:" |
- | ||
137 | # $(3): shell command sequence to do the download |
118 | |
|
138 | define wrap_mirror |
119 | define wrap_mirror |
|
139 | $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \ |
120 | $(if $(if $(MIRROR),$(filter-out x,$(MIRROR_HASH))),$(SCRIPT_DIR)/download.pl "$(DL_DIR)" "$(FILE)" "$(MIRROR_HASH)" "" || ( $(3) ),$(3)) \ |
|
140 | $(if $(filter check,$(1)), \ |
121 | $(if $(filter check,$(1)), \ |
|
141 | $(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \ |
122 | $(call check_hash,$(FILE),$(MIRROR_HASH),$(2)MIRROR_$(call hash_var,$(MIRROR_MD5SUM))) \ |
|
Line 176... | Line 157... | |||
176 | ) |
157 | ) |
|
177 | endef |
158 | endef |
|
Line 178... | Line 159... | |||
178 | |
159 | |
|
179 | define DownloadMethod/git |
160 | define DownloadMethod/git |
|
180 | $(call wrap_mirror,$(1),$(2), \ |
161 | $(call wrap_mirror,$(1),$(2), \ |
|
181 | $(call DownloadMethod/rawgit) \ |
- | ||
182 | ) |
- | ||
183 | endef |
- | ||
184 | |
162 | echo "Checking out files from the git repository..."; \ |
|
185 | define DownloadMethod/github_archive |
163 | mkdir -p $(TMP_DIR)/dl && \ |
|
186 | $(call wrap_mirror,$(1),$(2), \ |
164 | cd $(TMP_DIR)/dl && \ |
|
187 | $(SCRIPT_DIR)/dl_github_archive.py \ |
165 | rm -rf $(SUBDIR) && \ |
|
188 | --dl-dir="$(DL_DIR)" \ |
166 | [ \! -d $(SUBDIR) ] && \ |
|
189 | --url="$(URL)" \ |
167 | git clone $(OPTS) $(URL) $(SUBDIR) && \ |
|
190 | --version="$(VERSION)" \ |
168 | (cd $(SUBDIR) && git checkout $(VERSION) && \ |
|
191 | --subdir="$(SUBDIR)" \ |
169 | git submodule update --init --recursive) && \ |
|
- | 170 | echo "Packing checkout..." && \ |
||
192 | --source="$(FILE)" \ |
171 | export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \ |
|
- | 172 | rm -rf $(SUBDIR)/.git && \ |
||
193 | --hash="$(MIRROR_HASH)" \ |
173 | $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ |
|
- | 174 | mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ |
||
194 | || ( $(call DownloadMethod/rawgit) ); \ |
175 | rm -rf $(SUBDIR); \ |
|
195 | ) |
176 | ) |
|
Line 196... | Line -... | |||
196 | endef |
- | ||
197 | |
- | ||
198 | # Only intends to be called as a submethod from other DownloadMethod |
- | ||
199 | define DownloadMethod/rawgit |
- | ||
200 | echo "Checking out files from the git repository..."; \ |
- | ||
201 | mkdir -p $(TMP_DIR)/dl && \ |
- | ||
202 | cd $(TMP_DIR)/dl && \ |
- | ||
203 | rm -rf $(SUBDIR) && \ |
- | ||
204 | [ \! -d $(SUBDIR) ] && \ |
- | ||
205 | git clone $(OPTS) $(URL) $(SUBDIR) && \ |
- | ||
206 | (cd $(SUBDIR) && git checkout $(VERSION) && \ |
- | ||
207 | git submodule update --init --recursive) && \ |
- | ||
208 | echo "Packing checkout..." && \ |
- | ||
209 | export TAR_TIMESTAMP=`cd $(SUBDIR) && git log -1 --format='@%ct'` && \ |
- | ||
210 | rm -rf $(SUBDIR)/.git && \ |
- | ||
211 | $(call dl_tar_pack,$(TMP_DIR)/dl/$(FILE),$(SUBDIR)) && \ |
- | ||
212 | mv $(TMP_DIR)/dl/$(FILE) $(DL_DIR)/ && \ |
- | ||
213 | rm -rf $(SUBDIR); |
- | ||
214 | endef |
177 | endef |
|
215 | |
178 | |
|
216 | define DownloadMethod/bzr |
179 | define DownloadMethod/bzr |
|
217 | $(call wrap_mirror,$(1),$(2), \ |
180 | $(call wrap_mirror,$(1),$(2), \ |
|
218 | echo "Checking out files from the bzr repository..."; \ |
181 | echo "Checking out files from the bzr repository..."; \ |