summaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch2/__init__.py
AgeCommit message (Collapse)Author
2016-05-10bb/fetch2: drop checksum cachemarquiz/bitbake/checksum-refactorMarkus Lehtonen
It is not used for anything, anymore. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-05-10Move file checksum cache out of SignatureGeneratorMarkus Lehtonen
Just utilize the checksum cache in bb.fetch2 as it is not used for anything else. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
2016-05-06bitbake: fetch2: Safer check for BB_ORIGENV datastoreLeonardo Sandoval
BB_ORIGENV value on the datastore can be NoneType thus raising an AttributeError exception when calling the getVar method. To avoid this, a check is done before accesing it. [YOCTO #9567] Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-26fetch2: export DBUS_SESSION_BUS_ADDRESS to support authentication agentsRoss Burton
Some users may want to use authenticated SSH connections with credentials stored in a keyring, such as gnome-keyring. These typically need a DBus session bus connection, so pass DBUS_SESSION_BUS_ADDRESS into the fetcher environment. To avoid the user needing to set it in their local.conf (which wouldn't be usable) or adding it to the environment-cleansing whitelist (which would potentially impact builds) allow the variables being passed to the fetchers to come from the data store (first) or the original environment (second). Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-04-02fetch2: BB_ALLOWED_NETWORKS should not care about port numbersOlof Johansson
Bitbake would fail to classify the following URL as belonging to a allowed network, because of the port number in the url. BB_ALLOWED_NETWORKS = "*.example.com" SRC_URI = "http://git.example.com:8080/foo.tar.gz" Since protocols aren't specified in the BB_ALLOWED_NETWORKS variable, it's reasonable to believe that this should work regardless of protocol being used. Signed-off-by: Olof Johansson <olof.johansson@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-30fetch2: Ensure that incorrect checksumed files are always renamedRichard Purdie
There are some codepaths where the file checksum is verified and can be found to mismatch but the 'rename' logic doesn't kick in. If code relies on the presence of a file for the checksum having been checked (e.g. uninative.bbclass) then it can be used when the checksum hasn't matched. Therefore rename the file whenever an invalid checksum is encountered. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-24fetch2: Handle lockfiles for file:// urls redirected to mirrorsRichard Purdie
We recently dropped lockfiles for file:// urls which in itself makes sense. If a file url redirects to something like an http:// mirror, we'd have no lock taken for the original file and could race against others trying to download the file. We therefore need to ensure there is a lock taken in the mirror handling code. This adds code to take such a lock, assuming it isn't the same lock as the parent url. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-23cache: Make BB_DONT_CACHE variable externalMarkus Lehtonen
This makes it possible to prevent a recipe to be cached, and thus, parsed every time. Use with care. [YOCTO #8853] Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-09fetch2: Make SRC_URI[md5sum] and SRC_URI[sha256sum] expand their valuesPeter Kjellerstedt
For some reason, the values for SRC_URI[md5sum] and SRC_URI[sha256sum] were not being expanded. That lead to the following code not working as expected: SRC_URI = "http://.../${PN}-${PV}.tar.gz" MD5SUM = "123abc..." SHA256SUM = "abcd1234..." SRC_URI[md5sum] = "${MD5SUM}" SRC_URI[sha256sum] = "${SHA256SUM}" Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-02fetch2: Fix unpack for absolute file urlsRichard Purdie
The previous commit breaks absolute pathnames in file:// urls, this fixes it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-03-02fetch2: fixes copying of file://dir; subdir=foo, bug 6128 and bug 6129Alexander Shashkevich
When in SRC_URI appears file://dir;subdir=foo unpacker copies 'dir' to ${WORKDIR}, not ${WORKDIR}/foo as it should be. These changes are fixing following bugs as well: Bug 6128 - Incorrect wildcard unpack behaviour in fetcher Bug 6129 - Local directories unpack to a different location than local files Signed-off-by: Alexander Shashkevich <alex@stunpix.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28fetch2/npm: Enable fetcherRichard Purdie
For some reason the enablement piece of the patch went missing, add it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28fetch2: Skip lockfiles and donestamps for local filesRichard Purdie
For local files, there are no races with downloads, we don't need ".done" stamps and we don't need lockfiles. This considerably cleans up DL_DIR and all the pointless ".done" files as well as removes stalls over local files with the same name. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28fetch2/__init__.py: Error if lockfile path invalidRichard Purdie
Rather than create ".lock" and ".done" files with no name, error, forcing us to fix the cases where this is a problem. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-28fetch2/__init__: Fix decodeurl to better handle urls without pathsRichard Purdie
If we specify urls such as npm://somehost;someparams the fetcher currently does a poor job of handling mirrors of these urls due to deficiencies in the way decodeurl works. This is because "somehost" is returned as a path, not a host. This tweaks the code so that unless its a file url, the host is returned correctly. This patch also adds test cases for these urls to the exist set of test urls. We need to tweak the URI() class since this thinks this is a relative url which is clearly isn't. We also need to handle the fact that encodeurl will error if passed a url of this form (it would want the path to be '/'. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-18FileChecksumCache: add get_checksums() methodMarkus Lehtonen
Move the local file checksum functionality from bb.fetch2 into bb.checksum module. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-18bb/cache: drop some unused argumentsMarkus Lehtonen
Drop unused 'd' argument from the cache save methods, simplifying the API. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-02-04lib/bb: Add expansion parameter to getVarFlagRichard Purdie
This sets the scene for removing the default False for expansion from getVarFlag. This would later allow True to become the expand default. On the most part this is an automatic translation with: sed -e 's:\(\.getVarFlag([^,()]*, [^,()]*\)):\1, False):g' -i `grep -ril getVar *` There should be no functional change from this patch. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-29fetch2: Simplify logic in verify_checksum()Peter Kjellerstedt
The recent change to verify_checksum() to only show checksum warnings if no checksums are supplied made it possible to simplify the logic a bit more. Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-22fetch2: Don't show checksum warnings if a single checksum was suppliedRichard Purdie
If one checksum is supplied to a SRC_URI, we really don't want to show warnings about the other type which isn't present as one checksum is really good enough for most cases. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2016-01-05fetch2/__init__.py: Add support for 7-ZipJuro Bystricky
7-Zip is a file archiver claiming the highest compression ratio. This patch allows using 7-Zip commpressed files in bitbake recipes. Two common formats are supported: SRC_URI = "file://abc.tar.7z" SRC_URI = "file://abc.7z" Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-12-17fetch: use orig localpath when calling orig methodChristopher Larson
When a mirror tarball is fetched, the original fetch method is called, which unpacks the mirror tarball. After the original method is called, it checks the localpath of the mirror tarball rather than the clone path, which isn't ideal, particularly if the mirror tarball was removed due to being out of date. We know the original fetch method will do what it needs to do to get its content in the form it needs from the mirror tarball, so we can use its localpath instead. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Awais Belal <awais_belal@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-11-16fetch2: Remove crazy code in unpackRichard Purdie
This looks reasonable until you realise self.localpath is a function. Data expansion of something which isn't a string is the original value so this code just wastes CPU cycles and makes no sense. Remove it. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18tests/fetch.py: Fix recursion failure in url mappingMark Hatle
Instead of reproducessing the same line over and over and over, we remove the current line from the mirror list. This permits us to re-evaluate the list while excluding all matches that have previousily occured. Without this fix, adding this test results in a failure: RuntimeError: maximum recursion depth exceeded in cmp Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-18fetch2/__init__.py: uri_replace regex handlingMark Hatle
We should only substitute one time. If we do it without a max count, we can end up matching over and over. Before this change: https://downloads.yoctoproject.org/releases/bitbake/bitbake-1.0.tar.gz with a mirror of https://.*/[^/]* http://AAAA/A/A/A/ would end up either recursing indefinitely or result in: http://AAAA/A/A/A/A/A/A/A/A/A/bitbake-1.0.tar.gz Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03bb.fetch: don't remove the clone when an update failsChristopher Larson
When our clone exists, but is out of date, and the attempt to update it fails, we don't necessarily want to remove the entire clone, particularly if it's a large repository. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-09-03bb.fetch: handle checksums consistently for mirrorsChristopher Larson
If the main fetch method doesn't support checksums, the user will not be defining them in the recipe, so we don't want to check them for premirrors/mirrors either. This ensures that we never error due to missing checksums on a git mirror tarball. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-08-17Fix default function parameter assignment to a listPaul Eggleton
With python you should not assign a list as the default value of a function parameter - because a list is mutable, the result will be that the first time a value is passed it will actually modify the default. Reference: http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-12fetch2/wget.py: Add support of connection cache in checkstatus.Aníbal Limón
fetch2/__init__.py: Add connection_cache param in Fetch __init__. In order to pass connection cache object to checkstatus method. [YOCTO #7796] Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-09fetch2: Add fetch parameter to checkstatusAníbal Limón
In order to pass connection cache object to checkstatus function add fetch parameter. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-07-09fetch2/__init__.py: Add FetchConnectionCache classAníbal Limón
FetchConnectionCache class acts as a container for socket connections useful when implement connection cache into fetcher modules. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-06-19bitbake: Add explict getVar param for (non) expansionRichard Purdie
Rather than just use d.getVar(X), use the more explict d.getVar(X, False) since at some point in the future, having the default of expansion would be nice. This is the first step towards that. This patch was mostly made using the command: sed -e 's:\(getVar([^,()]*\)\s*):\1, False):g' -i `grep -ril getVar *` Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-23fetch2/__init__.py: Make get_srcrev output configurableMike Looijmans
The idea here is to support package version numbering similar to gitpkgv in meta-openembedded. This commit is the first step towards such functionality. The original plan was to add a "get_pretty_srcrev" method to the fetcher, as per Richard's suggestion [1]. While writing this, I noticed that it would become a copy of get_srcrev with only two lines changed. So to create something more Pythonic than a boolean argument and conditionals around the calls to the fetcher's sortable_revision, I just made the method to be called on the fetcher an argument to the method. Defaulting to 'sortable_revision' prevents affecting existing code. Now if the git fetcher were to implement, say 'gitpkgv_revision' one could set the following in a recipe: PKGV="1.2+${@bb.fetch2.get_srcrev(d, 'gitpkgv_revision')}" and this would yield the same result as gitpkgv's GITPKGV variable. See for the discussion leading to this change: [1] http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100345.html Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15fetch2: Improve mirror building function error handlingRichard Purdie
First, when building mirror urls we don't do any fetching so we should never be calling clean functions. Currently, if a mirror url fails, we don't process it further to see if there are any mirrors of the mirror. We should do this even when the mirror url fails, else we may miss out on valid/useful mappings, particularly in the case of file:// urls. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-15fetch2: Allow GIT_SMART_HTTP to be passed throughLiam R. Howlett
Allow GIT_SMART_HTTP to be passed through to the fetch command so that servers that cannot use GIT_SMART_HTTP can be used by the fetcher. Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-12fetch2: Add BB_ALLOWED_NETWORKS supportLiam R. Howlett
BB_ALLOWED_NETWORKS is a list of hosts that the fetcher will be allowed to use when BB_NO_NETWORK is not set. If BB_NO_NETWORK is set, then networking is still disabled. If BB_ALLOWED_NETWORKS is not set, the behaviour remains the same as today. If BB_NO_NETWORK is NOT set, and BB_ALLOWED_NETWORKS is configured, then only the hosts in the list are usable by the fetcher. eg: BB_ALLOWED_NETWORKS="yoctoproject.org git.gnu.org" The fetcher will be able to download from yoctoproject.org, git.gnu.org, but not ftp.gnu.org or any other hostname that is not in the list. There is also limited support for wildcards on the beginning of the hosts, so BB_ALLOWED_NETWORKS="*.gnu.org" with match git.gnu.org and ftp.gnu.org as well as foo.git.gnu.org Signed-off-by: Liam R. Howlett <Liam.Howlett@WindRiver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-05-12fetch2: Allow git to use a different CA Bundle with private keysJason Wessel
Setting BB_ENV_EXTRAWHITE to include GIT_SSL_CAINFO is enough to get "git ls-remote" to work for recipe parsing but it is not enough to get the fetcher to clone properly. This is because the fetcher has its own idea about what variables should be exported in the environment for some operations. It is desirable to use alternate CA Bundles for internal testing prior to using public keys for https, so we should allow the GIT_SSL_CAINFO to pass through. Signed-off-by: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-03-09fetch2: Revalidate checksums, YOCTO #5571Clemens Lang
[YOCTO #5571] -- https://bugzilla.yoctoproject.org/show_bug.cgi?id=5571 The following workflow (whether accidentally or deliberately) would previously not result in a checksum error, but would be helpful to do so: - Write a recipe with correct checksums - Fetch the sources for this recipe using bitbake - Change the checksums Since the bitbake fetcher writes a done stamp after the initial download and does not verify the checksums again (even if they are changed in the recipe afterwards), the change of checksums is silently ignored. Fix this without the overhead of computing the checksums from scratch on every do_fetch by storing them in pickled format in the done stamp and verifying that they still match those in the recipe. Signed-off-by: Clemens Lang <clemens.lang@bmw-carit.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-21fetcher: use os.path.splitext() instead of string.split()Ross Burton
Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-21lib/fetch2: Tweak get_srcrev() function descriptionRichard Purdie
Tweak the comments on get_srcrev() to better describe its function. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2015-01-08cache/fetch2/siggen: Ensure we track include history for file checksumsRichard Purdie
Currently, if you reference a file url, its checksum is included in the task hash, however if you change to a different file at a different location, perhaps taking advantage of the FILESPATH functionality, the system will not reparse the file in question and change its checksum to match the new file. To correctly handle this, the system not only needs to know if the existing file still exists or not, but also check the existance of every file it would have looked at when computing the original file. We already do this in the bitbake parsing code for class inclusion. This change uses the same technique to log the file list we looked at and if files in these locations exist when they previously did not, to invalidate and reparse the file. Since data stored in the cache is flattened text, we have to use a string form of the data and split on the ":" character which is ugly, but is an internal detail we can improve later if a better method is found. The cache version changes to trigger a reparse since the previous cache data is now incompatible. [YOCTO #7019] Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-12-09fetch2: add means of disabling SRC_URI checksumsPaul Eggleton
If we're fetching outside of the context of a recipe, it's handy to be able to disable checksum functionality so you don't get a meaningless warning about the signatures being missing. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-10-28fetch2: add .lz compression supportKoen Kooi
See http://www.nongnu.org/lzip/lzip.html for details on the compression format. Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-10-11fetcher: fix getVar call due to incorrect argument datatypeAlejandro Hernandez
Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-10-06fetcher: fix BB_STRICT_CHECKSUM datatype checkAlejandro Hernandez
Forcing strict to be a string, to avoid problems when performing comparisons [YOCTO #6762] Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-29fetch: Extend testing of subdir unpack parameter and fixRichard Purdie
This fixes urls of the form file://some/path/file;subdir=b. It also adds in a couple of tests so we now tests these corner cases. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-09-29fetch: SRC_URI parameter "subdir" does not work for local filesRoxana
Check if the 'subdir' parameter exists and assign it to 'destdir' so that files are copied in ${WORKDIR}/destdir. This fixes urls that are of the form file://a;subdir=b. Signed-off-by: Roxana Ciobanu <roxana.ciobanu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-07-21fetch2: Add module for ClearCase (ccrc://)Dennis Meier
The clearcase fetcher is used to retrieve files from a ClearCase (http://en.wikipedia.org/wiki/Rational_ClearCase) repository. Usage in the recipe: SRC_URI = "ccrc://cc.example.org/ccrc;vob=/example_vob;module=/example_module" SRCREV = "EXAMPLE_CLEARCASE_TAG" PV = "${@d.getVar("SRCREV").replace("/", "+")}" The fetcher uses the rcleartool or cleartool remote client, depending on which one is available. Supported SRC_URI options are: - vob (required) The name of the clearcase VOB (with prepending "/") - module The module in the selected VOB (with prepending "/") The module and vob parameters are combined to create the following load rule in the view config spec: load <vob><module> - proto http or https Related variables: CCASE_CUSTOM_CONFIG_SPEC Write a config spec to this variable in your recipe to use it instead of the default config spec generated by this fetcher. Please note that the SRCREV loses its functionality if you specify this variable. SRCREV is still used to label the archive after a fetch, but it doesn't define what's fetched. User credentials: When using cleartool: The login of cleartool is handled by the system. No special steps needed. When using rcleartool: In order to use rcleartool with authenticated users an `rcleartool login` is necessary before using the fetcher. Signed-off-by: Dennis Meier <meier.dennis@siemens.com> Reviewed-by: Roger Meier <r.meier@siemens.com> Reviewed-by: Christian Liechti <christian.liechti@siemens.com> Reviewed-by: Henrique Mendonca <henrique.mendonca@siemens.com> Reviewed-by: Pascal Bach <pascal.bach@siemens.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-30fetch2: improve handling of two classes of URL parameter mistakesPaul Eggleton
Handle the following situations in a URL (e.g. in SRC_URI): * Trailing semicolon in a URL - this is now ignored. * Parameter specified with no value (no equals sign). This still produces an error, but at least it is MalformedUrl with a proper message rather than "ValueError: need more than 1 value to unpack". Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2014-05-08Fix refetch of local files when they are read onlyNick Lewis
Signed-off-by: Nick Lewis <nick.lewis@usa.g4s.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>