diff options
Diffstat (limited to 'bitbake-dev/lib/bb/fetch')
-rw-r--r-- | bitbake-dev/lib/bb/fetch/__init__.py | 8 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/bzr.py | 1 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/cvs.py | 2 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/git.py | 28 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/hg.py | 11 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/local.py | 2 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/perforce.py | 3 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/ssh.py | 2 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/svk.py | 3 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/svn.py | 2 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/wget.py | 2 |
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 3333a278e1..3633584992 100644 --- a/bitbake-dev/lib/bb/fetch/__init__.py +++ b/bitbake-dev/lib/bb/fetch/__init__.py | |||
@@ -24,16 +24,11 @@ BitBake build tools. | |||
24 | # | 24 | # |
25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
26 | 26 | ||
27 | import os, re, fcntl | 27 | import os, re |
28 | import bb | 28 | import bb |
29 | from bb import data | 29 | from bb import data |
30 | from bb import persist_data | 30 | from bb import persist_data |
31 | 31 | ||
32 | try: | ||
33 | import cPickle as pickle | ||
34 | except ImportError: | ||
35 | import pickle | ||
36 | |||
37 | class FetchError(Exception): | 32 | class FetchError(Exception): |
38 | """Exception raised when a download fails""" | 33 | """Exception raised when a download fails""" |
39 | 34 | ||
@@ -65,7 +60,6 @@ def uri_replace(uri, uri_find, uri_replace, d): | |||
65 | result_decoded[loc] = uri_decoded[loc] | 60 | result_decoded[loc] = uri_decoded[loc] |
66 | import types | 61 | import types |
67 | if type(i) == types.StringType: | 62 | if type(i) == types.StringType: |
68 | import re | ||
69 | if (re.match(i, uri_decoded[loc])): | 63 | if (re.match(i, uri_decoded[loc])): |
70 | result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) | 64 | result_decoded[loc] = re.sub(i, uri_replace_decoded[loc], uri_decoded[loc]) |
71 | if uri_find_decoded.index(i) == 2: | 65 | 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 b23e9eef86..b27fb63d07 100644 --- a/bitbake-dev/lib/bb/fetch/bzr.py +++ b/bitbake-dev/lib/bb/fetch/bzr.py | |||
@@ -29,7 +29,6 @@ import bb | |||
29 | from bb import data | 29 | from bb import data |
30 | from bb.fetch import Fetch | 30 | from bb.fetch import Fetch |
31 | from bb.fetch import FetchError | 31 | from bb.fetch import FetchError |
32 | from bb.fetch import MissingParameterError | ||
33 | from bb.fetch import runfetchcmd | 32 | from bb.fetch import runfetchcmd |
34 | 33 | ||
35 | class Bzr(Fetch): | 34 | class Bzr(Fetch): |
diff --git a/bitbake-dev/lib/bb/fetch/cvs.py b/bitbake-dev/lib/bb/fetch/cvs.py index aa55ad8bf6..d8bd4eaf75 100644 --- a/bitbake-dev/lib/bb/fetch/cvs.py +++ b/bitbake-dev/lib/bb/fetch/cvs.py | |||
@@ -26,7 +26,7 @@ BitBake build tools. | |||
26 | #Based on functions from the base bb module, Copyright 2003 Holger Schurig | 26 | #Based on functions from the base bb module, Copyright 2003 Holger Schurig |
27 | # | 27 | # |
28 | 28 | ||
29 | import os, re | 29 | import os |
30 | import bb | 30 | import bb |
31 | from bb import data | 31 | from bb import data |
32 | from bb.fetch import Fetch | 32 | from bb.fetch import Fetch |
diff --git a/bitbake-dev/lib/bb/fetch/git.py b/bitbake-dev/lib/bb/fetch/git.py index 010a4f57a2..6456403e14 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 | |||
20 | # with this program; if not, write to the Free Software Foundation, Inc., | 20 | # with this program; if not, write to the Free Software Foundation, Inc., |
21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
22 | 22 | ||
23 | import os, re | 23 | import os |
24 | import bb | 24 | import bb |
25 | from bb import data | 25 | from bb import data |
26 | from bb.fetch import Fetch | 26 | from bb.fetch import Fetch |
27 | from bb.fetch import FetchError | ||
28 | from bb.fetch import runfetchcmd | 27 | from bb.fetch import runfetchcmd |
29 | 28 | ||
30 | class Git(Fetch): | 29 | class Git(Fetch): |
@@ -37,9 +36,12 @@ class Git(Fetch): | |||
37 | 36 | ||
38 | def localpath(self, url, ud, d): | 37 | def localpath(self, url, ud, d): |
39 | 38 | ||
40 | ud.proto = "rsync" | ||
41 | if 'protocol' in ud.parm: | 39 | if 'protocol' in ud.parm: |
42 | ud.proto = ud.parm['protocol'] | 40 | ud.proto = ud.parm['protocol'] |
41 | elif not ud.host: | ||
42 | ud.proto = 'file' | ||
43 | else: | ||
44 | ud.proto = "rsync" | ||
43 | 45 | ||
44 | ud.branch = ud.parm.get("branch", "master") | 46 | ud.branch = ud.parm.get("branch", "master") |
45 | 47 | ||
@@ -49,12 +51,9 @@ class Git(Fetch): | |||
49 | elif tag: | 51 | elif tag: |
50 | ud.tag = tag | 52 | ud.tag = tag |
51 | 53 | ||
52 | if not ud.tag: | 54 | if not ud.tag or ud.tag == "master": |
53 | ud.tag = self.latest_revision(url, ud, d) | 55 | ud.tag = self.latest_revision(url, ud, d) |
54 | 56 | ||
55 | if ud.tag == "master": | ||
56 | ud.tag = self.latest_revision(url, ud, d) | ||
57 | |||
58 | ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d) | 57 | ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d) |
59 | 58 | ||
60 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 59 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
@@ -90,11 +89,12 @@ class Git(Fetch): | |||
90 | 89 | ||
91 | os.chdir(repodir) | 90 | os.chdir(repodir) |
92 | # Remove all but the .git directory | 91 | # Remove all but the .git directory |
93 | runfetchcmd("rm * -Rf", d) | 92 | if not self._contains_ref(ud.tag, d): |
94 | runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d) | 93 | runfetchcmd("rm * -Rf", d) |
95 | runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d) | 94 | runfetchcmd("git fetch %s://%s%s%s %s" % (ud.proto, username, ud.host, ud.path, ud.branch), d) |
96 | runfetchcmd("git prune-packed", d) | 95 | runfetchcmd("git fetch --tags %s://%s%s%s" % (ud.proto, username, ud.host, ud.path), d) |
97 | runfetchcmd("git pack-redundant --all | xargs -r rm", d) | 96 | runfetchcmd("git prune-packed", d) |
97 | runfetchcmd("git pack-redundant --all | xargs -r rm", d) | ||
98 | 98 | ||
99 | os.chdir(repodir) | 99 | os.chdir(repodir) |
100 | mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) | 100 | mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) |
@@ -120,6 +120,10 @@ class Git(Fetch): | |||
120 | def suppports_srcrev(self): | 120 | def suppports_srcrev(self): |
121 | return True | 121 | return True |
122 | 122 | ||
123 | def _contains_ref(self, tag, d): | ||
124 | output = runfetchcmd("git log --pretty=oneline -n 1 %s -- 2> /dev/null | wc -l" % tag, d, quiet=True) | ||
125 | return output.split()[0] != "0" | ||
126 | |||
123 | def _revision_key(self, url, ud, d): | 127 | def _revision_key(self, url, ud, d): |
124 | """ | 128 | """ |
125 | Return a unique key for the url | 129 | 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 b87fd0fbe5..f53be8b20b 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). | |||
24 | # | 24 | # |
25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
26 | 26 | ||
27 | import os, re | 27 | import os |
28 | import sys | 28 | import sys |
29 | import bb | 29 | import bb |
30 | from bb import data | 30 | from bb import data |
@@ -123,9 +123,6 @@ class Hg(Fetch): | |||
123 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) | 123 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) |
124 | runfetchcmd(updatecmd, d) | 124 | runfetchcmd(updatecmd, d) |
125 | 125 | ||
126 | updatecmd = self._buildhgcommand(ud, d, "update") | ||
127 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) | ||
128 | runfetchcmd(updatecmd, d) | ||
129 | else: | 126 | else: |
130 | fetchcmd = self._buildhgcommand(ud, d, "fetch") | 127 | fetchcmd = self._buildhgcommand(ud, d, "fetch") |
131 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) | 128 | bb.msg.note(1, bb.msg.domain.Fetcher, "Fetch " + loc) |
@@ -134,6 +131,12 @@ class Hg(Fetch): | |||
134 | os.chdir(ud.pkgdir) | 131 | os.chdir(ud.pkgdir) |
135 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd) | 132 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % fetchcmd) |
136 | runfetchcmd(fetchcmd, d) | 133 | runfetchcmd(fetchcmd, d) |
134 | |||
135 | # Even when we clone (fetch), we still need to update as hg's clone | ||
136 | # won't checkout the specified revision if its on a branch | ||
137 | updatecmd = self._buildhgcommand(ud, d, "update") | ||
138 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Running %s" % updatecmd) | ||
139 | runfetchcmd(updatecmd, d) | ||
137 | 140 | ||
138 | os.chdir(ud.pkgdir) | 141 | os.chdir(ud.pkgdir) |
139 | try: | 142 | try: |
diff --git a/bitbake-dev/lib/bb/fetch/local.py b/bitbake-dev/lib/bb/fetch/local.py index 54d598ae89..577774e597 100644 --- a/bitbake-dev/lib/bb/fetch/local.py +++ b/bitbake-dev/lib/bb/fetch/local.py | |||
@@ -25,7 +25,7 @@ BitBake build tools. | |||
25 | # | 25 | # |
26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
27 | 27 | ||
28 | import os, re | 28 | import os |
29 | import bb | 29 | import bb |
30 | from bb import data | 30 | from bb import data |
31 | from bb.fetch import Fetch | 31 | from bb.fetch import Fetch |
diff --git a/bitbake-dev/lib/bb/fetch/perforce.py b/bitbake-dev/lib/bb/fetch/perforce.py index 2fb38b4190..394f5a2253 100644 --- a/bitbake-dev/lib/bb/fetch/perforce.py +++ b/bitbake-dev/lib/bb/fetch/perforce.py | |||
@@ -25,12 +25,11 @@ BitBake build tools. | |||
25 | # | 25 | # |
26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
27 | 27 | ||
28 | import os, re | 28 | import os |
29 | import bb | 29 | import bb |
30 | from bb import data | 30 | from bb import data |
31 | from bb.fetch import Fetch | 31 | from bb.fetch import Fetch |
32 | from bb.fetch import FetchError | 32 | from bb.fetch import FetchError |
33 | from bb.fetch import MissingParameterError | ||
34 | 33 | ||
35 | class Perforce(Fetch): | 34 | class Perforce(Fetch): |
36 | def supports(self, url, ud, d): | 35 | 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 81a9892dcc..68e6fdb1df 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: | |||
37 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 37 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
38 | 38 | ||
39 | import re, os | 39 | import re, os |
40 | import bb | ||
41 | from bb import data | 40 | from bb import data |
42 | from bb.fetch import Fetch | 41 | from bb.fetch import Fetch |
43 | from bb.fetch import FetchError | 42 | from bb.fetch import FetchError |
44 | from bb.fetch import MissingParameterError | ||
45 | 43 | ||
46 | 44 | ||
47 | __pattern__ = re.compile(r''' | 45 | __pattern__ = re.compile(r''' |
diff --git a/bitbake-dev/lib/bb/fetch/svk.py b/bitbake-dev/lib/bb/fetch/svk.py index d863ccb6e0..4dfae1819b 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 | |||
25 | # | 25 | # |
26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
27 | 27 | ||
28 | import os, re | 28 | import os |
29 | import bb | 29 | import bb |
30 | from bb import data | 30 | from bb import data |
31 | from bb.fetch import Fetch | 31 | from bb.fetch import Fetch |
@@ -67,6 +67,7 @@ class Svk(Fetch): | |||
67 | 67 | ||
68 | svkroot = ud.host + ud.path | 68 | svkroot = ud.host + ud.path |
69 | 69 | ||
70 | # pyflakes claims date is not known... it looks right | ||
70 | svkcmd = "svk co -r {%s} %s/%s" % (date, svkroot, ud.module) | 71 | svkcmd = "svk co -r {%s} %s/%s" % (date, svkroot, ud.module) |
71 | 72 | ||
72 | if ud.revision: | 73 | if ud.revision: |
diff --git a/bitbake-dev/lib/bb/fetch/svn.py b/bitbake-dev/lib/bb/fetch/svn.py index aead1629b3..eef9862a84 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. | |||
23 | # | 23 | # |
24 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 24 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
25 | 25 | ||
26 | import os, re | 26 | import os |
27 | import sys | 27 | import sys |
28 | import bb | 28 | import bb |
29 | from bb import data | 29 | from bb import data |
diff --git a/bitbake-dev/lib/bb/fetch/wget.py b/bitbake-dev/lib/bb/fetch/wget.py index 442fc3e489..2a899c5808 100644 --- a/bitbake-dev/lib/bb/fetch/wget.py +++ b/bitbake-dev/lib/bb/fetch/wget.py | |||
@@ -25,7 +25,7 @@ BitBake build tools. | |||
25 | # | 25 | # |
26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 26 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
27 | 27 | ||
28 | import os, re | 28 | import os |
29 | import bb | 29 | import bb |
30 | from bb import data | 30 | from bb import data |
31 | from bb.fetch import Fetch | 31 | from bb.fetch import Fetch |