b93b774b97380dba0c34ebce9fc9a2c18dd4e4a3
2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 DOWNLOAD_RDEP
:=$(STAMP_PREPARED
)
10 # Try to guess the download method from the URL
14 $(if
$(filter @GNU
/% @KERNEL
/% @SF
/% ftp
://% http
://%,$(1)),default
, \
15 $(if
$(filter git
://%,$(1)),git
, \
16 $(if
$(filter svn
://%,$(1)),svn
, \
17 $(if
$(filter cvs
://%,$(1)),cvs
, \
26 # code for creating tarballs from cvs/svn/git checkouts - useful for mirror support
27 dl_pack
/bz2
=$(TAR
) cfj
$(1) $(2)
28 dl_pack
/gz
=$(TAR
) cfz
$(1) $(2)
29 dl_pack
/unknown
=echo
"ERROR: Unknown pack format for file $(1)"; false
31 $(if
$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/$(call ext
,$(1))),$(dl_pack
/unknown
))
34 define DownloadMethod
/unknown
35 @echo
"ERROR: No download method available"; false
38 define DownloadMethod
/default
39 $(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "$(MD5SUM)" $(URL
)
43 @
$(SCRIPT_DIR
)/download.pl
"$(DL_DIR)" "$(FILE)" "x" ||
( $(1) )
46 define DownloadMethod
/cvs
48 echo
"Checking out files from the cvs repository..."; \
49 mkdir
-p
$(TMP_DIR
)/dl
&& \
52 [ \
! -d
$(SUBDIR
) ] && \
53 cvs
co -r
$(VERSION
) $(URL
) $(SUBDIR
) && \
54 find
$(SUBDIR
) -name CVS | xargs
rm -rf
&& \
55 echo
"Packing checkout..." && \
56 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
57 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
62 define DownloadMethod
/svn
64 echo
"Checking out files from the svn repository..."; \
65 mkdir
-p
$(TMP_DIR
)/dl
&& \
68 [ \
! -d
$(SUBDIR
) ] && \
69 svn
co -r
$(VERSION
) $(URL
) $(SUBDIR
) && \
70 find
$(SUBDIR
) -name .svn | xargs
rm -rf
&& \
71 echo
"Packing checkout..." && \
72 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
73 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
77 define DownloadMethod
/git
79 echo
"Checking out files from the git repository..."; \
80 mkdir
-p
$(TMP_DIR
)/dl
&& \
83 [ \
! -d
$(SUBDIR
) ] && \
84 git-clone
$(URL
) $(SUBDIR
) && \
85 (cd
$(SUBDIR
) && git-checkout
$(VERSION
)) && \
86 echo
"Packing checkout..." && \
87 rm -rf
$(SUBDIR
)/.git
&& \
88 $(call dl_pack
,$(TMP_DIR
)/dl
/$(FILE
),$(SUBDIR
)) && \
89 mv
$(TMP_DIR
)/dl
/$(FILE
) $(DL_DIR
)/; \
93 Validate
/cvs
=VERSION SUBDIR
94 Validate
/svn
=VERSION SUBDIR
95 Validate
/git
=VERSION SUBDIR
97 define Download
/Defaults
107 $(eval
$(Download
/Defaults
))
108 $(eval
$(Download
/$(1)))
109 $(foreach FIELD
,URL FILE
$(Validate
/$(call dl_method
,$(URL
),$(PROTO
))),
111 $$(error Download
/$(1) is missing the
$(FIELD
) field.
)
115 $(if
$(DOWNLOAD_RDEP
),$(DOWNLOAD_RDEP
): $(DL_DIR
)/$(FILE
))
116 download
: $(DL_DIR
)/$(FILE
)
120 $(if
$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/$(call dl_method
,$(URL
),$(PROTO
))),$(DownloadMethod
/unknown
))
This page took 0.04431 seconds and 3 git commands to generate.