diff options
Diffstat (limited to 'bitbake-dev/lib/bb/fetch/local.py')
| -rw-r--r-- | bitbake-dev/lib/bb/fetch/local.py | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/bitbake-dev/lib/bb/fetch/local.py b/bitbake-dev/lib/bb/fetch/local.py new file mode 100644 index 0000000000..54d598ae89 --- /dev/null +++ b/bitbake-dev/lib/bb/fetch/local.py | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # ex:ts=4:sw=4:sts=4:et | ||
| 2 | # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- | ||
| 3 | """ | ||
| 4 | BitBake 'Fetch' implementations | ||
| 5 | |||
| 6 | Classes for obtaining upstream sources for the | ||
| 7 | BitBake build tools. | ||
| 8 | |||
| 9 | """ | ||
| 10 | |||
| 11 | # Copyright (C) 2003, 2004 Chris Larson | ||
| 12 | # | ||
| 13 | # This program is free software; you can redistribute it and/or modify | ||
| 14 | # it under the terms of the GNU General Public License version 2 as | ||
| 15 | # published by the Free Software Foundation. | ||
| 16 | # | ||
| 17 | # This program is distributed in the hope that it will be useful, | ||
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 20 | # GNU General Public License for more details. | ||
| 21 | # | ||
| 22 | # You should have received a copy of the GNU General Public License along | ||
| 23 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
| 24 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 25 | # | ||
| 26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | ||
| 27 | |||
| 28 | import os, re | ||
| 29 | import bb | ||
| 30 | from bb import data | ||
| 31 | from bb.fetch import Fetch | ||
| 32 | |||
| 33 | class Local(Fetch): | ||
| 34 | def supports(self, url, urldata, d): | ||
| 35 | """ | ||
| 36 | Check to see if a given url can be fetched with cvs. | ||
| 37 | """ | ||
| 38 | return urldata.type in ['file','patch'] | ||
| 39 | |||
| 40 | def localpath(self, url, urldata, d): | ||
| 41 | """ | ||
| 42 | Return the local filename of a given url assuming a successful fetch. | ||
| 43 | """ | ||
| 44 | path = url.split("://")[1] | ||
| 45 | path = path.split(";")[0] | ||
| 46 | newpath = path | ||
| 47 | if path[0] != "/": | ||
| 48 | filespath = data.getVar('FILESPATH', d, 1) | ||
| 49 | if filespath: | ||
| 50 | newpath = bb.which(filespath, path) | ||
| 51 | if not newpath: | ||
| 52 | filesdir = data.getVar('FILESDIR', d, 1) | ||
| 53 | if filesdir: | ||
| 54 | newpath = os.path.join(filesdir, path) | ||
| 55 | # We don't set localfile as for this fetcher the file is already local! | ||
| 56 | return newpath | ||
| 57 | |||
| 58 | def go(self, url, urldata, d): | ||
| 59 | """Fetch urls (no-op for Local method)""" | ||
| 60 | # no need to fetch local files, we'll deal with them in place. | ||
| 61 | return 1 | ||
| 62 | |||
| 63 | def checkstatus(self, url, urldata, d): | ||
| 64 | """ | ||
| 65 | Check the status of the url | ||
| 66 | """ | ||
| 67 | if urldata.localpath.find("*") != -1: | ||
| 68 | bb.msg.note(1, bb.msg.domain.Fetcher, "URL %s looks like a glob and was therefore not checked." % url) | ||
| 69 | return True | ||
| 70 | if os.path.exists(urldata.localpath): | ||
| 71 | return True | ||
| 72 | return False | ||
