diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-12-11 17:09:26 +0000 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-12-11 17:12:53 +0000 |
commit | a94737f61117ef356094906e4333b056ed48d265 (patch) | |
tree | 8dc92085818b02bd74c573402db83f95a4a98081 /bitbake/lib/bb | |
parent | 7d937f0f4ab590d0aff75be895251e430c052ebc (diff) | |
download | openembedded-core-a94737f61117ef356094906e4333b056ed48d265.tar.gz openembedded-core-a94737f61117ef356094906e4333b056ed48d265.tar.bz2 openembedded-core-a94737f61117ef356094906e4333b056ed48d265.zip |
bitbake/git.py: Move variable init into the localpath function
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/fetch/git.py | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index 6e4e67c40f..5e7cf985f8 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py @@ -45,6 +45,10 @@ class Git(Fetch): ud.branch = ud.parm.get("branch", "master") + gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) + ud.mirrortarball = 'git_%s.tar.gz' % (gitsrcname) + ud.clonedir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) + tag = Fetch.srcrev_internal_helper(ud, d) if tag is True: ud.tag = self.latest_revision(url, ud, d) @@ -70,24 +74,20 @@ class Git(Fetch): else: username = "" - gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) - - repofilename = 'git_%s.tar.gz' % (gitsrcname) - repofile = os.path.join(data.getVar("DL_DIR", d, 1), repofilename) - repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) + repofile = os.path.join(data.getVar("DL_DIR", d, 1), ud.mirrortarbal) coname = '%s' % (ud.tag) - codir = os.path.join(repodir, coname) + codir = os.path.join(ud.clonedir, coname) - if not os.path.exists(repodir): - if Fetch.try_mirror(d, repofilename): - bb.mkdirhier(repodir) - os.chdir(repodir) + if not os.path.exists(ud.clonedir): + if Fetch.try_mirror(d, ud.mirrortarbal): + bb.mkdirhier(ud.clonedir) + os.chdir(ud.clonedir) runfetchcmd("tar -xzf %s" % (repofile), d) else: - runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, repodir), d) + runfetchcmd("git clone -n %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.clonedir), d) - os.chdir(repodir) + os.chdir(ud.clonedir) # Remove all but the .git directory if not self._contains_ref(ud.tag, d): runfetchcmd("rm * -Rf", d) @@ -96,7 +96,7 @@ class Git(Fetch): runfetchcmd("git prune-packed", d) runfetchcmd("git pack-redundant --all | xargs -r rm", d) - os.chdir(repodir) + os.chdir(ud.clonedir) mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) if mirror_tarballs != "0": bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") @@ -106,7 +106,7 @@ class Git(Fetch): bb.utils.prunedir(codir) bb.mkdirhier(codir) - os.chdir(repodir) + os.chdir(ud.clonedir) runfetchcmd("git read-tree %s" % (ud.tag), d) runfetchcmd("git checkout-index -q -f --prefix=%s -a" % (os.path.join(codir, "git", "")), d) @@ -114,7 +114,7 @@ class Git(Fetch): bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git checkout") runfetchcmd("tar -czf %s %s" % (ud.localpath, os.path.join(".", "*") ), d) - os.chdir(repodir) + os.chdir(ud.clonedir) bb.utils.prunedir(codir) def suppports_srcrev(self): @@ -157,8 +157,6 @@ class Git(Fetch): We will have to get the updated revision. """ - gitsrcname = '%s%s' % (ud.host, ud.path.replace('/', '.')) - repodir = os.path.join(data.expand('${GITDIR}', d), gitsrcname) key = "GIT_CACHED_REVISION-%s-%s" % (gitsrcname, ud.tag) if bb.data.getVar(key, d): @@ -173,11 +171,11 @@ class Git(Fetch): cwd = os.getcwd() # Check if we have the rev already - if not os.path.exists(repodir): + if not os.path.exists(ud.clonedir): print "no repo" self.go(None, ud, d) - os.chdir(repodir) + os.chdir(ud.clonedir) if not self._contains_ref(ud.tag, d): self.go(None, ud, d) |