diff options
Diffstat (limited to 'bitbake-dev/lib/bb/fetch/svk.py')
-rw-r--r-- | bitbake-dev/lib/bb/fetch/svk.py | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/bitbake-dev/lib/bb/fetch/svk.py b/bitbake-dev/lib/bb/fetch/svk.py deleted file mode 100644 index 120dad9d4e..0000000000 --- a/bitbake-dev/lib/bb/fetch/svk.py +++ /dev/null | |||
@@ -1,109 +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 bb | ||
30 | from bb import data | ||
31 | from bb.fetch import Fetch | ||
32 | from bb.fetch import FetchError | ||
33 | from bb.fetch import MissingParameterError | ||
34 | |||
35 | class Svk(Fetch): | ||
36 | """Class to fetch a module or modules from svk repositories""" | ||
37 | def supports(self, url, ud, d): | ||
38 | """ | ||
39 | Check to see if a given url can be fetched with svk. | ||
40 | """ | ||
41 | return ud.type in ['svk'] | ||
42 | |||
43 | def localpath(self, url, ud, d): | ||
44 | if not "module" in ud.parm: | ||
45 | raise MissingParameterError("svk method needs a 'module' parameter") | ||
46 | else: | ||
47 | ud.module = ud.parm["module"] | ||
48 | |||
49 | ud.revision = "" | ||
50 | if 'rev' in ud.parm: | ||
51 | ud.revision = ud.parm['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 | if (ud.date == "now"): | ||
59 | return True | ||
60 | return False | ||
61 | |||
62 | def go(self, loc, ud, d): | ||
63 | """Fetch urls""" | ||
64 | |||
65 | if not self.forcefetch(loc, ud, d) and Fetch.try_mirror(d, ud.localfile): | ||
66 | return | ||
67 | |||
68 | svkroot = ud.host + ud.path | ||
69 | |||
70 | svkcmd = "svk co -r {%s} %s/%s" % (ud.date, svkroot, ud.module) | ||
71 | |||
72 | if ud.revision: | ||
73 | svkcmd = "svk co -r %s %s/%s" % (ud.revision, svkroot, ud.module) | ||
74 | |||
75 | # create temp directory | ||
76 | localdata = data.createCopy(d) | ||
77 | data.update_data(localdata) | ||
78 | bb.msg.debug(2, bb.msg.domain.Fetcher, "Fetch: creating temporary directory") | ||
79 | bb.mkdirhier(data.expand('${WORKDIR}', localdata)) | ||
80 | data.setVar('TMPBASE', data.expand('${WORKDIR}/oesvk.XXXXXX', localdata), localdata) | ||
81 | tmppipe = os.popen(data.getVar('MKTEMPDIRCMD', localdata, 1) or "false") | ||
82 | tmpfile = tmppipe.readline().strip() | ||
83 | if not tmpfile: | ||
84 | bb.msg.error(bb.msg.domain.Fetcher, "Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.") | ||
85 | raise FetchError(ud.module) | ||
86 | |||
87 | # check out sources there | ||
88 | os.chdir(tmpfile) | ||
89 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) | ||
90 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % svkcmd) | ||
91 | myret = os.system(svkcmd) | ||
92 | if myret != 0: | ||
93 | try: | ||
94 | os.rmdir(tmpfile) | ||
95 | except OSError: | ||
96 | pass | ||
97 | raise FetchError(ud.module) | ||
98 | |||
99 | os.chdir(os.path.join(tmpfile, os.path.dirname(ud.module))) | ||
100 | # tar them up to a defined filename | ||
101 | myret = os.system("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module))) | ||
102 | if myret != 0: | ||
103 | try: | ||
104 | os.unlink(ud.localpath) | ||
105 | except OSError: | ||
106 | pass | ||
107 | raise FetchError(ud.module) | ||
108 | # cleanup | ||
109 | os.system('rm -rf %s' % tmpfile) | ||