Commit Graph

160 Commits

Author SHA1 Message Date
Robert Yang 6a92f7ede3 bitbake: fetch2/__init__.py: let try_mirror_url return correct value
The fetcher will try:

1) PREMIRROR
2) Upstream
3) MIRROR

If it fails to download from the Upstream, but succeeds from the MIRROR,
and ud.localpath != origud.localpath (for example, the git tarball),
then we will get the error (e.g.: xf86-video-omapfb):

ERROR: Function failed: Fetcher failure for URL: 'xxx'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /path/to/log.do_fetch.28024

It should not show the error and let the build go on since it succeeds.
(e.g.: xf86-video-omapfb)

[YOCTO #5686]

(Bitbake rev: 3bb3f1823bdd46ab34577d43f1e39046a32bca77)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-06 16:16:33 +01:00
Richard Purdie 8a5af7ff33 bitbake: fetch2: Fix mirror repo tarball creation
A typo was meaning that the mirror creation method wasn't being called
when it should have been. Fix the type to fix mirror tarball creation.

[YOCTO #5284]

(Bitbake rev: 66cdc2e21660847c50317e8bfd28cf3595422e28)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-06 16:16:33 +01:00
Martin Jansa e8dfafda71 bitbake: fetch2: Don't allow '/' in user:pass, fix branch containing '@'
* currently decode_url regexp parses branch=@foo as username so it ends like this:
  - ('git', '', 'foo', 'git.openembedded.org/bitbake;branch=', '', {})
  + ('git', 'git.openembedded.org', '/bitbake', '', '', {'branch': '@foo'})
* http://hg.python.org/cpython/file/2.7/Lib/urlparse.py also assumes
  that there is at least one '/' as separator between netloc and path,
  params, so it looks reasonable to prevent including '/' in username

(Bitbake rev: 3c694e20df3b1d442603300786580e4b2f4bf5f3)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-17 14:44:30 +00:00
Richard Purdie 53ce38bd0f bitbake: bitbake: fetch2: Fix handling of SCM mirrors in MIRRORS
If an SCM mirror is in PREMIRRORS, the tarball is downloaded and then found
by the "upstream" check and handled correctly.

If an SCM mirror is in MIRRORS, the tarball is downloaded but not used
since there is no "upstream" run after MIRRORS completes. It therefore
sits there useless and unused. This code change forces the upstream to
run after a mirror tarball is found and fixes the usage of SCM mirrors
in MIRRORS.

(Bitbake master rev: a66ee0994645aa5658b2f5ea134ed17d89f8751a)

(Bitbake rev: 98d2cd8576a8d035e2b073cd54bb737a3c22bc4d)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-11 14:16:03 +00:00
André Draszik d45486eb1c bitbake: fetch2: fix unpack of .xz files
If a file ends with .xz, it currently gets overwritten during unpack:
The decompress command for .xz files is:
  'xz -dc %s > %s' % (file, efile)
and as efile == file, we end up overwriting file (the source).

Fix this by adding .xz to the list of suffixes that that need to
be removed from a file name for an extract command, leaving the
bare file name. Now, for a given file foo.xz,
file == foo.xz and efile == foo, similar to how .gz .bz2 and .Z
files are treated.

(Bitbake rev: 2cd2d0a48e12ab4358fb967eaf7a56c17993f48d)

Signed-off-by: André Draszik <andre.draszik@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-31 06:59:59 +01:00
Peter Kjellerstedt 3a74f25cf1 bitbake: Correct a typo
(Bitbake rev: 087ec3a1b2dde04a8e5ce2943802fccd424ab3f3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-20 13:26:57 +01:00
Peter Kjellerstedt d1ad98b64b bitbake: Allow checksums to be used for files retrieved using SFTP
(Bitbake rev: fd438a334d1f90ff07dded61c9648987da42c34f)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-20 13:26:57 +01:00
Richard Purdie 801fbe5a0c bitbake: fetch2: Enhance error message for BB_NO_NETWORK
BB_NO_NETWORK can be set by bitbake internally by the use of
BB_FETCH_PREMIRRORONLY so update the error message to give users a
hint about this.

[YOCTO #3222]

(Bitbake rev: cac3060d0bf8c7deeacda18d06d92787911380d0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-20 13:10:47 +01:00
Richard Purdie cd7b7de91a bitbake: fetch2: Fix AUTOINC handling
AUTOINC was meant to appear once at the start of the version string.
The list of names may not be sorted meaning it could get inserted in
the middle. This patch simplifies the code and ensures it appears at
the start.

Include cache version bump to ensure the cache picks up these changes.

(Bitbake rev: ad8bf10d873abb94d987860a3f6d06b134fb8a99)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-14 12:52:56 +01:00
Richard Purdie 52d05125c1 bitbake: fetch2: Fix missing function call
Fix the issue:

File: '/srv/home/pokybuild/yocto-autobuilder-new/yocto-slave/build-appliance/build/bitbake/lib/bb/fetch2/__init__.py', lineno: 813, function: try_mirror_url
     0809:    except bb.fetch2.BBFetchException as e:
     0810:        if isinstance(e, ChecksumError):
     0811:            logger.warn("Mirror checksum failure for url %s (original url: %s)\nCleaning and trying again." % (newuri, origud.url))
     0812:            logger.warn(str(e))
 *** 0813:            self.rename_bad_checksum(ud, e.checksum)
     0814:        elif isinstance(e, NoChecksumError):
     0815:            raise
     0816:        else:
     0817:            logger.debug(1, "Mirror fetch failure for url %s (original url: %s)" % (newuri, origud.url))
Exception: NameError: global name 'self' is not defined

(Bitbake rev: 5f960017bb1d4274a5bd5b598971f38c12fc0f11)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-30 09:54:35 +01:00
Richard Purdie 7cf87fc083 bitbake: fetch2: Fix missing assignment
The assignment to True was missing from the code, well spotted Saul!

(Bitbake rev: e493fe8cb4953935f01361ffc0240e5818ebb283)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-24 10:34:53 +01:00
Richard Purdie 77fc40a0f8 bitbake: fetch2: Shorten long srcrevs
The long srcrevs are mainly used or the workdir construction as well as
the package version. The long entries are hashes generated by the git fetcher
and other scms using a similar revision mechanism.

We need these to change when the package changes however collisions are
unlikely to happen within the domains we care about. The long revisions
have generated negative user feedback due to the use in path and file
names.

This patch therefore truncates the revisions to 10 characters maximum.

This should be safe in the contexts where these revisions are used as
the chances of spatially close collisions is very low (distant
collisions are not a major issue in the way we use these).

(Bitbake rev: 43a8319cda7fae37862dae323eeb24cb39ca21b7)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-22 12:10:13 +01:00
Richard Purdie d228f9d938 bitbake: fetch2/git: Clean up sortable_revision
Now we no longer try and provide increasing values from the fetcher,
we can simplify the function structure for the sortable_revision
pieces and move the AUTOINC handling directly into the function
which needs it, simplifying the code.

(Bitbake rev: fb068bee47bb1a06f02447daf16c2b2a79c03288)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-22 12:10:12 +01:00
Richard Purdie 4d3a53ff36 bitbake: fetch2/utils: Clean up imports
Move various random imports to the start of the modules as cleanup
and avoid an import issue with bb.process on python 2.6.

(Bitbake rev: aed4adfbe3a591ca4f8e41fb763c9f961bf2e6d5)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-17 12:42:08 +03:00
Martin Jansa 07e83d04ac bitbake: fetch2: rename file with bad checksum instead of removing it completely
* this can be useful when someone wan't to compare old file with
  bad checksum and new one

(Bitbake rev: 33c6b93597dd43ab03ce7b62ba3eeb1893a68c38)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-15 15:57:31 +01:00
Richard Purdie a6c6a8ddb6 bitbake: bitbake/fetch: Add git submodules fetcher
This adds very basic git submodule support to the fetcher. It can be
used by replacing a git:// url prefix with a gitsm:// prefix, otherwise
behaviour is the same as the git fetcher. Whilst this code should be
functional, its not as efficient as the usual git fetcher due to the
need to checkout the tree to fetch/update the submodule information. git
doesn't support submodule operations on the bare clones the standard git
fetcher uses which is also problematic.

This code does however give a starting point to people wanting to use
submodules.

(Bitbake rev: 25e0b0bc50114f1fbf955de23cc0c96f5f7a41e3)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-25 15:58:31 +00:00
Richard Purdie 7d22ef28e6 bitbake: Revert "fetch2: Adapt encode/decode url to use URI class"
This reverts commit 21fe2683aefde10e847e66c11c26d4f4c1e07cfd
since bitbake-selftest doesn't pass when this is applied and
we're seeing multiple build failures from this change.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-19 23:07:23 -08:00
Matthew McClintock 72ebe0c34f bitbake: bitbake/fetch2: workaround urlparse in older python not support git
(Bitbake rev: 7e479dc6a574a8f3bd9f24d2ed1c3ceef91f3828)

Signed-off-by: Matthew McClintock <msm@freescale.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-19 14:33:05 -08:00
Olof Johansson 7b59a34360 bitbake: fetch2: Add SFTP fetcher
This fetcher differs from the SSH fetcher in that it adheres more
strictly to the SECSH URI internet draft --- it uses the sftp://
instead of the ssh:// scheme, and it uses sftp instead of scp.

(Bitbake rev: d240baeb7a4107d2eba3f08c411c0f086674d8e2)

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:05 +00:00
Olof Johansson dc9d989a5c bitbake: fetch2: Adapt encode/decode url to use URI class
(Bitbake rev: 21fe2683aefde10e847e66c11c26d4f4c1e07cfd)

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:05 +00:00
Olof Johansson 7feca4e11e bitbake: fetch2: Add a class representing a generic URI
A class representing a generic URI, with methods for accessing the URI
components, and stringifies to the URI. This class should be a bit more
flexible than the existing {encode,decode}_url functions in that it
supports more components (e.g. port) and that it does not rely on a
specific order on the return values. This makes it easy to add new
properties without affecting the API.

(Bitbake rev: bd824da8a7eafe27310e410807319628378caeca)

Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17 22:32:04 +00:00
Richard Purdie 55d17578d6 bitbake: fetch2: Ensure directory for stampfile exists before trying to create it
(Bitbake rev: cf510e3da36e53f98ca86501747364bf4699ecc1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15 16:17:48 +00:00
Richard Purdie 804d1d57a2 bitbake: fetch2: Improve lock/done stamp file paths for local files
Currently stamps end up at the top level of DL_DIR even if the files
themselves are in a directory structure. This patch preserves path
components allowing the top level directory to be less populated
which is an advantage for large sstate caches.

(Bitbake rev: 59921ce3ed7a4c0b7f8ef1a101ad9127469bf1fd)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15 12:12:36 +00:00
Richard Purdie d5ef2e5cc0 bitbake: fetch2: Ensure expansions happen in URL parameters in uri_replace
For example, this allows us to specify downloadfilename=PATH in sstate
mirror urls to improve directory structures in DL_DIR when using sstate.

(Bitbake rev: 7850a1364b6b37c58664d84f9c14806b4479b45c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15 12:12:36 +00:00
Darren Hart fe84fe0209 bitbake: fetch2: Remove broken git variables from the environment
The following variables perform no function outside of bitbake:

    GIT_CONFIG
    GIT_PROXY_HOST
    GIT_PROXY_PORT
    GIT_PROXY_IGNORE

GIT_CONFIG only affects the git-config command which is not relevant to
the fetcher. This was previously used with the OE GIT_CORE_CONFIG
variable which would provide a basic git config to use instead of the
user's config. This usage was deprecated by git for over a year now:

http://git.661346.n2.nabble.com/Overriding-gitconfig-using-GIT-CONFIG-td6680977.html

GIT_PROXY_HOST and GIT_PROXY_PORT are not used by git.

GIT_PROXY_IGNORE was an OE construct used to create the custom git
config and had no meaning outside of the OE environment. It is not used
by git.

Remove these variables from the fetcher environment.

Users wishing to configure git to work with a proxy should define the
GIT_PROXY_COMMAND environment variable to use an external script.
NO_PROXY can be used within this script to skip the proxy for certain
hosts.

(Bitbake rev: e60270bdce6b8c2f8da1a4838aa374da9db3c86a)

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06 13:13:01 +00:00
Darren Hart 3863dfce62 bitbake: fetch2: Export upper and lower case environment variables
Applications are inconsistent in their use of upper and lower case proxy
variables. Curl, for example, specifies NO_PROXY (not no_proxy) in the
man page (changed in 2009 [1]). Avoid proxy issues by ensuring both the
upper and lower case versions of each proxy variable is available in the
environment for the fetcher commands.

Add FTPS_PROXY and ftps_proxy to the list as well.

1. http://curl.haxx.se/mail/tracker-2009-04/0012.html

(Bitbake rev: c3e6b2c5ec81d5ad7dcf606fff16fd5552bd267c)

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06 13:13:01 +00:00
Darren Hart ee1f126ad5 bitbake: bitbake: fetch2: Print the complete SRCREV variable name when INVALID
If a particular SRCREV (say for a particular branch) is missing, the
fetcher will currently just report an obtuse error about the "SRCREV"
being invalid. If there is more information is to be had (say from name,
i.e. branch, and pn) then display that as well.

The new error looks something like this:

ERROR: ExpansionError during parsing /home/dvhart/source/poky/meta/recipes-kernel/linux/linux-yocto_3.4.bb: Failure expanding variable do_patch: ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure for URL: 'git://otcgit.jf.intel.com/dvhart/linux-yocto-minnow-3.4.git;protocol=git;nocheckout=1;branch=standard/minnow,meta,emgd-1.14;name=machine,meta,emgd'. Please set SRCREV_emgd_pn-linux-yocto to a valid value

Note the variable listed as invalid is
"SRCREV_emgd_pn-linux-yocto", making it explicit what is wrong.

(Bitbake rev: 63774f5b4edb999300bddd891233f6050f4af877)

Signed-off-by: Darren Hart <dvhart@linux.intel.com>
Cc: bitbake-devel@lists.openembedded.org
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-05 15:22:45 +00:00
Tyler Hall 0e408df69f bitbake: fetch2: Sort file checksums by value, not path
Changing the path to a file could change the task hash even if the file
still has the same checksum. This occurs when the task depends on
multiple files and the sort order of their paths changes. Usually the
sorting is consistent because layers tend to have the same relative
paths, but this should take care of other configuations.

The problem arose when using a .bbappend to add files to a recipe in
another layer. If the layer is located alongside the other layers and
their parent directory is moved, the hash does not change. However,
moving the .bbappend layer outside of the common directory can change
the path sort order and the task hash.

(Bitbake rev: 22bd19d208f0251f5a1f9b98f3cac66181f3fc07)

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-01-18 12:50:12 +00:00
Constantin Musca d0f35207f9 bitbake: fetch2: remove localcount and use AUTOINC instead
- do not use the BB_URI_LOCALCOUNT database for computing revision
incremental numbers anymore
- sortable_revision now generates "AUTOINC+${latest_rev}"
- use one incrementing value rather than several
- PV becomes 0.1+gitAUTOINC+deadbeefdecafbad_decafbaddeadbeef
- remove all localcount code and simplify the fetcher
- this patch addresses the following proposal:
http://lists.linuxtogo.org/pipermail/bitbake-devel/2012-November/003878.html

(Bitbake rev: 61cf01c5c236b4218f40cfae7c059c2b86765dbd)

Signed-off-by: Constantin Musca <constantinx.musca@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-12-17 17:42:19 +00:00
Richard Purdie 6a2ce81fc6 bitbake: fetch2: Avoid using FILESDIR in unpack
Currently there is code which uses FILESDIR in unpack to ensure
parent directories are created, leading to differing behaviour depending on
which search path is used to locate the directory.

This change standardises the code and takes the data from the fetcher in
question meaning we can standardise the code and deprecate FILESDIR.

(Bitbake rev: 1cccb3bd01ed82e4978acfef0fda1bd797eef72a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-11-26 10:01:24 +00:00
Robert Yang faaa0653c2 bitbake: fetch2: add "-d" option to cpio
Add "-d" option to cpio since it is useful:
  -d
  --make-directories
  Create leading directories where needed.

[YOCTO #3137]

(Bitbake rev: a78f9ded7896432b107f34c0bb608b389fdb676a)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-27 16:45:27 +01:00
Paul Eggleton 90b7683f78 bitbake: fetch2: improve error output for checksum failures
* Don't print the full exception in the initial warning - if we later
  succeed in fetching the file from a mirror, we won't usually need the
  details (which are in the fetch log if they are needed); otherwise the
  full error will be printed when the fetch operation fails. Also adjust
  the conditional block so that we don't print another warning just
  mentioning we're going to try mirrors.
* Call logger.error() so that with knotty the full log is not printed
* Provide an explanation around the lines we print for easily updating
  the checksums in the recipe. We don't want users to be just blindly
  updating the recipe in case of a transient failure or deliberately
  altered remote file.

(Bitbake rev: 2793413106c925b06783beb7413aa87cbcf246c3)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-24 12:13:52 +01:00
Paul Eggleton 683d3b9cfb bitbake: fetch2: make fetch failure errors more readable
Most of the time we don't need to see the fetch command; the fetch log
includes the command as a debug message in any case, so omit it. Also
adjust the way command output is printed (we don't need stderr/stdout
labelled, and print "no output" instead of "output:\nNone" when there is
no output.

(Bitbake rev: a75505a52e4da918222100221f79e8a658f90446)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-24 12:13:52 +01:00
Paul Eggleton 4d8ba9a0ec bitbake: fetch2: fix malformed URL causing a useless traceback
The implementation of NoMethodError and MalformedUrl was broken - if you
just set self.args in an exception class to a string it treats it as a
list and then fails later on with a TypeError due to the number of
arguments not matching up.

This nasty exception during exception handling was breaking the normal
exception flow (fixed separately), which meant that if you had a
malformed URL or invalid protocol in SRC_URI you would get the
following:

ERROR: Command execution failed: Traceback (most recent call last):
  File "/home/user/poky/poky/bitbake/lib/bb/command.py", line 84, in runAsyncCommand
    self.cooker.updateCache()
  File "/home/user/poky/poky/bitbake/lib/bb/cooker.py", line 1207, in updateCache
    if not self.parser.parse_next():
  File "/home/user/poky/poky/bitbake/lib/bb/cooker.py", line 1694, in parse_next
    logger.error('Unable to parse %s', value.recipe,
AttributeError: 'exceptions.TypeError' object has no attribute 'recipe'

A specific fix for [YOCTO #2977].

(Bitbake rev: 9d4150d99051d24ff218e8a43664ceaf524b19c7)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-10 13:14:08 +01:00
Paul Eggleton 5343cdb20e bitbake: fetch2: replace double slashes in paths in encodeurl()
This ensures that if all a MIRRORS entry does is add a slash, this does
not result in a circular loop.

Fixes [YOCTO #3073].

(Bitbake rev: 57055d337a2c9997a6e5d5bdabaec396e3e128e9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-07 14:50:04 +01:00
Robert Yang 7d8b49cfe4 bitbake: fetch2: unpack rpm, ipk and deb binary package
* Unpack the ".rpm" binary package (only .src.rpm in the past)

* Unpack the .deb and .ipk binary package, their unpack commands are the same.

* This is useful for binary package recipe.

[YOCTO #1592]

(Bitbake rev: de7ceb9459574f33920ccc06255b533434f0ec25)

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-09-07 12:10:42 +01:00
Martin Jansa 5d952ba4a0 bitbake: fetch2: print checksums when they are different then expected
* in form which can be copied into a recipe without modification
* like oe-classic did since:
  http://git.openembedded.org/openembedded/commit/?id=68abc465559a68e9201c9525be3c4acc6297eaed
* it shows them in right form when they are missing completely, but in
  more verbose form when different
* it needs to print that only when checksums were requested, e.g.
  fetching from sstate mirror sets both md5mismatch and sha256mismatch,
  but your checksums shouldn't be shown

(Bitbake rev: 9eb34fc866775fd8310759a0111f232a9dc98981)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02 17:05:06 +01:00
Christopher Larson 420891731f bitbake: fetch2: handle broken symlinks in local mirror handling
If a file:// mirror is being used, the fetcher will create a symlink to the
local file. However, if the local file gets removed, that link will be dead,
and os.path.exists() returns False in that case, so it tries and fails to
recreate the link. Now we unlink such a dead link if it exists.

(Bitbake rev: 229ed3857e826e3e215e843cb51f729c1e13ed37)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02 17:05:06 +01:00
Mark Hatle 9fb5c34750 bitbake: fetch2/__init__.py: Add NoChecksumError exception
Without the new exception, when the system is configured to use premirrors,
but not allow network access (via BB_NO_NETWORK), when a recipe was lacking a
checksum the wrong error message(s) were being generated.

Instead of complaining about trying to perform network access, if the system
was able to find the item in the premirror, it should inform the user of the
lack of checksums, and the two SRC_URI fields they should use to update their
recipe.

(Bitbake rev: cb10e9c03a3f96d94e27e18330009616dde5e2b3)

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-08-02 17:05:05 +01:00
Andrei Gherzan a3a697c425 bitbake: fetch2/__init__.py: Warn user if SRC_URI is using "proto" and not "protocol"
As well, if "proto" is used, get the associated value as "protocol"

(Bitbake rev: 53e6b630f0463d2d07cdaa9c9eb36794dc9b6b69)

Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-07-11 15:55:26 +01:00
Richard Purdie 18e3b500b9 bitbake: fetch2: Revert the regexp removal for the type field and instead anchor regexp
People are using regexps in the url type field so we need to preserve
this bitbake behaviour. To address the issues with https:// urls mapping
badly to file:// urls we anchor the regexp if its not already anchored.
There should be no expressions in the wild which would break with this
change.

(Bitbake rev: ce0579dc256251e523c6330641f98b9f5a0e5761)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-28 16:32:57 +01:00
Richard Purdie 72f04e760d bitbake: fetch2: Ensure star character doesn't end up in mirror tarball names
If '*' does end up in mirror urls accidently, some strange things
can break since supports_checksum() looks for this, ud.localpath can
then get ignored and this can lead to empty directories being downloaded
"successfully". '*' is a special case for file urls only at this point
so remove any entries that accidentlly make it in through url mapping.

(Bitbake rev: 1369bec2404d942acc3618a8d005ec6868dcfd41)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25 14:57:17 +01:00
Richard Purdie 9334b0d002 bitbake: fetch2: Add new mirror syntax to simplify mirror specifications
When writing mirror specifications, the current regexp syntax can be awkward
and hard to get it to do what you want. For example, extracting the 'basename'
of a repository:

PREMIRRORS = "git://.*/([^/]+/)*([^/]*) git://somewhere.org/somedir/\\2;protocol=file"

can now become:

PREMIRRORS = "git://.*/.* git://somewhere.org/somedir/BASENAME;protocol=file"

which is much clearer. A MIRRORNAME substitution is also added which contains
an encoded form of both host and path. One of the problems with the existing
regexp syntax is you couldn't access HOST information from PATH and vice-versa
which is an issue this patch also addresses.

Tests for the new syntax are also added.

(Bitbake rev: c6b1acbad7b3d2698530eb8b5249adb4ab95da21)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25 14:57:16 +01:00
Richard Purdie e63dada732 bitbake: fetch2: Handle errors orruring when building mirror urls
When we build the mirror urls, its possible an error will occur. If it
does, it should just mean we don't attempt this mirror url. The current
code actually aborts *all* the mirrors, not just the failed url.

This patch catches and logs the exception allowing things to continue.

(Bitbake rev: c35cbd1a1403865cf4f59ec88e1881669868103c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-25 14:57:16 +01:00
Richard Purdie df0059b465 bitbake: fetch2: Update replace_uri to handle uri types explicitly
For mirror mapping, we never use regexps for the type component of
the url. Doing so causes various slightly bizarre behaviour such as
https:// urls being translated to files:// urls which we have no handler
for. This patch forces the type matches to be direct, not regexp based
and gives the expected bahvriour.

(From Poky rev: 695d8aca0999d2d61970b990e83c3132ba6f12cb)

(Bitbake rev: 604df1b25cf114e083f52917df2df64e01279c25)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:34 +01:00
Richard Purdie a627fe5afe bitbake: fetch2: uri_replace() only consider ud.localpath where its a file
Using ud.localpath as a basename when it points at a directory causes
problems. The supports_checksum() method gives a good indication of whether
ud.localpath can be used in the way we need.

(From Poky rev: 933ec8a44634e33f92f6f76de3a34094c3d63aa6)

(Bitbake rev: dcd79ae20ab2c72c3312b2251c2b6dc4cabe988e)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:33 +01:00
Richard Purdie 548465141a bitbake: fetch2: uri_replace() improve mirrortarball handling
We only consider mirror tarballs when the source and target urls are of
differing types. We also should clear all url paramters when handling
mirror tarballs.

(From Poky rev: da140b8b0b3dda5429f9eee68829ef5247cdfe12)

(Bitbake rev: 7619dcad29a6c2405b15a8fbadfa11e81b399ae1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:33 +01:00
Richard Purdie 83bbfa07ab bitbake: fetch2: uri_replace() remove what amounts to a null operation and add some comments
(From Poky rev: 6d67200d052ba72258f5a0a178542ef99500a9cc)

(Bitbake rev: e67af4d12f390ce6083965509ca9ea85a76dc351)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:33 +01:00
Richard Purdie 196982a803 bitbake: fetch2: Add parameter handling to uri_replace()
This means that parameters in the source expression are used as part of the
match. Parameters in the destination are used explicitly in the final
url.

(From Poky rev: c465cb0c5c927dd41d96ad6d6fa1566349574bb7)

(Bitbake rev: 3c468ac3ed6d045561afce19b85ae9dd18d87cea)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:33 +01:00
Richard Purdie bf8501897b bitbake: fetch2: Remove basestring test and simplify uri_replace
(From Poky rev: d5657883d34bfef6beec594ac8d799f617b6b3ad)

(Bitbake rev: 84ffc261f376429b3a6b5d7bf2f6217cd10ca12a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2012-06-21 13:10:33 +01:00