summaryrefslogtreecommitdiff
path: root/bitbake-dev/lib/bb/fetch
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake-dev/lib/bb/fetch')
-rw-r--r--bitbake-dev/lib/bb/fetch/__init__.py8
-rw-r--r--bitbake-dev/lib/bb/fetch/bzr.py1
-rw-r--r--bitbake-dev/lib/bb/fetch/cvs.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/git.py28
-rw-r--r--bitbake-dev/lib/bb/fetch/hg.py11
-rw-r--r--bitbake-dev/lib/bb/fetch/local.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/perforce.py3
-rw-r--r--bitbake-dev/lib/bb/fetch/ssh.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/svk.py3
-rw-r--r--bitbake-dev/lib/bb/fetch/svn.py2
-rw-r--r--bitbake-dev/lib/bb/fetch/wget.py2
11 files changed, 31 insertions, 33 deletions
diff --git a/bitbake-dev/lib/bb/fetch/__init__.py b/bitbake-dev/lib/bb/fetch/__init__.py
index 3333a278e..363358499 100644
--- a/bitbake-dev/lib/bb/fetch/__init__.py
+++ b/bitbake-dev/lib/bb/fetch/__init__.py
@@ -24,16 +24,11 @@ BitBake build tools.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re, fcntl
+import os, re
import bb
from bb import data
from bb import persist_data
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
class FetchError(Exception):
"""Exception raised when a download fails"""
@@ -65,7 +60,6 @@ def uri_replace(uri, uri_find, uri_replace, d):
result_decoded[loc] = uri_decoded[loc]
import types
if type(i) == types.StringType:
- import re
if (re.match(i, uri_decoded[loc])):
result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc])
if uri_find_decoded.index(i) == 2:
diff --git a/bitbake-dev/lib/bb/fetch/bzr.py b/bitbake-dev/lib/bb/fetch/bzr.py
index b23e9eef8..b27fb63d0 100644
--- a/bitbake-dev/lib/bb/fetch/bzr.py
+++ b/bitbake-dev/lib/bb/fetch/bzr.py
@@ -29,7 +29,6 @@ import bb
from bb import data
from bb.fetch import Fetch
from bb.fetch import FetchError
-from bb.fetch import MissingParameterError
from bb.fetch import runfetchcmd
class Bzr(Fetch):
diff --git a/bitbake-dev/lib/bb/fetch/cvs.py b/bitbake-dev/lib/bb/fetch/cvs.py
index aa55ad8bf..d8bd4eaf7 100644
--- a/bitbake-dev/lib/bb/fetch/cvs.py
+++ b/bitbake-dev/lib/bb/fetch/cvs.py
@@ -26,7 +26,7 @@ BitBake build tools.
#Based on functions from the base bb module, Copyright 2003 Holger Schurig
#
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
diff --git a/bitbake-dev/lib/bb/fetch/git.py b/bitbake-dev/lib/bb/fetch/git.py
index 010a4f57a..6456403e1 100644
--- a/bitbake-dev/lib/bb/fetch/git.py
+++ b/bitbake-dev/lib/bb/fetch/git.py
@@ -20,11 +20,10 @@ BitBake 'Fetch' git implementation
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
-from bb.fetch import FetchError
from bb.fetch import runfetchcmd
class Git(Fetch):
@@ -37,9 +36,12 @@ class Git(Fetch):
def localpath(self, url, ud, d):
- ud.proto = "rsync"
if 'protocol' in ud.parm:
ud.proto = ud.parm['protocol']
+ elif not ud.host:
+ ud.proto = 'file'
+ else:
+ ud.proto = "rsync"
ud.branch = ud.parm.get("branch", "master")
@@ -49,12 +51,9 @@ class Git(Fetch):
elif tag:
ud.tag = tag
- if not ud.tag:
+ if not ud.tag or ud.tag == "master":
ud.tag = self.latest_revision(url, ud, d)
- if ud.tag == "master":
- ud.tag = self.latest_revision(url, ud, d)
-
ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d)
return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile)
@@ -90,11 +89,12 @@ class Git(Fetch):
os.chdir(repodir)
# Remove all but the .git directory
- runfetchcmd("rm * -Rf", d)
- runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d)
- runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d)
- runfetchcmd("git prune-packed", d)
- runfetchcmd("git pack-redundant --all | xargs -r rm", d)
+ if not self._contains_ref(ud.tag, d):
+ runfetchcmd("rm * -Rf", d)
+ runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d)
+ runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d)
+ runfetchcmd("git prune-packed", d)
+ runfetchcmd("git pack-redundant --all | xargs -r rm", d)
os.chdir(repodir)
mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True)
@@ -120,6 +120,10 @@ class Git(Fetch):
def suppports_srcrev(self):
return True
+ def _contains_ref(self, tag, d):
+ output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True)
+ return output.split()[0] != "0"
+
def _revision_key(self, url, ud, d):
"""
Return a unique key for the url
diff --git a/bitbake-dev/lib/bb/fetch/hg.py b/bitbake-dev/lib/bb/fetch/hg.py
index b87fd0fbe..f53be8b20 100644
--- a/bitbake-dev/lib/bb/fetch/hg.py
+++ b/bitbake-dev/lib/bb/fetch/hg.py
@@ -24,7 +24,7 @@ BitBake 'Fetch' implementation for mercurial DRCS (hg).
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import sys
import bb
from bb import data
@@ -123,9 +123,6 @@ class Hg(Fetch):
bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd)
runfetchcmd(updatecmd, d)
- updatecmd = self._buildhgcommand(ud, d, "update")
- bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd)
- runfetchcmd(updatecmd, d)
else:
fetchcmd = self._buildhgcommand(ud, d, "fetch")
bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc)
@@ -134,6 +131,12 @@ class Hg(Fetch):
os.chdir(ud.pkgdir)
bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd)
runfetchcmd(fetchcmd, d)
+
+ # Even when we clone (fetch), we still need to update as hg's clone
+ # won't checkout the specified revision if its on a branch
+ updatecmd = self._buildhgcommand(ud, d, "update")
+ bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd)
+ runfetchcmd(updatecmd, d)
os.chdir(ud.pkgdir)
try:
diff --git a/bitbake-dev/lib/bb/fetch/local.py b/bitbake-dev/lib/bb/fetch/local.py
index 54d598ae8..577774e59 100644
--- a/bitbake-dev/lib/bb/fetch/local.py
+++ b/bitbake-dev/lib/bb/fetch/local.py
@@ -25,7 +25,7 @@ BitBake build tools.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
diff --git a/bitbake-dev/lib/bb/fetch/perforce.py b/bitbake-dev/lib/bb/fetch/perforce.py
index 2fb38b419..394f5a225 100644
--- a/bitbake-dev/lib/bb/fetch/perforce.py
+++ b/bitbake-dev/lib/bb/fetch/perforce.py
@@ -25,12 +25,11 @@ BitBake build tools.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
from bb.fetch import FetchError
-from bb.fetch import MissingParameterError
class Perforce(Fetch):
def supports(self, url, ud, d):
diff --git a/bitbake-dev/lib/bb/fetch/ssh.py b/bitbake-dev/lib/bb/fetch/ssh.py
index 81a9892dc..68e6fdb1d 100644
--- a/bitbake-dev/lib/bb/fetch/ssh.py
+++ b/bitbake-dev/lib/bb/fetch/ssh.py
@@ -37,11 +37,9 @@ IETF secsh internet draft:
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import re, os
-import bb
from bb import data
from bb.fetch import Fetch
from bb.fetch import FetchError
-from bb.fetch import MissingParameterError
__pattern__ = re.compile(r'''
diff --git a/bitbake-dev/lib/bb/fetch/svk.py b/bitbake-dev/lib/bb/fetch/svk.py
index d863ccb6e..4dfae1819 100644
--- a/bitbake-dev/lib/bb/fetch/svk.py
+++ b/bitbake-dev/lib/bb/fetch/svk.py
@@ -25,7 +25,7 @@ This implementation is for svk. It is based on the svn implementation
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
@@ -67,6 +67,7 @@ class Svk(Fetch):
svkroot = ud.host + ud.path
+ # pyflakes claims date is not known... it looks right
svkcmd = "svk co -r {%s} %s/%s" % (date, svkroot, ud.module)
if ud.revision:
diff --git a/bitbake-dev/lib/bb/fetch/svn.py b/bitbake-dev/lib/bb/fetch/svn.py
index aead1629b..eef9862a8 100644
--- a/bitbake-dev/lib/bb/fetch/svn.py
+++ b/bitbake-dev/lib/bb/fetch/svn.py
@@ -23,7 +23,7 @@ BitBake 'Fetch' implementation for svn.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import sys
import bb
from bb import data
diff --git a/bitbake-dev/lib/bb/fetch/wget.py b/bitbake-dev/lib/bb/fetch/wget.py
index 442fc3e48..2a899c580 100644
--- a/bitbake-dev/lib/bb/fetch/wget.py
+++ b/bitbake-dev/lib/bb/fetch/wget.py
@@ -25,7 +25,7 @@ BitBake build tools.
#
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch