2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-04-17 16:45:20 +02:00
|
|
|
#
|
|
|
|
# This file contains the download helpers for the various package
|
|
|
|
# infrastructures. It is used to handle downloads from HTTP servers,
|
|
|
|
# FTP servers, Git repositories, Subversion repositories, Mercurial
|
|
|
|
# repositories, Bazaar repositories, and SCP servers.
|
|
|
|
#
|
2013-06-06 01:53:30 +02:00
|
|
|
################################################################################
|
2012-04-17 16:45:20 +02:00
|
|
|
|
2012-04-17 16:45:19 +02:00
|
|
|
# Download method commands
|
2014-07-02 23:11:23 +02:00
|
|
|
export WGET := $(call qstrip,$(BR2_WGET)) $(QUIET)
|
2014-07-02 23:11:20 +02:00
|
|
|
export SVN := $(call qstrip,$(BR2_SVN))
|
2014-07-02 23:11:21 +02:00
|
|
|
export CVS := $(call qstrip,$(BR2_CVS))
|
2014-07-02 23:11:24 +02:00
|
|
|
export BZR := $(call qstrip,$(BR2_BZR))
|
2014-07-02 23:11:19 +02:00
|
|
|
export GIT := $(call qstrip,$(BR2_GIT))
|
2014-07-02 23:11:22 +02:00
|
|
|
export HG := $(call qstrip,$(BR2_HG)) $(QUIET)
|
2014-07-02 23:11:25 +02:00
|
|
|
export SCP := $(call qstrip,$(BR2_SCP)) $(QUIET)
|
2013-07-20 08:52:43 +02:00
|
|
|
SSH := $(call qstrip,$(BR2_SSH)) $(QUIET)
|
2014-07-02 23:11:26 +02:00
|
|
|
export LOCALFILES := $(call qstrip,$(BR2_LOCALFILES))
|
2012-04-17 16:45:19 +02:00
|
|
|
|
|
|
|
# Default spider mode is 'DOWNLOAD'. Other possible values are 'SOURCE_CHECK'
|
|
|
|
# used by the _source-check target and 'SHOW_EXTERNAL_DEPS', used by the
|
|
|
|
# external-deps target.
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
DL_MODE = DOWNLOAD
|
2012-04-17 16:45:19 +02:00
|
|
|
|
2014-02-04 16:18:51 +01:00
|
|
|
# DL_DIR may have been set already from the environment
|
2014-02-10 22:48:55 +01:00
|
|
|
ifeq ($(origin DL_DIR),undefined)
|
2014-02-04 16:18:51 +01:00
|
|
|
DL_DIR ?= $(call qstrip,$(BR2_DL_DIR))
|
2012-04-17 16:45:19 +02:00
|
|
|
ifeq ($(DL_DIR),)
|
2013-07-20 08:52:43 +02:00
|
|
|
DL_DIR := $(TOPDIR)/dl
|
2012-04-17 16:45:19 +02:00
|
|
|
endif
|
2014-02-10 22:48:55 +01:00
|
|
|
else
|
|
|
|
# Restore the BR2_DL_DIR that was overridden by the .config file
|
|
|
|
BR2_DL_DIR = $(DL_DIR)
|
|
|
|
endif
|
2012-04-17 16:45:19 +02:00
|
|
|
|
2012-09-10 12:38:29 +02:00
|
|
|
# ensure it exists and a absolute path
|
2013-07-20 08:52:43 +02:00
|
|
|
DL_DIR := $(shell mkdir -p $(DL_DIR) && cd $(DL_DIR) >/dev/null && pwd)
|
2012-09-10 12:38:29 +02:00
|
|
|
|
2012-04-17 16:45:19 +02:00
|
|
|
#
|
|
|
|
# URI scheme helper functions
|
|
|
|
# Example URIs:
|
|
|
|
# * http://www.example.com/dir/file
|
|
|
|
# * scp://www.example.com:dir/file (with domainseparator :)
|
|
|
|
#
|
|
|
|
# geturischeme: http
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
geturischeme = $(firstword $(subst ://, ,$(call qstrip,$(1))))
|
2012-04-17 16:45:19 +02:00
|
|
|
# stripurischeme: www.example.com/dir/file
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
stripurischeme = $(lastword $(subst ://, ,$(call qstrip,$(1))))
|
2012-04-17 16:45:19 +02:00
|
|
|
# domain: www.example.com
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
domain = $(firstword $(subst $(call domainseparator,$(2)), ,$(call stripurischeme,$(1))))
|
2012-04-17 16:45:19 +02:00
|
|
|
# notdomain: dir/file
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
notdomain = $(patsubst $(call domain,$(1),$(2))$(call domainseparator,$(2))%,%,$(call stripurischeme,$(1)))
|
2012-04-17 16:45:19 +02:00
|
|
|
#
|
|
|
|
# default domainseparator is /, specify alternative value as first argument
|
.mk files: bulk aligment and whitespace cleanup of assignments
The Buildroot coding style defines one space around make assignments and
does not align the assignment symbols.
This patch does a bulk fix of offending packages. The package
infrastructures (or more in general assignments to calculated variable
names, like $(2)_FOO) are not touched.
Alignment of line continuation characters (\) is kept as-is.
The sed command used to do this replacement is:
find * -name "*.mk" | xargs sed -i \
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*$#\1 \2#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\]\+\)$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\s*\([^\\ \t]\+\s*\\\)\s*$#\1 \2 \3#'
-e 's#^\([A-Z0-9a-z_]\+\)\s*\([?:+]\?=\)\(\s*\\\)#\1 \2\3#'
Brief explanation of this command:
^\([A-Z0-9a-z_]\+\) a regular variable at the beginning of the line
\([?:+]\?=\) any assignment character =, :=, ?=, +=
\([^\\]\+\) any string not containing a line continuation
\([^\\ \t]\+\s*\\\) string, optional whitespace, followed by a
line continuation character
\(\s*\\\) optional whitespace, followed by a line
continuation character
Hence, the first subexpression handles empty assignments, the second
handles regular assignments, the third handles regular assignments with
line continuation, and the fourth empty assignments with line
continuation.
This expression was tested on following test text: (initial tab not
included)
FOO = spaces before
FOO = spaces before and after
FOO = tab before
FOO = tab and spaces before
FOO = tab after
FOO = tab and spaces after
FOO = spaces and tab after
FOO = \
FOO = bar \
FOO = bar space \
FOO = \
GENIMAGE_DEPENDENCIES = host-pkgconf libconfuse
FOO += spaces before
FOO ?= spaces before and after
FOO :=
FOO =
FOO =
FOO =
FOO =
$(MAKE1) CROSS_COMPILE=$(TARGET_CROSS) -C
AT91BOOTSTRAP3_DEFCONFIG = \
AXEL_DISABLE_I18N=--i18n=0
After this bulk change, following manual fixups were done:
- fix line continuation alignment in cegui06 and spice (the sed
expression leaves the number of whitespace between the value and line
continuation character intact, but the whitespace before that could have
changed, causing misalignment.
- qt5base was reverted, as this package uses extensive alignment which
actually makes the code more readable.
Finally, the end result was manually reviewed.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Cc: Yann E. Morin <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-07 09:06:03 +02:00
|
|
|
domainseparator = $(if $(1),$(1),/)
|
2012-04-17 16:45:19 +02:00
|
|
|
|
2014-06-02 17:55:59 +02:00
|
|
|
# github(user,package,version): returns site of GitHub repository
|
2014-03-09 19:54:35 +01:00
|
|
|
github = https://github.com/$(1)/$(2)/archive/$(3)
|
2013-12-05 18:20:44 +01:00
|
|
|
|
pkg-infra: add possiblity to check downloaded files against known hashes
Some of the packages that Buildroot might build are sensitive packages,
related to security: openssl, dropbear, ca-certificates...
Some of those packages are downloaded over plain http, because there is
no way to get them over a secure channel, such as https.
In these dark times of pervasive surveillance, the potential for harm that
a tampered-with package could generate, we may want to check the integrity
of those sensitive packages.
So, each package may now provide a list of hashes for all files that needs
to be downloaded, and Buildroot will just fail if any downloaded file does
not match its known hash, in which case it is removed.
Hashes can be any of the md5, sha1 or sha2 variants, and will be checked
even if the file was pre-downloaded.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 21:36:21 +02:00
|
|
|
# Helper for checking a tarball's checksum
|
|
|
|
# If the hash does not match, remove the incorrect file
|
|
|
|
# $(1): the path to the file with the hashes
|
|
|
|
# $(2): the full path to the file to check
|
|
|
|
define VERIFY_HASH
|
2014-10-25 01:42:49 +02:00
|
|
|
if ! support/download/check-hash $(1) $(2) $(if $(QUIET),>/dev/null); then \
|
pkg-infra: add possiblity to check downloaded files against known hashes
Some of the packages that Buildroot might build are sensitive packages,
related to security: openssl, dropbear, ca-certificates...
Some of those packages are downloaded over plain http, because there is
no way to get them over a secure channel, such as https.
In these dark times of pervasive surveillance, the potential for harm that
a tampered-with package could generate, we may want to check the integrity
of those sensitive packages.
So, each package may now provide a list of hashes for all files that needs
to be downloaded, and Buildroot will just fail if any downloaded file does
not match its known hash, in which case it is removed.
Hashes can be any of the md5, sha1 or sha2 variants, and will be checked
even if the file was pre-downloaded.
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 21:36:21 +02:00
|
|
|
rm -f $(2); \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
endef
|
|
|
|
|
2012-04-17 16:45:19 +02:00
|
|
|
################################################################################
|
2013-09-11 14:12:04 +02:00
|
|
|
# The DOWNLOAD_* helpers are in charge of getting a working copy
|
|
|
|
# of the source repository for their corresponding SCM,
|
2012-04-17 16:45:19 +02:00
|
|
|
# checking out the requested version / commit / tag, and create an
|
|
|
|
# archive out of it. DOWNLOAD_SCP uses scp to obtain a remote file with
|
|
|
|
# ssh authentication. DOWNLOAD_WGET is the normal wget-based download
|
|
|
|
# mechanism.
|
|
|
|
#
|
2013-09-11 14:12:04 +02:00
|
|
|
# The SOURCE_CHECK_* helpers are in charge of simply checking that the source
|
|
|
|
# is available for download. This can be used to make sure one will be able
|
|
|
|
# to get all the sources needed for one's build configuration.
|
2012-04-17 16:45:19 +02:00
|
|
|
#
|
2013-09-11 14:12:04 +02:00
|
|
|
# The SHOW_EXTERNAL_DEPS_* helpers simply output to the console the names
|
|
|
|
# of the files that will be downloaded, or path and revision of the
|
|
|
|
# source repositories, producing a list of all the "external dependencies"
|
|
|
|
# of a given build configuration.
|
2012-04-17 16:45:19 +02:00
|
|
|
################################################################################
|
|
|
|
|
2012-11-01 02:21:05 +01:00
|
|
|
# Try a shallow clone - but that only works if the version is a ref (tag or
|
2012-12-02 01:56:07 +01:00
|
|
|
# branch). Before trying to do a shallow clone we check if $($(PKG)_DL_VERSION)
|
|
|
|
# is in the list provided by git ls-remote. If not we fall back on a full clone.
|
|
|
|
#
|
|
|
|
# Messages for the type of clone used are provided to ease debugging in case of
|
|
|
|
# problems
|
2012-04-17 16:45:19 +02:00
|
|
|
define DOWNLOAD_GIT
|
|
|
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
2014-08-03 19:53:38 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper git \
|
|
|
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
|
|
|
$($(PKG)_SITE) \
|
|
|
|
$($(PKG)_DL_VERSION) \
|
|
|
|
$($(PKG)_BASE_NAME)
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# TODO: improve to check that the given PKG_DL_VERSION exists on the remote
|
|
|
|
# repository
|
|
|
|
define SOURCE_CHECK_GIT
|
|
|
|
$(GIT) ls-remote --heads $($(PKG)_SITE) > /dev/null
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_GIT
|
|
|
|
echo $($(PKG)_SOURCE)
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
define DOWNLOAD_BZR
|
|
|
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
2014-08-03 19:53:35 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper bzr \
|
|
|
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
|
|
|
$($(PKG)_SITE) \
|
|
|
|
$($(PKG)_DL_VERSION) \
|
|
|
|
$($(PKG)_BASE_NAME)
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SOURCE_CHECK_BZR
|
|
|
|
$(BZR) ls --quiet $($(PKG)_SITE) > /dev/null
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_BZR
|
|
|
|
echo $($(PKG)_SOURCE)
|
|
|
|
endef
|
|
|
|
|
2013-09-11 14:12:04 +02:00
|
|
|
define DOWNLOAD_CVS
|
|
|
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
2014-08-03 19:53:37 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper cvs \
|
|
|
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
|
|
|
$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) \
|
|
|
|
$($(PKG)_DL_VERSION) \
|
|
|
|
$($(PKG)_RAWNAME) \
|
|
|
|
$($(PKG)_BASE_NAME)
|
2013-09-11 14:12:04 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Not all CVS servers support ls/rls, use login to see if we can connect
|
|
|
|
define SOURCE_CHECK_CVS
|
|
|
|
$(CVS) -d:pserver:anonymous:@$(call stripurischeme,$(call qstrip,$($(PKG)_SITE))) login
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_CVS
|
|
|
|
echo $($(PKG)_SOURCE)
|
|
|
|
endef
|
2012-04-17 16:45:19 +02:00
|
|
|
|
|
|
|
define DOWNLOAD_SVN
|
|
|
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
2014-08-03 19:53:41 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper svn \
|
|
|
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
|
|
|
$($(PKG)_SITE) \
|
|
|
|
$($(PKG)_DL_VERSION) \
|
|
|
|
$($(PKG)_BASE_NAME)
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SOURCE_CHECK_SVN
|
2014-06-26 15:17:39 +02:00
|
|
|
$(SVN) ls $($(PKG)_SITE)@$($(PKG)_DL_VERSION) > /dev/null
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_SVN
|
|
|
|
echo $($(PKG)_SOURCE)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# SCP URIs should be of the form scp://[user@]host:filepath
|
|
|
|
# Note that filepath is relative to the user's home directory, so you may want
|
|
|
|
# to prepend the path with a slash: scp://[user@]host:/absolutepath
|
|
|
|
define DOWNLOAD_SCP
|
|
|
|
test -e $(DL_DIR)/$(2) || \
|
2014-08-03 19:53:40 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper scp \
|
|
|
|
$(DL_DIR)/$(2) \
|
|
|
|
'$(call stripurischeme,$(call qstrip,$(1)))' && \
|
2014-12-08 08:50:14 +01:00
|
|
|
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_RAWNAME).hash,$(DL_DIR)/$(2))
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SOURCE_CHECK_SCP
|
|
|
|
$(SSH) $(call domain,$(1),:) ls '$(call notdomain,$(1),:)' > /dev/null
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_SCP
|
|
|
|
echo $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
|
|
define DOWNLOAD_HG
|
|
|
|
test -e $(DL_DIR)/$($(PKG)_SOURCE) || \
|
2014-08-03 19:53:39 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper hg \
|
|
|
|
$(DL_DIR)/$($(PKG)_SOURCE) \
|
|
|
|
$($(PKG)_SITE) \
|
|
|
|
$($(PKG)_DL_VERSION) \
|
|
|
|
$($(PKG)_BASE_NAME)
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# TODO: improve to check that the given PKG_DL_VERSION exists on the remote
|
|
|
|
# repository
|
|
|
|
define SOURCE_CHECK_HG
|
|
|
|
$(HG) incoming --force -l1 $($(PKG)_SITE) > /dev/null
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_HG
|
|
|
|
echo $($(PKG)_SOURCE)
|
|
|
|
endef
|
|
|
|
|
2014-07-02 23:11:23 +02:00
|
|
|
|
2012-04-17 16:45:19 +02:00
|
|
|
define DOWNLOAD_WGET
|
|
|
|
test -e $(DL_DIR)/$(2) || \
|
2014-08-03 19:53:42 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper wget \
|
|
|
|
$(DL_DIR)/$(2) \
|
|
|
|
'$(call qstrip,$(1))' && \
|
2014-12-08 08:50:14 +01:00
|
|
|
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_RAWNAME).hash,$(DL_DIR)/$(2))
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SOURCE_CHECK_WGET
|
|
|
|
$(WGET) --spider '$(call qstrip,$(1))'
|
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_WGET
|
|
|
|
echo $(2)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define DOWNLOAD_LOCALFILES
|
2012-06-22 07:42:34 +02:00
|
|
|
test -e $(DL_DIR)/$(2) || \
|
2014-08-03 19:53:36 +02:00
|
|
|
$(EXTRA_ENV) support/download/wrapper cp \
|
|
|
|
$(DL_DIR)/$(2) \
|
|
|
|
$(call stripurischeme,$(call qstrip,$(1))) && \
|
2014-12-08 08:50:14 +01:00
|
|
|
$(call VERIFY_HASH,$(PKGDIR)/$($(PKG)_RAWNAME).hash,$(DL_DIR)/$(2))
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SOURCE_CHECK_LOCALFILES
|
2012-06-22 07:42:35 +02:00
|
|
|
test -e $(call stripurischeme,$(call qstrip,$(1)))
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define SHOW_EXTERNAL_DEPS_LOCALFILES
|
2012-06-22 07:42:34 +02:00
|
|
|
echo $(2)
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# DOWNLOAD -- Download helper. Will try to download source from:
|
|
|
|
# 1) BR2_PRIMARY_SITE if enabled
|
2012-06-22 07:37:03 +02:00
|
|
|
# 2) Download site, unless BR2_PRIMARY_SITE_ONLY is set
|
|
|
|
# 3) BR2_BACKUP_SITE if enabled, unless BR2_PRIMARY_SITE_ONLY is set
|
2012-04-17 16:45:19 +02:00
|
|
|
#
|
|
|
|
# Argument 1 is the source location
|
|
|
|
#
|
|
|
|
# E.G. use like this:
|
2014-03-02 18:51:34 +01:00
|
|
|
# $(call DOWNLOAD,$(FOO_SITE))
|
2012-04-17 16:45:19 +02:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
define DOWNLOAD
|
2014-03-02 18:51:34 +01:00
|
|
|
$(call DOWNLOAD_INNER,$(1),$(notdir $(1)))
|
2012-04-17 16:45:19 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
define DOWNLOAD_INNER
|
|
|
|
$(Q)if test -n "$(call qstrip,$(BR2_PRIMARY_SITE))" ; then \
|
|
|
|
case "$(call geturischeme,$(BR2_PRIMARY_SITE))" in \
|
2012-05-23 11:30:36 +02:00
|
|
|
scp) $(call $(DL_MODE)_SCP,$(BR2_PRIMARY_SITE)/$(2),$(2)) && exit ;; \
|
2012-04-25 03:45:16 +02:00
|
|
|
*) $(call $(DL_MODE)_WGET,$(BR2_PRIMARY_SITE)/$(2),$(2)) && exit ;; \
|
2012-04-17 16:45:19 +02:00
|
|
|
esac ; \
|
|
|
|
fi ; \
|
2012-06-22 07:37:03 +02:00
|
|
|
if test "$(BR2_PRIMARY_SITE_ONLY)" = "y" ; then \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
2012-04-17 16:45:19 +02:00
|
|
|
if test -n "$(1)" ; then \
|
2012-06-22 07:42:36 +02:00
|
|
|
if test -z "$($(PKG)_SITE_METHOD)" ; then \
|
|
|
|
scheme="$(call geturischeme,$(1))" ; \
|
|
|
|
else \
|
|
|
|
scheme="$($(PKG)_SITE_METHOD)" ; \
|
|
|
|
fi ; \
|
|
|
|
case "$$scheme" in \
|
2012-04-17 16:45:19 +02:00
|
|
|
git) $($(DL_MODE)_GIT) && exit ;; \
|
|
|
|
svn) $($(DL_MODE)_SVN) && exit ;; \
|
2013-09-11 14:12:04 +02:00
|
|
|
cvs) $($(DL_MODE)_CVS) && exit ;; \
|
2012-04-17 16:45:19 +02:00
|
|
|
bzr) $($(DL_MODE)_BZR) && exit ;; \
|
|
|
|
file) $($(DL_MODE)_LOCALFILES) && exit ;; \
|
|
|
|
scp) $($(DL_MODE)_SCP) && exit ;; \
|
|
|
|
hg) $($(DL_MODE)_HG) && exit ;; \
|
|
|
|
*) $(call $(DL_MODE)_WGET,$(1),$(2)) && exit ;; \
|
|
|
|
esac ; \
|
|
|
|
fi ; \
|
|
|
|
if test -n "$(call qstrip,$(BR2_BACKUP_SITE))" ; then \
|
|
|
|
$(call $(DL_MODE)_WGET,$(BR2_BACKUP_SITE)/$(2),$(2)) && exit ; \
|
|
|
|
fi ; \
|
|
|
|
exit 1
|
|
|
|
endef
|