1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

bitbake/fetch2: Move ud.localfile setup into urldata_init

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2011-02-03 21:17:26 +00:00
parent 0e5404ceda
commit 972eb5faba
12 changed files with 30 additions and 22 deletions
+2 -2
View File
@@ -42,12 +42,12 @@ class Bzr(Fetch):
relpath = self._strip_leading_slashes(ud.path) relpath = self._strip_leading_slashes(ud.path)
ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath) ud.pkgdir = os.path.join(data.expand('${BZRDIR}', d), ud.host, relpath)
def localpath (self, url, ud, d):
if not ud.revision: if not ud.revision:
ud.revision = self.latest_revision(url, ud, d) ud.revision = self.latest_revision(ud.url, ud, d)
ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d)
def localpath (self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildbzrcommand(self, ud, d, command): def _buildbzrcommand(self, ud, d, command):
+2 -1
View File
@@ -42,7 +42,7 @@ class Cvs(Fetch):
""" """
return ud.type in ['cvs'] return ud.type in ['cvs']
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
if not "module" in ud.parm: if not "module" in ud.parm:
raise MissingParameterError("cvs method needs a 'module' parameter") raise MissingParameterError("cvs method needs a 'module' parameter")
ud.module = ud.parm["module"] ud.module = ud.parm["module"]
@@ -65,6 +65,7 @@ class Cvs(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s%s%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date, norecurse, fullpath), d) ud.localfile = data.expand('%s_%s_%s_%s%s%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.tag, ud.date, norecurse, fullpath), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d): def forcefetch(self, url, ud, d):
+1 -1
View File
@@ -71,13 +71,13 @@ class Git(Fetch):
ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git" ud.basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
def localpath(self, url, ud, d):
for name in ud.names: for name in ud.names:
if not ud.revisions[name] or ud.revisions[name] == "master": if not ud.revisions[name] or ud.revisions[name] == "master":
ud.revisions[name] = self.latest_revision(url, ud, d, name) ud.revisions[name] = self.latest_revision(url, ud, d, name)
ud.localfile = ud.mirrortarball ud.localfile = ud.mirrortarball
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d): def forcefetch(self, url, ud, d):
+7 -7
View File
@@ -57,18 +57,18 @@ class Hg(Fetch):
ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath) ud.pkgdir = os.path.join(data.expand('${HGDIR}', d), ud.host, relpath)
ud.moddir = os.path.join(ud.pkgdir, ud.module) ud.moddir = os.path.join(ud.pkgdir, ud.module)
if 'rev' in ud.parm:
ud.revision = ud.parm['rev']
elif not ud.revision:
ud.revision = self.latest_revision(ud.url, ud, d)
ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)
def forcefetch(self, url, ud, d): def forcefetch(self, url, ud, d):
revTag = ud.parm.get('rev', 'tip') revTag = ud.parm.get('rev', 'tip')
return revTag == "tip" return revTag == "tip"
def localpath(self, url, ud, d): def localpath(self, url, ud, d):
if 'rev' in ud.parm:
ud.revision = ud.parm['rev']
elif not ud.revision:
ud.revision = self.latest_revision(url, ud, d)
ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d)
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildhgcommand(self, ud, d, command): def _buildhgcommand(self, ud, d, command):
+4 -1
View File
@@ -38,6 +38,10 @@ class Local(Fetch):
""" """
return urldata.type in ['file'] return urldata.type in ['file']
def urldata_init(self, ud, d):
# We don't set localfile as for this fetcher the file is already local!
return
def localpath(self, url, urldata, d): def localpath(self, url, urldata, d):
""" """
Return the local filename of a given url assuming a successful fetch. Return the local filename of a given url assuming a successful fetch.
@@ -53,7 +57,6 @@ class Local(Fetch):
filesdir = data.getVar('FILESDIR', d, 1) filesdir = data.getVar('FILESDIR', d, 1)
if filesdir: if filesdir:
newpath = os.path.join(filesdir, path) newpath = os.path.join(filesdir, path)
# We don't set localfile as for this fetcher the file is already local!
return newpath return newpath
def download(self, url, urldata, d): def download(self, url, urldata, d):
+2 -1
View File
@@ -26,7 +26,7 @@ class Osc(Fetch):
""" """
return ud.type in ['osc'] return ud.type in ['osc']
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
if not "module" in ud.parm: if not "module" in ud.parm:
raise MissingParameterError("osc method needs a 'module' parameter.") raise MissingParameterError("osc method needs a 'module' parameter.")
@@ -49,6 +49,7 @@ class Osc(Fetch):
ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d) ud.localfile = data.expand('%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.path.replace('/', '.'), ud.revision), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildosccommand(self, ud, d, command): def _buildosccommand(self, ud, d, command):
+3 -3
View File
@@ -98,9 +98,8 @@ class Perforce(Fetch):
return cset.split(' ')[1] return cset.split(' ')[1]
getcset = staticmethod(getcset) getcset = staticmethod(getcset)
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
(host, path, user, pswd, parm) = Perforce.doparse(ud.url, d)
(host, path, user, pswd, parm) = Perforce.doparse(url, d)
# If a label is specified, we use that as our filename # If a label is specified, we use that as our filename
@@ -119,6 +118,7 @@ class Perforce(Fetch):
ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d) ud.localfile = data.expand('%s+%s+%s.tar.gz' % (host, base.replace('/', '.'), cset), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, 1), ud.localfile)
def download(self, loc, ud, d): def download(self, loc, ud, d):
+2 -1
View File
@@ -37,7 +37,7 @@ class Repo(Fetch):
""" """
return ud.type in ["repo"] return ud.type in ["repo"]
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
""" """
We don"t care about the git rev of the manifests repository, but We don"t care about the git rev of the manifests repository, but
we do care about the manifest to use. The default is "default". we do care about the manifest to use. The default is "default".
@@ -53,6 +53,7 @@ class Repo(Fetch):
ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d) ud.localfile = data.expand("repo_%s%s_%s_%s.tar.gz" % (ud.host, ud.path.replace("/", "."), ud.manifest, ud.branch), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def download(self, loc, ud, d): def download(self, loc, ud, d):
+1 -1
View File
@@ -68,7 +68,7 @@ class SSH(Fetch):
return __pattern__.match(url) != None return __pattern__.match(url) != None
def localpath(self, url, urldata, d): def localpath(self, url, urldata, d):
m = __pattern__.match(url) m = __pattern__.match(urldata.url)
path = m.group('path') path = m.group('path')
host = m.group('host') host = m.group('host')
lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path)) lpath = os.path.join(data.getVar('DL_DIR', d, True), host, os.path.basename(path))
+3 -1
View File
@@ -42,7 +42,8 @@ class Svk(Fetch):
""" """
return ud.type in ['svk'] return ud.type in ['svk']
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
if not "module" in ud.parm: if not "module" in ud.parm:
raise MissingParameterError("svk method needs a 'module' parameter") raise MissingParameterError("svk method needs a 'module' parameter")
else: else:
@@ -52,6 +53,7 @@ class Svk(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def forcefetch(self, url, ud, d): def forcefetch(self, url, ud, d):
+1 -1
View File
@@ -56,7 +56,6 @@ class Svn(Fetch):
ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath) ud.pkgdir = os.path.join(data.expand('${SVNDIR}', d), ud.host, relpath)
ud.moddir = os.path.join(ud.pkgdir, ud.module) ud.moddir = os.path.join(ud.pkgdir, ud.module)
def localpath(self, url, ud, d):
if 'rev' in ud.parm: if 'rev' in ud.parm:
ud.date = "" ud.date = ""
ud.revision = ud.parm['rev'] ud.revision = ud.parm['rev']
@@ -79,6 +78,7 @@ class Svn(Fetch):
ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d) ud.localfile = data.expand('%s_%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision, ud.date), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def _buildsvncommand(self, ud, d, command): def _buildsvncommand(self, ud, d, command):
+2 -2
View File
@@ -40,12 +40,12 @@ class Wget(Fetch):
""" """
return ud.type in ['http', 'https', 'ftp'] return ud.type in ['http', 'https', 'ftp']
def localpath(self, url, ud, d): def urldata_init(self, ud, d):
url = encodeurl([ud.type, ud.host, ud.path, ud.user, ud.pswd, {}])
ud.basename = os.path.basename(ud.path) ud.basename = os.path.basename(ud.path)
ud.localfile = data.expand(urllib.unquote(ud.basename), d) ud.localfile = data.expand(urllib.unquote(ud.basename), d)
def localpath(self, url, ud, d):
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
def download(self, uri, ud, d, checkonly = False): def download(self, uri, ud, d, checkonly = False):