summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/repo.py')
-rw-r--r--bitbake/lib/bb/fetch2/repo.py87
1 files changed, 0 insertions, 87 deletions
diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py
deleted file mode 100644
index fa4cb8149b..0000000000
--- a/bitbake/lib/bb/fetch2/repo.py
+++ /dev/null
@@ -1,87 +0,0 @@
1"""
2BitBake "Fetch" repo (git) implementation
3
4"""
5
6# Copyright (C) 2009 Tom Rini <trini@embeddedalley.com>
7#
8# Based on git.py which is:
9# Copyright (C) 2005 Richard Purdie
10#
11# SPDX-License-Identifier: GPL-2.0-only
12#
13
14import os
15import bb
16from bb.fetch2 import FetchMethod
17from bb.fetch2 import runfetchcmd
18from bb.fetch2 import logger
19
20class Repo(FetchMethod):
21 """Class to fetch a module or modules from repo (git) repositories"""
22 def supports(self, ud, d):
23 """
24 Check to see if a given url can be fetched with repo.
25 """
26 return ud.type in ["repo"]
27
28 def urldata_init(self, ud, d):
29 """
30 We don"t care about the git rev of the manifests repository, but
31 we do care about the manifest to use. The default is "default".
32 We also care about the branch or tag to be used. The default is
33 "master".
34 """
35
36 ud.basecmd = d.getVar("FETCHCMD_repo") or "/usr/bin/env repo"
37
38 ud.proto = ud.parm.get('protocol', 'git')
39 ud.branch = ud.parm.get('branch', 'master')
40 ud.manifest = ud.parm.get('manifest', 'default.xml')
41 if not ud.manifest.endswith('.xml'):
42 ud.manifest += '.xml'
43
44 ud.localfile = d.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch))
45
46 def download(self, ud, d):
47 """Fetch url"""
48
49 if os.access(os.path.join(d.getVar("DL_DIR"), ud.localfile), os.R_OK):
50 logger.debug("%s already exists (or was stashed). Skipping repo init / sync.", ud.localpath)
51 return
52
53 repodir = d.getVar("REPODIR") or (d.getVar("DL_DIR") + "/repo")
54 gitsrcname = "%s%s" % (ud.host, ud.path.replace("/", "."))
55 codir = os.path.join(repodir, gitsrcname, ud.manifest)
56
57 if ud.user:
58 username = ud.user + "@"
59 else:
60 username = ""
61
62 repodir = os.path.join(codir, "repo")
63 bb.utils.mkdirhier(repodir)
64 if not os.path.exists(os.path.join(repodir, ".repo")):
65 bb.fetch2.check_network_access(d, "%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), ud.url)
66 runfetchcmd("%s init -m %s -b %s -u %s://%s%s%s" % (ud.basecmd, ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d, workdir=repodir)
67
68 bb.fetch2.check_network_access(d, "%s sync %s" % (ud.basecmd, ud.url), ud.url)
69 runfetchcmd("%s sync" % ud.basecmd, d, workdir=repodir)
70
71 scmdata = ud.parm.get("scmdata", "")
72 if scmdata == "keep":
73 tar_flags = ""
74 else:
75 tar_flags = "--exclude='.repo' --exclude='.git'"
76
77 # Create a cache
78 runfetchcmd("tar %s -czf %s %s" % (tar_flags, ud.localpath, os.path.join(".", "*") ), d, workdir=codir)
79
80 def supports_srcrev(self):
81 return False
82
83 def _build_revision(self, ud, d):
84 return ud.manifest
85
86 def _want_sortable_revision(self, ud, d):
87 return False