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/repo.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/repo.py')
-rw-r--r-- | bitbake/lib/bb/fetch/repo.py | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py deleted file mode 100644 index 512fffb4ce..0000000000 --- a/bitbake/lib/bb/fetch/repo.py +++ /dev/null | |||
@@ -1,98 +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" repo (git) implementation | ||
5 | |||
6 | """ | ||
7 | |||
8 | # Copyright (C) 2009 Tom Rini <trini@embeddedalley.com> | ||
9 | # | ||
10 | # Based on git.py which is: | ||
11 | #Copyright (C) 2005 Richard Purdie | ||
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 | import os | ||
27 | import bb | ||
28 | from bb import data | ||
29 | from bb.fetch import Fetch | ||
30 | from bb.fetch import runfetchcmd | ||
31 | |||
32 | class Repo(Fetch): | ||
33 | """Class to fetch a module or modules from repo (git) repositories""" | ||
34 | def supports(self, url, ud, d): | ||
35 | """ | ||
36 | Check to see if a given url can be fetched with repo. | ||
37 | """ | ||
38 | return ud.type in ["repo"] | ||
39 | |||
40 | def localpath(self, url, ud, d): | ||
41 | """ | ||
42 | We don"t care about the git rev of the manifests repository, but | ||
43 | we do care about the manifest to use. The default is "default". | ||
44 | We also care about the branch or tag to be used. The default is | ||
45 | "master". | ||
46 | """ | ||
47 | |||
48 | ud.proto = ud.parm.get('protocol', 'git') | ||
49 | ud.branch = ud.parm.get('branch', 'master') | ||
50 | ud.manifest = ud.parm.get('manifest', 'default.xml') | ||
51 | if not ud.manifest.endswith('.xml'): | ||
52 | ud.manifest += '.xml' | ||
53 | |||
54 | ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) | ||
55 | |||
56 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | ||
57 | |||
58 | def go(self, loc, ud, d): | ||
59 | """Fetch url""" | ||
60 | |||
61 | if os.access(os.path.join(data.getVar("DL_DIR", d, True), ud.localfile), os.R_OK): | ||
62 | logger.debug(1, "%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath) | ||
63 | return | ||
64 | |||
65 | gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", ".")) | ||
66 | repodir = data.getVar("REPODIR", d, True) or os.path.join(data.getVar("DL_DIR", d, True), "repo") | ||
67 | codir = os.path.join(repodir, gitsrcname, ud.manifest) | ||
68 | |||
69 | if ud.user: | ||
70 | username = ud.user + "@" | ||
71 | else: | ||
72 | username = "" | ||
73 | |||
74 | bb.utils.mkdirhier(os.path.join(codir, "repo")) | ||
75 | os.chdir(os.path.join(codir, "repo")) | ||
76 | if not os.path.exists(os.path.join(codir, "repo", ".repo")): | ||
77 | runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d) | ||
78 | |||
79 | runfetchcmd("repo sync", d) | ||
80 | os.chdir(codir) | ||
81 | |||
82 | scmdata = ud.parm.get("scmdata", "") | ||
83 | if scmdata == "keep": | ||
84 | tar_flags = "" | ||
85 | else: | ||
86 | tar_flags = "--exclude '.repo' --exclude '.git'" | ||
87 | |||
88 | # Create a cache | ||
89 | runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d) | ||
90 | |||
91 | def supports_srcrev(self): | ||
92 | return False | ||
93 | |||
94 | def _build_revision(self, url, ud, d): | ||
95 | return ud.manifest | ||
96 | |||
97 | def _want_sortable_revision(self, url, ud, d): | ||
98 | return False | ||