summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/__init__.py
AgeCommit message (Collapse)Author
2014-04-29fetch2: Cleanup file checksum generation, v2Jacob Kroon
The initial version of this patch was reverted in 0a94e568152de550dedc8135a766beb18bf064ab However, it was later agreed upon that it was reverted due to a misunderstanding during code review; the patch is ok. This version of the patch also removes an unneeded initialization of the 'checksum' variable outside the scopes it is being used in. Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-28Revert "fetch2: Cleanup file checksum generation"Richard Purdie
This reverts commit 6dfb33fd7204e09815bde7ba5bf21941a73fe965. It causes an unindeded change in behaviour.
2014-04-27fetch2: Cleanup file checksum generationJacob Kroon
Cleanup the fix done in f9416e76e272ba3249abff099f6f3a47fe82e03e. Instead of adding continue statements we can just move the last statements into the final else-clause. Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08fetch2: fix traceback when a wildcard matches a directoryPaul Eggleton
If there is a directory matching a wildcard in SRC_URI when getting file checksums, we should recurse into that instead of producing an error. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08fetch2: handle wildcards correctly when recording file checksumsPaul Eggleton
The Local fetcher's localpath is returning the parent directory for a wildcard match; we need to handle this and add the wildcard specification so that we checksum the correct files. Fixes [YOCTO #6127]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-08fetch2: avoid cache ignoring missing filesPaul Eggleton
Previously, if a file listed in SRC_URI was missing at the time of parsing, and then was added and bitbake run again, it would not be picked up because the recipe was cached without it. If we allow the file to be added to the list of files to checksum, then it will be checked for and found on the second run. Fixes [YOCTO #4790]. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-04-06fetch2: Fix bug in file checksum generationRichard Purdie
For a while its been puzzling me why connman-gnome rebuilds as often as it does. It turns out you can trigger this with a new checkout of the metadata. The SRC_URI that is causing the problems is: SRC_URI = "file://images/*" and rather oddly the results in checksums for a file "." being added to the tree, e.g.: ('.', 'ab48a68186f0e0f277c21ef4cb390b4b') The problem is that when iterating files lists, the checksum variable can become set yet we don't break the out from the for loop, which leads to odd (and non-deterministic) entries being added into the file checksum list. The exact item added probably depends on the order of items on the disk. Before this change, bitbake-diffsigs on connman-gnome:do_fetch would report: This task depends on the checksums of files: [ ('connman-signal-03.png', 'f6c16aee57b37b73793a2f1dea433ffa'), ('connman-signal-02.png', 'ad0cd22710c097d8174121fc1023c3be'), ('connman-signal-01.png', '8842bd83d2fa9ba56480df34c727c629'), ('null_check_for_ipv4_config.patch', 'a23271e41c9fe81551244d875106af10'), ('connman-signal-05.png', '808589e7e8d502b44c7b007e9e68d48c'), ('connman-signal-04.png', 'ab48a68186f0e0f277c21ef4cb390b4b'), ('null_check_for_ipv4_config.patch', 'a23271e41c9fe81551244d875106af10'), ('0001-Removed-icon-from-connman-gnome-about-applet.patch', 'e2d8269357c1e8c84291606da24eea85'), ('0001-Removed-icon-from-connman-gnome-about-applet.patch', 'e2d8269357c1e8c84291606da24eea85'), ('.', 'ab48a68186f0e0f277c21ef4cb390b4b')] Afterwards: This task depends on the checksums of files: [ ('connman-signal-03.png', 'f6c16aee57b37b73793a2f1dea433ffa'), ('connman-signal-02.png', 'ad0cd22710c097d8174121fc1023c3be'), ('connman-signal-01.png', '8842bd83d2fa9ba56480df34c727c629'), ('null_check_for_ipv4_config.patch', 'a23271e41c9fe81551244d875106af10'), ('connman-signal-05.png', '808589e7e8d502b44c7b007e9e68d48c'), ('connman-signal-04.png', 'ab48a68186f0e0f277c21ef4cb390b4b'), ('null_check_for_ipv4_config.patch', 'a23271e41c9fe81551244d875106af10'), ('0001-Removed-icon-from-connman-gnome-about-applet.patch', 'e2d8269357c1e8c84291606da24eea85'), ('0001-Removed-icon-from-connman-gnome-about-applet.patch', 'e2d8269357c1e8c84291606da24eea85')] which is correct and deterministic without the "." entry. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24fetch2.URI: Set username/password should not change the otherOlof Johansson
When setting the username after already having set the password, the password was unexpectedly reset. This change fixes this issue and introduces unit tests to make sure it doesn't happen again. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24fetch2.URI: Support URIs with both query strings and paramsOlof Johansson
There is a case in meta-intel where a SRC_URI contains both a query string and URI parameter: https://edc.intel.com/Download.aspx?id=6190;downloadfilename=LIN_IEMGD_1_14_GOLD_2443.tgz Python's urlparse thought the URI parameters were part of the query parameter value, but in the bitbake context this is obviously not the case. As bitbake's usage isn't really RFC compliant, we have to extract and remove the URI parameters *before* urlparse sees the URI. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24fetch2.URI: add support for query parametersOlof Johansson
This change introduces the .query property of the URI class. It is a read/write dict of the parameters supplied in the query string of the URI. E.g.: http://example.com/?foo=bar => .query = {'foo': 'bar'} Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-24fetch2.URI: Coerce urlparse to use netloc for all schemesOlof Johansson
Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-03-02fetch2: Drop svk fetcherRichard Purdie
The svk fetcher never appears to be used by anyone and the development on svk appears to have stopped in 2010. We might as well drop support for it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-02-24fetch2: Fix mirror repo tarball creationRichard Purdie
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] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-20fetch2: Improve invalid SRCREV error messageRichard Purdie
The current message can be ambiguous, improve it (and also rename a variable to clean up the rest of the function). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-20fetch2: Sanity check SRCREV matches rev/tag parameterRichard Purdie
Add a sanity check so that if some SRCREV is set and a rev parameter is given to the url, the revision given should match. Any tag parameter behaves the same as rev. If both are specified, error to tell the user we're confused rather than do something which may or may not be what they intended. Also add some unittests for this. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-20fetch2: Clean up srcrev_internal_helperRichard Purdie
Currently INVALID and None are checked as incorrect values under different circumstances. This code standardises those checks to be consistent. We should phase out the use of "INVALID". Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-19fetch2/__init__.py: let try_mirror_url return correct valueRobert Yang
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] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-18fetch2: Don't allow '/' in user:pass, fix branch containing '@'Martin Jansa
* 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 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-08bitbake: gitannex.py: Add Git Annex supportOtavio Salvador
This add a Git Annex backend which reuses the Git fetcher code; it allows managing files with git, without checking the file contents into git, being useful when dealing with files larger than git can currently easily handle, whether due to limitations in memory, time, or disk space. Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-02bitbake: fetcher2: clean(): remove the .patch.doneRobert Yang
There was a problem: $ bitbake xf86-video-omapfb -cfetch && bitbake xf86-video-omapfb -ccleanall Everything should be removed, but the 0006-omapfb-port-to-new-xserver-video-API.patch.done still exists in the DL_DIR, this is because the clean() in the fetch2/__init__.py skips removing the local file, so that it will skip removing the .done. The local file (file://) isn't needed to be removed since it is not downloaded into DL_DIR, but the .done should be removed, this patch will remove the .done, and it doesn't remove anything else since the clean() in local.py does nothing. [YOCTO #5687] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-01-02bitbake: replace 3 spaces with 4Robert Yang
A part of fetch2/__init__.py uses 3 spaces as the indent, I think that they should be typos. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-22fetch2: avoid printing "no checksum" error message twicePaul Eggleton
Because of the way we were handling this error, it was printed twice - once via logger.error() (to avoid the log being printed) and a second time when the exception gets wrapped in a FuncFailed at a higher level. Call logger.error() earlier and change the text we send in the exception to be more brief, so it more closely resembles the behaviour when there is an invalid checksum. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-12-22fetch2: fail checksum validation if SRC_URI checksums set to ""Paul Eggleton
We were checking SRC_URI md5sum/sha256sum values against None here, so if they were set to "" then no error was produced. Since the value is still effectively unset in this case, this is not the right behaviour; just check if the value doesn't evaluate to False instead. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-21fetch2: Stop passing around the pointless url parameterRichard Purdie
There is no good reason to keep passing around the url parameter when its contained within urldata (ud). This is left around due to legacy reasons, some functions take it, some don't and its time to cleanup. This is fetcher internal API, there are a tiny number of external users of the internal API (buildhistory and distrodata) which can be fixed up after this change. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-21fetch2: Clean up some url parameters to functionsRichard Purdie
urldata contains the url so we might as well stop passing around pointless function parameters. This was done for legacy reasons but its time to clean this mess up. This is a first step in cleanup and is a standalone patch but there is more to be done in a second patch. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-11-19fetch2: Fix handling of SCM mirrors in MIRRORSRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-07-31fetch2: fix unpack of .xz filesAndré Draszik
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. Signed-off-by: André Draszik <andre.draszik@linaro.org> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-20Correct a typoPeter Kjellerstedt
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-20Allow checksums to be used for files retrieved using SFTPPeter Kjellerstedt
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-19fetch2: Enhance error message for BB_NO_NETWORKRichard Purdie
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] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-06-12fetch2: Fix AUTOINC handlingRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-30fetch2: Fix missing function callRichard Purdie
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 Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-23fetch2: Fix missing assignmentRichard Purdie
The assignment to True was missing from the code, well spotted Saul! Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-20fetch2: Shorten long srcrevsRichard Purdie
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). Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-20fetch2/git: Clean up sortable_revisionRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-05-17fetch2/utils: Clean up importsRichard Purdie
Move various random imports to the start of the modules as cleanup and avoid an import issue with bb.process on python 2.6. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-04-15fetch2: rename file with bad checksum instead of removing it completelyMartin Jansa
* this can be useful when someone wan't to compare old file with bad checksum and new one Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-03-25bitbake/fetch: Add git submodules fetcherRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-19Revert "fetch2: Adapt encode/decode url to use URI class"Richard Purdie
This reverts commit 21fe2683aefde10e847e66c11c26d4f4c1e07cfd since bitbake-selftest doesn't pass when this is applied and we're seeing multiple build failures from this change.
2013-02-19bitbake/fetch2: workaround urlparse in older python not support gitMatthew McClintock
Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17fetch2: Add SFTP fetcherOlof Johansson
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. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17fetch2: Adapt encode/decode url to use URI classOlof Johansson
Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-17fetch2: Add a class representing a generic URIOlof Johansson
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. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15fetch2: Ensure directory for stampfile exists before trying to create itRichard Purdie
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15fetch2: Improve lock/done stamp file paths for local filesRichard Purdie
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-15fetch2: Ensure expansions happen in URL parameters in uri_replaceRichard Purdie
For example, this allows us to specify downloadfilename=PATH in sstate mirror urls to improve directory structures in DL_DIR when using sstate. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06fetch2: Remove broken git variables from the environmentDarren Hart
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. Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-06fetch2: Export upper and lower case environment variablesDarren Hart
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 Signed-off-by: Darren Hart <dvhart@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2013-02-05bitbake: fetch2: Print the complete SRCREV variable name when INVALIDDarren Hart
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. 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-01-18fetch2: Sort file checksums by value, not pathTyler Hall
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. Signed-off-by: Tyler Hall <tylerwhall@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>