Lines Matching refs:ud
26 def supports(self, ud, d): argument
30 return ud.type in ['hg']
39 def urldata_init(self, ud, d): argument
43 if not "module" in ud.parm:
44 raise MissingParameterError('module', ud.url)
46 ud.module = ud.parm["module"]
48 if 'protocol' in ud.parm:
49 ud.proto = ud.parm['protocol']
50 elif not ud.host:
51 ud.proto = 'file'
53 ud.proto = "hg"
56 hgsrcname = '%s_%s_%s' % (ud.module.replace('/', '.'), \
57 ud.host, ud.path.replace('/', '.'))
59 ud.fullmirror = os.path.join(d.getVar("DL_DIR"), mirrortarball)
60 ud.mirrortarballs = [mirrortarball]
63 ud.pkgdir = os.path.join(hgdir, hgsrcname)
64 ud.moddir = os.path.join(ud.pkgdir, ud.module)
65 ud.localfile = ud.moddir
66 ud.basecmd = d.getVar("FETCHCMD_hg") or "/usr/bin/env hg"
68 ud.setup_revisions(d)
70 if 'rev' in ud.parm:
71 ud.revision = ud.parm['rev']
72 elif not ud.revision:
73 ud.revision = self.latest_revision(ud, d)
75 ud.write_tarballs = d.getVar("BB_GENERATE_MIRROR_TARBALLS")
77 def need_update(self, ud, d): argument
78 revTag = ud.parm.get('rev', 'tip')
81 if not os.path.exists(ud.localpath):
85 def try_premirror(self, ud, d): argument
90 if os.path.exists(ud.moddir):
94 def _buildhgcommand(self, ud, d, command): argument
100 proto = ud.parm.get('protocol', 'http')
102 host = ud.host
105 ud.host = "localhost"
107 if not ud.user:
108 hgroot = host + ud.path
110 if ud.pswd:
111 hgroot = ud.user + ":" + ud.pswd + "@" + host + ud.path
113 hgroot = ud.user + "@" + host + ud.path
116 return "%s identify -i %s://%s/%s" % (ud.basecmd, proto, hgroot, ud.module)
124 if ud.revision and command != "fetch":
125 options.append("-r %s" % ud.revision)
128 if ud.user and ud.pswd:
129 …s=%s\" clone %s %s://%s/%s %s" % (ud.basecmd, ud.user, ud.pswd, proto, " ".join(options), proto, h…
131 …cmd = "%s clone %s %s://%s/%s %s" % (ud.basecmd, " ".join(options), proto, hgroot, ud.module, ud.m…
136 if ud.user and ud.pswd:
137 …efault.password=%s --config \"auth.default.schemes=%s\" pull" % (ud.basecmd, ud.user, ud.pswd, pro…
139 cmd = "%s pull" % (ud.basecmd)
141 if ud.user and ud.pswd:
142 …assword=%s --config \"auth.default.schemes=%s\" update -C %s" % (ud.basecmd, ud.user, ud.pswd, pro…
144 cmd = "%s update -C %s" % (ud.basecmd, " ".join(options))
146 raise FetchError("Invalid hg command %s" % command, ud.url)
150 def download(self, ud, d): argument
153 logger.debug2("Fetch: checking for module directory '" + ud.moddir + "'")
156 if not os.path.exists(ud.pkgdir) and os.path.exists(ud.fullmirror):
157 bb.utils.mkdirhier(ud.pkgdir)
158 runfetchcmd("tar -xzf %s" % (ud.fullmirror), d, workdir=ud.pkgdir)
160 if os.access(os.path.join(ud.moddir, '.hg'), os.R_OK):
162 updatecmd = self._buildhgcommand(ud, d, "update")
165 runfetchcmd(updatecmd, d, workdir=ud.moddir)
168 pullcmd = self._buildhgcommand(ud, d, "pull")
169 logger.info("Pulling " + ud.url)
172 bb.fetch2.check_network_access(d, pullcmd, ud.url)
173 runfetchcmd(pullcmd, d, workdir=ud.moddir)
175 os.unlink(ud.fullmirror)
181 if not os.path.exists(ud.moddir):
182 fetchcmd = self._buildhgcommand(ud, d, "fetch")
183 logger.info("Fetch " + ud.url)
185 bb.utils.mkdirhier(ud.pkgdir)
187 bb.fetch2.check_network_access(d, fetchcmd, ud.url)
188 runfetchcmd(fetchcmd, d, workdir=ud.pkgdir)
192 updatecmd = self._buildhgcommand(ud, d, "update")
194 runfetchcmd(updatecmd, d, workdir=ud.moddir)
196 def clean(self, ud, d): argument
199 bb.utils.remove(ud.localpath, True)
200 bb.utils.remove(ud.fullmirror)
201 bb.utils.remove(ud.fullmirror + ".done")
206 def _latest_revision(self, ud, d, name): argument
210 bb.fetch2.check_network_access(d, self._buildhgcommand(ud, d, "info"), ud.url)
211 output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d)
214 def _build_revision(self, ud, d, name): argument
215 return ud.revision
217 def _revision_key(self, ud, d, name): argument
221 return "hg:" + ud.moddir
223 def build_mirror_data(self, ud, d): argument
225 if ud.write_tarballs == "1" and not os.path.exists(ud.fullmirror):
227 if os.path.islink(ud.fullmirror):
228 os.unlink(ud.fullmirror)
231 runfetchcmd("tar -czf %s %s" % (ud.fullmirror, ud.module), d, workdir=ud.pkgdir)
232 runfetchcmd("touch %s.done" % (ud.fullmirror), d, workdir=ud.pkgdir)
234 def localpath(self, ud, d): argument
235 return ud.pkgdir
237 def unpack(self, ud, destdir, d): argument
242 revflag = "-r %s" % ud.revision
243 subdir = ud.parm.get("destsuffix", ud.module)
246 scmdata = ud.parm.get("scmdata", "")
248 proto = ud.parm.get('protocol', 'http')
251 runfetchcmd("%s init %s" % (ud.basecmd, codir), d)
253 if ud.user and ud.pswd:
254 …word=%s --config \"auth.default.schemes=%s\" pull %s" % (ud.basecmd, ud.user, ud.pswd, proto, ud.m…
256 runfetchcmd("%s pull %s" % (ud.basecmd, ud.moddir), d, workdir=codir)
257 if ud.user and ud.pswd:
258 …lt.password=%s --config \"auth.default.schemes=%s\" up -C %s" % (ud.basecmd, ud.user, ud.pswd, pro…
260 runfetchcmd("%s up -C %s" % (ud.basecmd, revflag), d, workdir=codir)
263 … runfetchcmd("%s archive -t files %s %s" % (ud.basecmd, revflag, codir), d, workdir=ud.moddir)