Commit graph

67 commits

Author SHA1 Message Date
Arnout Vandecappelle b1679b745c pkg-download: enable hash check for git downloads
For a while already, our git downloaded tarballs are reproducible, so
we can actually check the hash for them.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-06-11 14:28:17 +02:00
Arnout Vandecappelle 8740f321fc pkg-download: fix fetching URLs with ? from PRIMARY/BACKUP
Some packages download files (especially patches) with a ? in the
URL. The ? marks the query part of the URL. However, the downloaded
file still contains the ? but from then on it doesn't designate a
query part anymore. Therefore, when fetching from PRIMARY or
BACKUP site over http, the server will report a 404 Not Found.

To fix, we need to replace the ? with %3F. Obviously, this should
be done only when fetching from PRIMARY or BACKUP. For fetching
from the real upstream, the ? really does designate the query part.

Fixes #9371.

Reported-by: Johan Derycke <johanderycke@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[Thomas: replace 'SECONDARY' by 'BACKUP'.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-10-23 14:51:16 +02:00
Thomas De Schampheleire 448d1d1e69 pkg-download: use raw basename for repo archiving to remove host- prefix
For packages that use a version control repository rather than a pre-made
tarball, the directory prefix used inside the tarball is currently
FOO_BASE_NAME, which can be 'foo' or 'host-foo'.

This means that the hash of such tarball will be different for target and
host packages, even though the contents are exactly the same. Hence, if the
hash file is created based on 'foo', and later a fresh build is made where
'host-foo' happens to be built before 'foo' (with a different config, for
example), the hash will be detected as incorrect and a new download is
started.

This problem does not affect many packages/users, due to the number of
conditions to be met:
- the package should be available for target _and_ host
- the package needs to use a VCS download method, e.g. git, hg, svn, ...
  This does not include standard github downloads, which download a pre-made
  archive.
- there should be a hash file containing the hash of the downloaded archive.
  Since normally there is no hash file for packages with sources coming from
  a version control system, this restricts even further. Some examples of
  packages in this category that do have a hash file (but not necessarily
  match the earlier conditions): expedite, vexpress-firmware, squashfs, ...
- the archive needs to be stored in a 'primary site' after initial archiving
  and thus be downloaded later using a non-version-controlled method, like
  wget or scp. This is because the version control download methods do not
  receive a '-H' parameter pointing to the hash file and thus no hashes are
  checked at all even if the file is present.

While packages matching the third condition could be considered to be 'wrong'
and need to be fixed, it does actually makes sense to have a hash file for
packages from version control, in particular if they are stored in a
primary site as mentioned in the last condition.

Regardless of any different opinions on the previous paragraph, it is also
not conceptually correct that a tarball of a package source can contain a
Buildroot-specific directory prefix 'host-'.  Therefore, use
FOO_RAW_BASE_NAME instead of FOO_BASE_NAME when calling the dl-wrapper.

Example test scenario that exhibits the problem:
$ rm -rf /tmp/dl dl/squashfs-9c1db6d13a51a2e009f0027ef336ce03624eac0d.tar.gz
$ make qemu_x86_64_defconfig
$ make host-squashfs-dirclean host-squashfs-source
$ mkdir /tmp/dl
$ mv dl/squashfs-9c1db6d13a51a2e009f0027ef336ce03624eac0d.tar.gz /tmp/dl/
$ sed -i -e 's,BR2_PRIMARY_SITE=.*,BR2_PRIMARY_SITE="file:///tmp/dl",' \
         -e '/BR2_PRIMARY_SITE/aBR2_PRIMARY_SITE_ONLY=y'  .config
$ make host-squashfs-dirclean host-squashfs-source

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-10-20 21:46:10 +02:00
Romain Perier 91b34e0abc pkg-download: Allow packages to pass generic options to download methods
Introduce a new package variable $(PKG)_DL_OPTS. When this variable
is defined, its value is passed to the downloader as options to
the underlying command. Packages can now retrieve archives from server
expecting logins and passwords, use referer url, proxy or specific
options for cloning a repository.

Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-23 14:59:01 +02:00
Yann E. MORIN ec3e057f79 core/pkg-infra: download git submodules if the package wants them
Add a new package variable that packages can set to specify that they
need git submodules.

Only accept this option if the download method is git, as we can not get
submodules via an http download (via wget).

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Aleksandar Simeonov <aleksandar@barix.com>
Tested-by: Matt Weber <matt@thewebers.ws>
Reviewed-by: Matt Weber <matt@thewebers.ws>
Tested-By: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-07-02 19:11:14 +02:00
Yann E. MORIN 5652374a0e core/pkg-download: ignore hashes from mirror for VCS downloads
When a download via a VCS method fails, Buildroot attempts the download
from the backup mirror (if any is set). Such a download is done with the
wget helper.

Given a package that has a .hash file for relase tarballs, which also
allows the user to use a random revision from a VCS, the normal download
wrapper will not check for hashes, on the assumption that maybe they are
not reproducible [*] (or user configurable).

However, when the download fails (for any reason: network error,
upstream removed the revision, old machine with incomplete set of CA
certificates...), the backup download now proceeds over with http (or
https) with the wget wrapper. The wget wrapper *always* checks for
hashes, and when a .hash file is present but no hash is found for the
download, this is considered an error.

However, when we download from the backup mirror for a main download that
should have been done with git/hq/svn/.., we in this situation have no hash
for the download.  Thus, we should not fail on a missing hash for that
download. Same situation if a primary site is used.

Add a test for the site-method in the DOWNLOAD_INNER macro; if it was either
one of the VCS method, pass a one-off BR_NO_CHECK_HASH_FOR variable set to
contain the tarball to download.

Fixes issues like those reported by the Travis build bots:
    https://travis-ci.org/buildroot/buildroot-defconfig-testing/jobs/123624879

[Peter: Move logic to beginning of DOWNLOAD_INNER so it also applies for BR2_PRIMARY_SITE]
Reported-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2016-04-20 23:37:19 +02:00
Jérôme Pouiller ef17d6f2cd pkg-download: do not test SITE_METHOD
SITE_METHOD is always set in inner-generic-package. So, it is useless
to test it in pkg-download.

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-12-18 10:08:21 +01:00
Jérôme Pouiller 4a9d98073e pkg-download: support 'file://' in BR2_PRIMARY_SITE
This feature was already discuted here:

  http://lists.busybox.net/pipermail/buildroot/2015-April/125419.html

Personally, I have a big central directory with all tarballs I have
ever downloaded. I use this feature to isolate tarballs necessary to
build a configuration:

  make project_defconfig
  make BR2_DL_DIR=/tmp/mirror-project BR2_PRIMARY_SITE=file:///home/user/dl source
  tar -C /tmp -czvf mirror-project.tgz mirror-project

Signed-off-by: Jérôme Pouiller <jezz@sysmic.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-11-19 23:03:42 +01:00
Baruch Siach ef92d32f19 support/download: relocate the git clone comment
Following commit 95a572282e (pkg-infra: move the git download helper to a
script, 2014-07-02), move the comment describing the shallow clone trickery as
well. Merge this comment with the existing helper comment that was added in
7e40a1103a (support/download: convert git to use the wrapper, 2014-08-03).

Rename $($(PKG)_DL_VERSION) to ${cset} to match the helper code context.

Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2015-05-31 11:56:56 +02:00
Yann E. MORIN 9fa6209fd2 pkg-infra: assign BR_NO_CHECK_HASH_FOR so it is recursively-expanded
Currently, assigning to BR_NO_CHECK_HASH_FOR but referencing variable
assigned to later, fails. Here's a failing test-case, which is the
reduced test-case of how we handle BR_NO_CHECK_HASH_FOR for now (warning
added for test-case):

    export BR_NO_CHECK_HASH_FOR
    BR_NO_CHECK_HASH_FOR += $(XENOMAI_SOURCE)
    XENOMAI_VERSION = 2.6.4
    XENOMAI_SOURCE = xenomai-$(XENOMAI_VERSION).tar.bz2
    $(warning BR_NO_CHECK_HASH_FOR='$(BR_NO_CHECK_HASH_FOR)')
    all:

Run it with simply make:

    $ make
    BR_NO_CHECK_HASH_FOR=' '

Now, change the first line to read:

    export BR_NO_CHECK_HASH_FOR =

And we now get:

    $ make
    BR_NO_CHECK_HASH_FOR=' xenomai-2.6.4.tar.bz2'

This new behaviour will be needed later for Xenomai, which handles the
version string in an unusual way, so we can exclude its custom versions.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-05-02 15:11:01 +02:00
Thomas Petazzoni 149bcb62ec pkg-download: fix indentation for SOURCE_CHECK_* macros
Some of the SOURCE_CHECK_* macros are using a non-standard two-spaces
indentation. This commit switches them to use a single tab based
indentation, like in the rest of Buildroot.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[with git show -w]
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-04-26 19:53:27 +02:00
Thomas Petazzoni b110b5264b pkg-download: get rid of DL_MODE
The DL_MODE variable is now no longer used with any other value than
"DOWNLOAD", so it no longer makes sense to have this variable at
all. Therefore, this commit gets rid of it.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-04-26 19:53:21 +02:00
Thomas Petazzoni 224a591d6f pkg-download: extend DOWNLOAD_INNER, add a SOURCE_CHECK macro
As part of moving to a package infrastructure based source-check
implementation, we are going to move away from the global DL_MODE
variable to select the behavior of the DOWNLOAD_INNER macro.

As a preparation to this, this commit makes the DOWNLOAD_INNER macro
take a third argument, which is the action to be done: either DOWNLOAD
or SOURCE_CHECK. For now, the DOWNLOAD macro passes $(DL_MODE) as this
third argument, in order to keep the existing behavior.

In addition, a SOURCE_CHECK macro is added, which calls DOWNLOAD_INNER
with the appropriate action. This macro will be used in the upcoming
package infra based implementation of source-check.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[tested by doing a "make source" on a randpackageconfig]
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2015-04-26 19:51:03 +02:00
Thomas Petazzoni a15ef6216e pkg-download: remove support for the SHOW_EXTERNAL_DEPS DL_MODE
Now that the external-deps implementation relies on the per-package
<pkg>-all-external-deps and <pkg>-external-deps targets and no longer
on the 'source' target with a custom DL_MODE, we can get rid of the
support for the SHOW_EXTERNAL_DEPS DL_MODE value in the pkg-download
logic.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2015-04-26 19:50:53 +02:00
Yann E. MORIN 8d2f4e6246 support/download: add possibility to not fail on missing hash
In very constrained cases, it might be needed to not fail if a hash is
missing. This is notably the case for custom external toolchains to be
downloaded, because we do have a .hash file for external toolchains,
but we obviously can not have hashes for all existing custom toolchains
(he, "custom"!).

So, add a way to avoid failing in that case.

>From the Makefile, we export the list of files for which not to check
the hash. Then, from the check-hash script, if no check was done, and
the file we were trying to match in in this exclusion list, we just exit
without error.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

changes v6 -> v7:
  - /beautify/ the pattern in the case clause

Changed v5 -> v6:  (Arnout)
  - fix the pattern in the case clause

Changes v4 -> v5:
  - micro-optimisation, use case-esac instead of a for-loop  (Arnout)
  - typoes  (Arnout)

Changes v3 -> v4:
  - drop the magic value, use a list of excluded files  (Arnout)

Changes v1 -> v2:
  - fix typoes in commit log

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-04-25 11:51:08 +02:00
Yann E. MORIN 1286222597 package infra: do not check hashes when downloading from a repository
When downloading from a repository, we have no way to ensure the
reproducibility of the generated archives, so we can't check the hashes.

Do not specifiy a hash file in those cases.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-04-03 14:08:00 +02:00
Yann E. MORIN 4dc54da061 package/pkg-download: do not hard-code QUIET
Do not hard-code QUIET in our download commands, since it is handled in
the backends.

Suggested by Fabio.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-01-04 18:40:05 +01:00
Fabio Porcedda 0b600227b0 pkg-download: silence downloads if make is silent
If doing a silent build (make -s -> QUIET=-q), silence all downloads,
by passing the -q flag downward to backends as well as to check-hash.

Change a printf to use the trace functions.

Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-01-04 18:39:46 +01:00
Yann E. MORIN 9b88c60484 pkg-download: verify the hashes from the download wrapper
Instead of repeating the check in our download rules, delegate the check
of the hashes to the download wrapper.

This needs three different changes:

  - add a new argument to the download wrapper, that is the full path to
    the hash file; if the hash file does not exist, that does not change
    the current behaviour, as the existence of the hash file is checked
    for in the check-hash script;

  - add a third argument to the check-hash script, to be the basename of
    the file to check; this is required because we no longer check the
    final file with the final filename, but an intermediate file with a
    temporary filename;

  - do the actual call to the check-hash script from within the download
    wrapper.

This further paves the way to doing pre-download checks of the hashes
for the locally cached files.

Note: this patch removes the check for hashes for already downloaded
files, since the wrapper script exits early. The behaviour to check
localy cached files will be restored and enhanced in the following
patch.

[Thomas: fix minor typo in comment.]

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-12-11 23:59:25 +01:00
Yann E. MORIN 2685937e06 pkg-download: check for already downloaded file in the download wrapper
Instead of repeating the same test again and again in all our download
rules, just delegate the check for an already downloaded file to the
download wrapper.

This clears up the path for doing the hash checks on a cached file
before the download.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Gustavo Zacarias <gustavo@zacarias.com.ar>
Reviewed-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-12-11 23:58:44 +01:00
Yann E. MORIN 78b92e5055 support/download: add option parsing to the download wrapper
Instead of relying on argument ordering, use actual options in the
download wrapper.

Download backends (bzr, cp, hg...) are left as-is, because it does not
make sense to complexify them, since they are almost very trivial shell
scripts, and adding option parsing would be really overkill.

This commit also renames the script to dl-wrapper so it looks better in
the traces, and it is not confused with another wrapper.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-12-11 23:58:37 +01:00
Peter Korsgaard cf902845e7 pkg-download: VERIFY_HASH: use same hash file for host and target downloads
Fixes (or atleast stops the build with a saner description):
http://autobuild.buildroot.net/results/1a9/1a9643f8633db038d4fe5ca4a32e4d52e70a3a1a/

We're using the same sources for host and target downloads, so it makes
sense to use the same <pkg>.hash file as well to ensure the host version
gets verified without us having to maintain a seperate host-<pkg>.hash file.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-12-08 08:52:25 +01:00
Peter Korsgaard b7c1c3ba6a check-hash: silence hash ok messages when make -s is used
Similar to what we do for apply-patches.sh

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-10-25 01:42:49 +02:00
Thomas De Schampheleire f268f7131b .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 15:00:28 +02:00
Yann E. MORIN 9a8470c9ee support/download: convert wget to use the wrapper
This drastically simplifies the wget helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by running 'make busybox-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:25 +02:00
Yann E. MORIN a92290aa20 support/download: convert svn to use the wrapper
This drastically simplifies the svn helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by running 'make open2300-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:25 +02:00
Yann E. MORIN 5b3880e174 support/download: convert scp to use the wrapper
This drastically simplifies the scp helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by setting a primary site to 'scp://localhost:/tmp' and
running 'make vim-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:25 +02:00
Yann E. MORIN 93e678b767 support/download: convert Hg to use the wrapper
This drastically simplifies the hg helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by running 'make vim-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:24 +02:00
Yann E. MORIN 7e40a1103a support/download: convert git to use the wrapper
This drastically simplifies the git helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by running 'make fmc-fsl-sdk-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:24 +02:00
Yann E. MORIN 389f50dfb6 support/download: convert cvs to use the wrapper
This drastically simplifies the cvs helper, as it no longer has to deal
with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:24 +02:00
Yann E. MORIN 84469226c1 support/download: convert localfiles to use the wrapper
This drastically simplifies the localfiles helper, as it no longer has
to deal with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
(Tested by setting BUSYBOX_SITE = file:///tmp and running 'make busybox-source')
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:24 +02:00
Yann E. MORIN c48d45e342 support/download: convert bzr to use the wrapper
This drastically simplifies the bzr helper, as it no longer has to
deal with atomically saving the downloaded archive.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-04 20:12:24 +02:00
Andreas Naumann 402a537b35 pkg-download: Fix DOWNLOAD_LOCALFILES
The cp helperscript expects a filename as target, but just the folder
name was given.

Signed-off-by: Andreas Naumann <anaumann@ultratronik.de>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2014-07-18 20:01:46 +02:00
Yann E. MORIN 9bd8b59526 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-04 23:35:19 +02:00
Yann E. MORIN 283b8b7fea pkg-infra: move the cp (aka localfiles) download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 00:07:57 +02:00
Yann E. MORIN 54adff55d5 pkg-infra: move the scp download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 00:07:12 +02:00
Yann E. MORIN 45261f1fb7 pkg-infra: move the bzr download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 00:03:59 +02:00
Yann E. MORIN 4bee7629ee pkg-infra: move the wget download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-03 00:00:15 +02:00
Yann E. MORIN 2fd4b959bd pkg-infra: move the hg download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Tested-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[tested a particular scenario that used to fail, when the 'hg archive'
step is interrupted, now working fine]
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-02 23:59:10 +02:00
Yann E. MORIN f4526c053f pkg-infra: move the cvs download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-02 23:54:16 +02:00
Yann E. MORIN daf034f881 pkg-infra: move the svn download helper to a script
Maintaining the download helpers in the Makefile has proved to be a bit
complex, so move it to a shell script.

[Peter: redirect pushd/popd output to /dev/null]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-02 23:51:56 +02:00
Yann E. MORIN 95a572282e pkg-infra: move the git download helper to a script
The git download helper is getting a bit more complex. Fixing it in the
Makefile when it breaks (like the recent breakage with a non-existing
sha1-cset) proves to be challenging, to say the least.

Move it into a shell script in support/download/git, which will make
it much easier to read, maintain, fix and enhance in the future.

[Peter: redirect pushd/popd output to /dev/null]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Luca Ceresoli <luca@lucaceresoli.net>
Cc: Arnout Vandecappelle <arnout@mind.be>
Reviewed-by: Samuel Martin <s.martin49@gmail.com>
Reviewed-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-07-02 23:47:13 +02:00
Ryan Barnett fa9f824c38 pkg-download: fix svn download for deleted path
If a SVN path has been deleted in a future revision, downloading a
package's source will fail using 'svn checkout -r'. Fix using
URL@REV syntax since the SVN command will then verify the path at the
specified version. Without using the URL@REV syntax, the SVN command
will attempt to verify the path exists on the the HEAD revision before
checking out the path at the specified revision.

Error seen if SVN path has been deleted in HEAD using svn checkout -r:
  svn: E160013: '/svn/path/' path not found

Signed-off-by: Ryan Barnett <ryan.barnett@rockwellcollins.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-06-29 10:42:51 +02:00
Simon Dawson 3b8e4fb4aa replace github with GitHub
The correct capitalisation pattern is "GitHub"; fix manual and makefile
commentary.

Signed-off-by: Simon Dawson <spdawson@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-06-04 23:14:08 +02:00
Samuel Martin 507d6a637b pkg-download: update the github helper
Once again, github updates the source download url.
Even if only the zip archive link is advertised on the repositories'
page, the *.tar.gz is still available.

It is worthy to note that the tarball's content differs depending if
it has been fetched from the former and the new url (the root directory
name changes).

Signed-off-by: Samuel Martin <s.martin49@gmail.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-04-06 14:32:37 +02:00
Yann E. MORIN 18edb40bf5 pkg-infra: DOWNLOAD is never called with two arguments
Currently, the DOWNLOAD helper accepts one or two arguments:
  - the source URI
  - the source filename; if missing, it is derived from the URI

But we have no caller of DOWNLOAD that passes a second argument.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-03-02 21:01:40 +01:00
Arnout Vandecappelle af97c94b70 Makefile.legacy: fix recursive invocation with BUILDROOT_DL_DIR and _CONFIG
The legacy support for the old BUILDROOT_DL_DIR and BUILDROOT_CONFIG
breaks down when make is invoked recursively - which is done in a few
cases, e.g. silentoldconfig, external-defs, ... These targets always
give a legacy error.

For BUILDROOT_DL_DIR, this is fixed by making sure that the original
value of BR2_DL_DIR taken from the environment is also exported again.

For BUILDROOT_CONFIG, this is fixed with an additional comparison of
the environment variable's value with the fake value that we introduce
ourselves.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-11 08:14:57 +01:00
Arnout Vandecappelle 6768021c93 infra: replace BUILDROOT_DL_DIR with BR2_DL_DIR.
To make the naming consistent (all user-visible options should be
prefixed BR2_).

An entry is added to Makefile.legacy to warn users who have set
BUILDROOT_DL_DIR but not BR2_DL_DIR.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-09 11:02:42 +01:00
Thomas Petazzoni fecf5b522b pkg-download: make sure git downloads fail for unknown versions
The current git download helper creates the tarball by doing:

    git archive <version> | gzip -c > <tarball>

Unfortunately, even if "git archive" fails and returns a non-zero
error code, gzip ignores that, compresses nothing, and returns success
(zero error code). The consequence of this behavior is that when the
git version provided in the package is incorrect, we are not failing
during the download step, but later on when trying to extract the
tarball (which was incorrectly created as a result of the failing git
archive).

To fix this, we change the tarball creation logic to:

   git archive -o <tarball>.tmp <version> &&
   gzip -c <tarball>.tmp > <tarball> &&
   rm -f <tarball>.tmp

If the build is interrupted during the "gzip" command, we may leave
the .tmp file behind us, but this also happens with wget downloads,
and is generally not considered a problem, since this temporary file
will be overwritten next time we attempt to do download this package.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2014-02-04 15:15:48 +01:00
Mathias De Maré a10073b6b0 package: make package download from Mercurial repositories more robust
Previously, when cloning a Mercurial repository,
aborting the clone could (in some cases) leave behind an empty directory.
As a result, a later clone would fail.

Signed-off-by: Mathias De Maré <mathias.demare@gmail.com>
Acked-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2013-12-25 12:36:39 +01:00