diff options
Diffstat (limited to 'bitbake/lib/bb/fetch2/svk.py')
-rw-r--r-- | bitbake/lib/bb/fetch2/svk.py | 95 |
1 files changed, 0 insertions, 95 deletions
diff --git a/bitbake/lib/bb/fetch2/svk.py b/bitbake/lib/bb/fetch2/svk.py deleted file mode 100644 index 6f70a3be28..0000000000 --- a/bitbake/lib/bb/fetch2/svk.py +++ /dev/null | |||
@@ -1,95 +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.fetch2 import FetchMethod | ||
33 | from bb.fetch2 import FetchError | ||
34 | from bb.fetch2 import MissingParameterError | ||
35 | from bb.fetch2 import logger | ||
36 | from bb.fetch2 import runfetchcmd | ||
37 | |||
38 | class Svk(FetchMethod): | ||
39 | """Class to fetch a module or modules from svk repositories""" | ||
40 | def supports(self, ud, d): | ||
41 | """ | ||
42 | Check to see if a given url can be fetched with svk. | ||
43 | """ | ||
44 | return ud.type in ['svk'] | ||
45 | |||
46 | def urldata_init(self, ud, d): | ||
47 | |||
48 | if not "module" in ud.parm: | ||
49 | raise MissingParameterError('module', ud.url) | ||
50 | else: | ||
51 | ud.module = ud.parm["module"] | ||
52 | |||
53 | ud.revision = ud.parm.get('rev', "") | ||
54 | |||
55 | ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) | ||
56 | |||
57 | def need_update(self, ud, d): | ||
58 | if ud.date == "now": | ||
59 | return True | ||
60 | if not os.path.exists(ud.localpath): | ||
61 | return True | ||
62 | return False | ||
63 | |||
64 | def download(self, ud, d): | ||
65 | """Fetch urls""" | ||
66 | |||
67 | svkroot = ud.host + ud.path | ||
68 | |||
69 | svkcmd = "svk co -r {%s} %s/%s" % (ud.date, svkroot, ud.module) | ||
70 | |||
71 | if ud.revision: | ||
72 | svkcmd = "svk co -r %s %s/%s" % (ud.revision, svkroot, ud.module) | ||
73 | |||
74 | # create temp directory | ||
75 | logger.debug(2, "Fetch: creating temporary directory") | ||
76 | bb.utils.mkdirhier(d.expand('${WORKDIR}')) | ||
77 | mktemp = d.getVar("FETCHCMD_svkmktemp", True) or d.expand("mktemp -d -q '${WORKDIR}/oesvk.XXXXXX'") | ||
78 | tmpfile, errors = bb.process.run(mktemp) | ||
79 | tmpfile = tmpfile.strip() | ||
80 | if not tmpfile: | ||
81 | logger.error() | ||
82 | raise FetchError("Fetch: unable to create temporary directory.. make sure 'mktemp' is in the PATH.", ud.url) | ||
83 | |||
84 | # check out sources there | ||
85 | os.chdir(tmpfile) | ||
86 | logger.info("Fetch " + ud.url) | ||
87 | logger.debug(1, "Running %s", svkcmd) | ||
88 | runfetchcmd(svkcmd, d, cleanup = [tmpfile]) | ||
89 | |||
90 | os.chdir(os.path.join(tmpfile, os.path.dirname(ud.module))) | ||
91 | # tar them up to a defined filename | ||
92 | runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.basename(ud.module)), d, cleanup = [ud.localpath]) | ||
93 | |||
94 | # cleanup | ||
95 | bb.utils.prunedir(tmpfile) | ||