Commit Graph

160 Commits

Author SHA1 Message Date
Richard Purdie 3ef2d39dbf bitbake/fecth2: Ensure BB_FETCH_PREMIRRORONLY being set as false is handled correctly
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-16 12:35:35 +00:00
Richard Purdie b9a97e07b4 bitbake/fetch2: Revert part of the unpack change until the issues with it are resolved
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-13 00:05:06 +00:00
Mark Hatle 3faa635fd4 fetch2: unpack revision
Revise the unpack function to have a way to disable the unpack.  This is
based on the work from "Andreas Oberritter <obi@opendreambox.org>", see
http://cgit.openembedded.net/cgit.cgi/openembedded/commit/?id=2bdfe8519eda8067845019a699acdf19a21ba380

In addition, the to_boolean function comes from the work of
"Chris Larson <chris_larson@mentor.com>", see
http://cgit.openembedded.net/cgit.cgi/openembedded/commit/?id=900cc29b603691eb3a077cb660545ead3715ed54

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2011-02-12 00:30:29 +00:00
Richard Purdie 029f19bd3d bitbake/fetch2: Add explict network access exception and handling to give users usable error messages
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 22:08:21 +00:00
Richard Purdie 4a226460d5 bitbake/fetch2: Fix message about md5 checksums when sha256 is incorrect
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 21:59:23 +00:00
Richard Purdie 132ec8d3b7 bitbake/fetch2: Fix patch merge error
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 16:24:26 +00:00
Richard Purdie a72d49478e bitbake/fetch2: Add some debug output so its clear when PREMIRRORS, upstream and MIRRORS are being used
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 16:16:51 +00:00
Richard Purdie 20afb21a37 bitbake/fetch2: Ensure network access status is reset for each loop iteration in download()
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 16:15:36 +00:00
Richard Purdie ea70c4362f bitbake/fetch2: Ensure failed fetch attempts are logged in the debug logs
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 12:14:20 +00:00
Richard Purdie 7f30131faa bitbake/fetch2: Correctly handle git mirror tarball fetching
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 12:06:44 +00:00
Richard Purdie 20ab1cb0ca bitbake/fetch2: Pass over malformatted (empty) mirror url lines
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-11 12:04:59 +00:00
Saul Wold 14dea89521 fetch2: Correct the clean() mechanism for the fetcher2 code
This create a clean() method in each of the fetcher modules
and correctly cleans the .done stamp file and lock files

Signed-off-by: Saul Wold <sgw@linux.intel.com>
2011-02-10 23:49:25 +00:00
Richard Purdie 29ed2c6e9a bitbake/fetch2: Fix negated if check for BB_FETCH_PREMIRRORONLY
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-09 01:23:56 +00:00
Mark Hatle 906285ff00 fetch2: Add SRPM knowledge
Enable the fetcher to be able to unpack and SRPM.  By default the system will
unpack the contents of the SRPM into the WORKDIR.

A new syntax "unpack=file" was developed for the SRC_URI, to allow for a
recipe to extract a specific file within an SRPM.  An unpack operation will
then be executed on the extracted file.

In order to apply extracted patches (or unpack files not specified with
unpack), you must specify the path using WORKDIR, i.e.:

file://${WORKDIR}/mypatch.patch

Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
2011-02-08 18:01:35 +00:00
Richard Purdie aa45760702 bitbake/fetch2: Ignore UnboundLocalError in exception handler in try_mirror
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-08 17:30:45 +00:00
Richard Purdie ee1a9c0476 bitbake/fetch2: Move symlink handling into try_mirror where is belongs instead of the main download function
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-08 14:02:16 +00:00
Richard Purdie c4e66a7fe0 bitbake/fetch2: When using BB_FETCH_PREMIRRORONLY, set BB_NO_NETWORK after premirrors as there could be data processing needed by the real fetcher
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-08 14:02:16 +00:00
Richard Purdie 91eeb9b0d3 bitbake/fetch2: Ensure we only remove files, not directories when fetch failures occur
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-08 14:02:16 +00:00
Richard Purdie 0713fb6b99 bitbake/fetch2: Ensure original ud is preserved in try_mirror
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-08 14:02:16 +00:00
Saul Wold 1544aa8ab4 fetch2: add try/finally to ensure lockfile is unlocked on failure
Signed-off-by: Saul Wold <sgw@linux.intel.com>
2011-02-07 17:29:46 -08:00
Richard Purdie 500c66337c bitbake/fetch2:Fetch Make using the fn based cache optional
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 21:13:13 +00:00
Richard Purdie d4b4b48add bitbake/fetch2: Fix pickling issues with fetcher exceptions
See the problems in http://bugs.python.org/issue1692335, need to set self.args
correctly.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 21:13:13 +00:00
Richard Purdie 94faffdaf6 bitbake/fetch2: Update mirror processing to ensure we look for mirror tarballs
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 19:48:21 +00:00
Richard Purdie 37624b9745 bitbake/fetch2: Update forcefetch and mirror handling to clean up, simplfy and bug fix the code
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 16:52:42 +00:00
Richard Purdie ded83ffc3b bitbake/fetch2: Match Fetcher log domain to that in bb.msg
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 14:50:27 +00:00
Richard Purdie 7202a77134 bitbake/fetch2: Use True instead of integer values
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:37 +00:00
Richard Purdie 8f2abf4a9f bitbake/fetch2: Drop name/override ordering backwards compatibility code
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:37 +00:00
Richard Purdie ca7adf7529 bitbake/fetch2: Define a new interface to the fetcher code though the 'Fetch' class
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:37 +00:00
Richard Purdie 08a9fef4fa bitbake/fetch2: Fix typo
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:37 +00:00
Richard Purdie 806d1c25f8 bitbake/fetch2: Drop legacy CVSDATE support
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie f60d9d6bd4 bitbake/fetch2: Move getSRCDate to FetchData class where is more appropriate
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie 831c6c1d3c bitbake/fetch2: Make srcrev_internal_helper a normal function, doesn't belong in the FetchMethod class
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie ab0dd13974 bitbake/fetch2: Rename Fetch class to FetchMethod
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie 74b71864fe bitbake/fetch2: Drop old md5 handling code
Drop some old md5 functions since we have improved functionality now which includes
sha256 checksum support. This stops each download being md5 checksumed twice.

