Download*File rules: add optional source target

If specified the path to the source target can be used in the URL via
"$source".
This commit is contained in:
Ingo Weinhold 2013-07-06 02:19:38 +02:00
parent 2a5d0aafa6
commit 46686fe6c0
1 changed files with 20 additions and 5 deletions

View File

@ -393,20 +393,35 @@ actions DataFileToSourceFile1
$(2[1]) $(DATA_VARIABLE) $(SIZE_VARIABLE) $(2[2]) $(1) $(2[1]) $(DATA_VARIABLE) $(SIZE_VARIABLE) $(2[2]) $(1)
} }
rule DownloadLocatedFile target : url rule DownloadLocatedFile target : url : source
{ {
# DownloadLocatedFile <target> : <url> [ : <source> ] ;
#
# <source> is an optional target that <target> will be made dependent on.
# Its resolved path can be used in <url> via '$source'.
URL on $(target) = $(url) ; URL on $(target) = $(url) ;
DownloadLocatedFile1 $(target) ; if $(source) {
Depends $(target) : $(source) ;
}
DownloadLocatedFile1 $(target) : $(source) ;
} }
actions DownloadLocatedFile1 actions DownloadLocatedFile1
{ {
wget -O "$(1)" $(URL) source="$(2)"
wget --no-use-server-timestamps -O "$(1)" $(URL)
} }
rule DownloadFile file : url rule DownloadFile file : url : source
{ {
# DownloadFile <file> : <url> [ : <source> ] ;
#
# <source> is an optional target that the target will be made dependent on.
# Its resolved path can be used in <url> via '$source'.
file = $(file:G=download) ; file = $(file:G=download) ;
# Request the download only once. # Request the download only once.
@ -417,7 +432,7 @@ rule DownloadFile file : url
HAIKU_FILE_DOWNLOAD on $(file) = 1 ; HAIKU_FILE_DOWNLOAD on $(file) = 1 ;
MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ; MakeLocate $(file) : $(HAIKU_DOWNLOAD_DIR) ;
DownloadLocatedFile $(file) : $(url) ; DownloadLocatedFile $(file) : $(url) : $(source) ;
return $(file) ; return $(file) ;
} }