diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-03 11:25:19 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-05 10:38:01 -0800 |
| commit | 5419dc1bb787d338f9aec238b627ae9eea2f948d (patch) | |
| tree | f4d104e4edfdff41bef735b578f260ee2c9124fd /bitbake/lib/bb/fetch/svk.py | |
| parent | ff73b02a7203623e5edfaaa10df17eaa63cf4ed3 (diff) | |
| download | poky-5419dc1bb787d338f9aec238b627ae9eea2f948d.tar.gz | |
bitbake: Drop fetch v1, v2 provides a much better codebase to build from
(Bitbake rev: 292e3430e5140b602cad86f55b5453e8cebb28a1)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch/svk.py')
| -rw-r--r-- | bitbake/lib/bb/fetch/svk.py | 104 |
1 files changed, 0 insertions, 104 deletions
diff --git a/bitbake/lib/bb/fetch/svk.py b/bitbake/lib/bb/fetch/svk.py deleted file mode 100644 index dc818d2d67..0000000000 --- a/bitbake/lib/bb/fetch/svk.py +++ /dev/null | |||
| @@ -1,104 +0,0 @@ | |||
| 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 | This implementation is for svk. It is based on the svn implementation | ||
| 7 | |||
| 8 | """ | ||
| 9 | |||
| 10 | # Copyright (C) 2006 Holger Hans Peter Freyther | ||
| 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 | ||
| 29 | import logging | ||
| 30 | import bb | ||
| 31 | from bb import data | ||
| 32 | from bb.fetch import Fetch | ||
| 33 | from bb.fetch import FetchError | ||
| 34 | from bb.fetch import MissingParameterError | ||
| 35 | from bb.fetch import logger | ||
| 36 | |||
| 37 | class Svk(Fetch): | ||
| 38 | """Class to fetch a module or modules from svk repositories""" | ||
| 39 | def supports(self, url, ud, d): | ||
| 40 | """ | ||
| 41 | Check to see if a given url can be fetched with svk. | ||
| 42 | """ | ||
| 43 | return ud.type in ['svk'] | ||
| 44 | |||
| 45 | def localpath(self, url, ud, d): | ||
| 46 | if not "module" in ud.parm: | ||
| 47 | raise MissingParameterError("svk method needs a 'module' parameter") | ||
| 48 | else: | ||
| 49 | ud.module = ud.parm["module"] | ||
| 50 | |||
| 51 | ud.revision = ud.parm.get('rev', "") | ||
| 52 | |||
| 53 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) | ||
| 54 | |||
| 55 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | ||
| 56 | |||
| 57 | def forcefetch(self, url, ud, d): | ||
| 58 | return ud.date == "now" | ||
| 59 | |||
| 60 | def go(self, loc, ud, d): | ||
| 61 | """Fetch urls""" | ||
| 62 | |||
| 63 | svkroot = ud.host + ud.path | ||
| 64 | |||
| 65 | svkcmd = "svk co -r {%s} %s/%s" % (ud.date, svkroot, ud.module) | ||
| 66 | |||
| 67 | if ud.revision: | ||
| 68 | svkcmd = "svk co -r %s %s/%s" % (ud.revision, svkroot, ud.module) | ||
| 69 | |||
| 70 | # create temp directory | ||
| 71 | localdata = data.createCopy(d) | ||
| 72 | data.update_data(localdata) | ||
| 73 | logger.debug(2, "Fetch: creating temporary directory") | ||
| 74 | bb.utils.mkdirhier(data.expand('${WORKDIR}', localdata)) | ||
| 75 | data.setVar('TMPBASE', data.expand('${WORKDIR}/oesvk.XXXXXX', localdata), localdata) | ||
| 76 | tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") | ||
| 77 | tmpfile = tmppipe.readline().strip() | ||
| 78 | if not tmpfile: | ||
| 79 | logger.error("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") | ||
| 80 | raise FetchError(ud.module) | ||
| 81 | |||
| 82 | # check out sources there | ||
| 83 | os.chdir(tmpfile) | ||
| 84 | logger.info("Fetch " + loc) | ||
| 85 | logger.debug(1, "Running %s", svkcmd) | ||
| 86 | myret = os.system(svkcmd) | ||
| 87 | if myret != 0: | ||
| 88 | try: | ||
| 89 | os.rmdir(tmpfile) | ||
| 90 | except OSError: | ||
| 91 | pass | ||
| 92 | raise FetchError(ud.module) | ||
| 93 | |||
| 94 | os.chdir(os.path.join(tmpfile, os.path.dirname(ud.module))) | ||
| 95 | # tar them up to a defined filename | ||
| 96 | myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module))) | ||
| 97 | if myret != 0: | ||
| 98 | try: | ||
| 99 | os.unlink(ud.localpath) | ||
| 100 | except OSError: | ||
| 101 | pass | ||
| 102 | raise FetchError(ud.module) | ||
| 103 | # cleanup | ||
| 104 | bb.utils.prunedir(tmpfile) | ||