Also change ".md5" stamp extentions to ".done" to better describe its use as a
download complete marker file and no longer write the md5 sum to the files.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie d08397ba4d bitbake/fetch2: Rewrite and improve exception handling, reusing core functions for common operations where possible
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:36 +00:00
Richard Purdie f6eefb3ca3 bitbake/fetch2: Have all fetcher exceptions derived from a common BBFetchException class
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:35 +00:00
Richard Purdie 8daab5b951 bitbake/fetch2: Drop unused parameter for localpath() and update comments
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:35 +00:00
Richard Purdie 7e4fbfc1c1 bitbake/fetch2: Simplfy setup_srcrevs
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:35 +00:00
Richard Purdie 49a022d25d bitbake/fetch2: Simplify localpath variable handling FetchData init
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:35 +00:00
Richard Purdie 5a52cb80d6 bitbake/fetch2: Define a sane localpath function and remove code duplication
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:35 +00:00
Richard Purdie 0e5404ceda bitbake/fetch2: Drop horrible SRCREV hack which is no longer needed
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-07 09:06:34 +00:00
Richard Purdie 282a828f3d bitbake/fetch2: Remove old local file acceleration code
Since local mirror fetches are always symlinked from the download directory
directly, there is no need for this premirrors hack which doesn't cover
mirrors and also abuses the localpath variable with inconsistent results.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-03 18:24:25 +00:00
Richard Purdie fa9fda05e1 bitbake/fetch2: Ensure that mirror fetches are symlinked from the download directory
When files are fetched from a mirror source that happens to be local,
ensure links are created for the file since subsequent fetch calls
can then follow the links to find files.

Any other approach such as the existing manipulations of localpath
internally to the fetcher are prone to errors, races and other issues.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-03 18:22:06 +00:00
Richard Purdie 7f99605562 bitbake/fetch2: When encoding a file:// url, drop user and host information
When processing a cvs SRC_URI to a file:// mirror, the user and host information
will break the mirror processing. This patch addresses it by only constructing
valid urls.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-03 18:19:23 +00:00
Richard Purdie a55d86b405 bitbake/lib/bb/fetch2: Assign a default name in the names array as empty strings as names cause problems for python
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-03 00:16:23 +00:00
Richard Purdie 08cd6c1cb9 bitbake/fetch2: Add missing parameter to localcount_internal_helper
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-02 18:48:13 +00:00
Yu Ke 0e837e6844 fetch2: Allow multiple src rev to be used in one src_uri
* SRC_URI format:
the SRC_URI are extended to allow multiple src rev:
name=<name1>,<name2>,...<name-n>
branch=<branch1>,<branch2>,...,<branch-n>
also SRCREV can be defined with
SRCREV_<name1> = xxxxx
SRCREV_<name2> = xxxxx

* FetchData extention
to support multiple src rev, several FetchData data are added:
- FetchData.names: list of name in SRC_URI,  one name per srcrev. name is the index of revision and branch
- FetchData.revisions: dictionary of name->revision.
- FetchData.branches: dictionary of name->branch.

For example, linux-yocto recipes becomes:
SRC_URI = "git://git.pokylinux.org/linux-yocto-2.6.37;protocol=git;branch=${KBRANCH},meta;name=machine,meta"

FetchData.names = ['machine', 'meta']
FetchData.revisions = { 'machine':xxxxx, 'meta':xxxxxx }
FetchData.branches = { 'machine':${KBRANCH}, 'meta':'meta'}

* generic revision handling extension
the related revision handling code in fetch2.__init__.py are changed accordingly. the major change is add name parameter to indicate which src rev to handling. originally there is one src rev per FetchData, so FetchData parameter is enough. now since one FetchData has multiple src rev, it is necessary to use FetchData + name to specifiy src rev.

* git extension
git fetcher are also revised to take advantage of the multiple src rev in FetchData. especially the download() method are enhanced to fetch multiple src rev.

* other fetcher (svn, hg, ...) does not support multiple src rev. they just sync the API to add name, and then simply ignore the name. no actually functional change

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-02-02 17:19:18 +00:00
Richard Purdie 05954ef4d7 bitbake/fetch2: Ensure the local revision counter takes a default value of 0, not None
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-02-01 23:33:19 +00:00
Yu Ke 098e8ded33 bb.fetch2: add "BB_NO_NETWORK" option
Sometime user want a purely local fetching, i.e. using local mirror without
any remote netowrk access. BB_NO_NETWORK option is introduced for this purpose

check_network_access() is the guard for BB_NO_NETWOKR option. it should be
put in any place that fetcher use network access

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:32:49 +00:00
Yu Ke ef918a72de git.py: split download to download() and build_mirror_data()
the download is to fetch the source from URL, the build_mirror_data is
to create the mirror tar ball. the original go() method mix them together,
it is more clean to split them.

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:25:47 +00:00
Yu Ke e05918937c bb.fetch2: rename "go" with "download" to better reflect its functionality
no functional change

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:25:47 +00:00
Yu Ke f12e714845 bb.fetch: add fetch version to distinguish bb.fetch and bb.fetch2
there is case that we need to distingush bb.fetch and bb.fetch2,
and use different API for bb.fetch and bb.fetch2. so it is necessary
to add version info for distinguish purpose

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:25:46 +00:00
Yu Ke 84ff79413a bb.fetch2: revise the Fetch.unpack API
change the unpack to use the urldata and rootdir parameter
- urldata is the FetchData instance
- rootdir is the dir to put the extracted source. the original unpack
  use current dir (os.getcwd) as destination dir, which is not flexible
  and error-prone (error will occur if caller not chdir to dest dir)

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:25:46 +00:00
Yu Ke d8698b92ff bb.fetch2: add unpack method in fetcher
copy exactly the base.bbclass:oe_unpack_file() to bb.fetch2 as the code base

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-25 12:25:46 +00:00
Bernhard Reutner-Fischer 2ef204dcdd *: use utils.remove() some more
(Bitbake rev: d3489b141cac1197324661680fe38b8a88bc49b4)

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-12 13:47:14 +00:00
Yu Ke 2b2dbf7612 Fetcher: only set __BB_DONT_CACHE when SRCREV = "${AUTOREV}"
we should cache SRCREV whenever possible, the only exception is
when SREREV is auto rev. so change the logic to only set __BB_DONT_CACHE
at SRCREV = "${AUTOREV}" case

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-10 20:37:37 +00:00
Yu Ke 1589a1172f Fetcher: break the "SRCREVINACTION" deadlock
Current fetcher has annoying "SRCREVINACTION" deadlock,
which occurs when SRCREV=${AUTOREV}=@bb.fetch.get_srcrev():
get_srcrev()->setup_localpath()->srcrev_internal_helper()
->evaluate SRCREV->get_srcrev()

current fetcher resolve the deadlock by introducing a
"SRCREVINACTION" condition check. Althoguh it works, it is
indeed not clean.

This patch use antoehr idea to break the deadlock: break
the dependency among SRCREV and get_srcrev(), i.e. assign
a specific keyword "AUTOINC" to AUTOREV. when Fetcher meet
this keyword, it will check and set the latest revision to
urldata.revision. get_srcrev later can use the urldata.revision
for value evaluation(SRCPV etc). In this case, SRCREV no longer
depends on get_srcrev, and there is not deadlock anymore.

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-10 20:24:33 +00:00
Yu Ke 2892cbfb11 bb.fetch2: add urldata_init call for Fetch class
FetchData has some fetch method specific data, and only fetch method knows how
to initialize it. originally it is mostly initialized in Fetch.localpath().
But now there is requirement to call Fetch.latest_revision() before
Fetch.localpath(), thus require another earlier place for initialization. so
urldata_init is introduced for this purpose. it will be called in FetchData:__init__
and make all the Fetch functions useable after that.

Signed-off-by: Yu Ke <ke.yu@intel.com>
2011-01-10 20:21:15 +00:00
Yu Ke c64b445f38 bb.fetch2: replace bb.fetch with bb.fetch2 in the bb.fetch
bb.fetch2 is copied from bb.fetch, and has many bb.fetch referrence.
Fix these referrence with bb.fetch2 referrence

Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-10 18:05:07 +00:00
Yu Ke 4dccd92439 bitbake: copy bb.fetch to bb.fetch2 as initial code base for fetcher overhaul
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2011-01-10 14:23:36 +00:00