diff options
| author | Richard Purdie <richard@openedhand.com> | 2006-03-20 17:45:11 +0000 |
|---|---|---|
| committer | Richard Purdie <richard@openedhand.com> | 2006-03-20 17:45:11 +0000 |
| commit | b26a945734ce271aa7d443ff9e96fe2851b21138 (patch) | |
| tree | f540b8d58a7411cf0cabe5c8f4ad40f9f597352a /bitbake/lib/bb/fetch/__init__.py | |
| parent | 3cd47ad235d54a9c539ae6fe4a5a2b4b5f7e5621 (diff) | |
| download | poky-b26a945734ce271aa7d443ff9e96fe2851b21138.tar.gz | |
Update to latest bitbake
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@309 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/fetch/__init__.py')
| -rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index da5b10c4b6..0515f2a5e9 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
| @@ -158,18 +158,47 @@ class Fetch(object): | |||
| 158 | return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1 ) | 158 | return data.getVar("SRCDATE", d, 1) or data.getVar("CVSDATE", d, 1) or data.getVar("DATE", d, 1 ) |
| 159 | getSRCDate = staticmethod(getSRCDate) | 159 | getSRCDate = staticmethod(getSRCDate) |
| 160 | 160 | ||
| 161 | #if __name__ == "__main__": | 161 | def try_mirror(d, tarfn): |
| 162 | """ | ||
| 163 | Try to use a mirrored version of the sources. We do this | ||
| 164 | to avoid massive loads on foreign cvs and svn servers. | ||
| 165 | This method will be used by the different fetcher | ||
| 166 | implementations. | ||
| 167 | |||
| 168 | d Is a bb.data instance | ||
| 169 | tarfn is the name of the tarball | ||
| 170 | """ | ||
| 171 | tarpath = os.path.join(data.getVar("DL_DIR", d, 1), tarfn) | ||
| 172 | if os.access(tarpath, os.R_OK): | ||
| 173 | return True | ||
| 174 | |||
| 175 | pn = data.getVar('PN', d, True) | ||
| 176 | src_tarball_stash = None | ||
| 177 | if pn: | ||
| 178 | src_tarball_stash = (data.getVar('SRC_TARBALL_STASH_%s' % pn, d, True) or data.getVar('CVS_TARBALL_STASH_%s' % pn, d, True) or data.getVar('SRC_TARBALL_STASH', d, True) or data.getVar('CVS_TARBALL_STASH', d, True) or "").split() | ||
| 179 | |||
| 180 | for stash in src_tarball_stash: | ||
| 181 | fetchcmd = data.getVar("FETCHCOMMAND_mirror", d, True) or data.getVar("FETCHCOMMAND_wget", d, True) | ||
| 182 | uri = stash + tarfn | ||
| 183 | bb.note("fetch " + uri) | ||
| 184 | fetchcmd = fetchcmd.replace("${URI}", uri) | ||
| 185 | ret = os.system(fetchcmd) | ||
| 186 | if ret == 0: | ||
| 187 | bb.note("Fetched %s from tarball stash, skipping checkout" % tarfn) | ||
| 188 | return True | ||
| 189 | return False | ||
| 190 | try_mirror = staticmethod(try_mirror) | ||
| 162 | 191 | ||
| 163 | import bk | ||
| 164 | import cvs | 192 | import cvs |
| 165 | import git | 193 | import git |
| 166 | import local | 194 | import local |
| 167 | import svn | 195 | import svn |
| 168 | import wget | 196 | import wget |
| 197 | import svk | ||
| 169 | 198 | ||
| 170 | methods.append(bk.Bk()) | ||
| 171 | methods.append(cvs.Cvs()) | 199 | methods.append(cvs.Cvs()) |
| 172 | methods.append(git.Git()) | 200 | methods.append(git.Git()) |
| 173 | methods.append(local.Local()) | 201 | methods.append(local.Local()) |
| 174 | methods.append(svn.Svn()) | 202 | methods.append(svn.Svn()) |
| 175 | methods.append(wget.Wget()) | 203 | methods.append(wget.Wget()) |
| 204 | methods.append(svk.Svk()) | ||
