diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 19 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/bzr.py | 12 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/git.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/hg.py | 17 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/svn.py | 16 |
5 files changed, 47 insertions, 34 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index eed7095819..1d41033f54 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -170,6 +170,8 @@ def localpaths(d): | |||
170 | 170 | ||
171 | return local | 171 | return local |
172 | 172 | ||
173 | srcrev_internal_call = False | ||
174 | |||
173 | def get_srcrev(d): | 175 | def get_srcrev(d): |
174 | """ | 176 | """ |
175 | Return the version string for the current package | 177 | Return the version string for the current package |
@@ -178,6 +180,19 @@ def get_srcrev(d): | |||
178 | In the multi SCM case, we build a value based on SRCREV_FORMAT which must | 180 | In the multi SCM case, we build a value based on SRCREV_FORMAT which must |
179 | have been set. | 181 | have been set. |
180 | """ | 182 | """ |
183 | |||
184 | # | ||
185 | # Ugly code alert. localpath in the fetchers will try to evaluate SRCREV which | ||
186 | # could translate into a call to here. If it does, we need to catch this | ||
187 | # and provide some way so it knows get_srcrev is active instead of being | ||
188 | # some number etc. hence the srcrev_internal_call tracking and the magic | ||
189 | # "SRCREVINACTION" return value. | ||
190 | # | ||
191 | # Neater solutions welcome! | ||
192 | # | ||
193 | if bb.fetch.srcrev_internal_call: | ||
194 | return "SRCREVINACTION" | ||
195 | |||
181 | scms = [] | 196 | scms = [] |
182 | # Only call setup_localpath on URIs which suppports_srcrev() | 197 | # Only call setup_localpath on URIs which suppports_srcrev() |
183 | urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) | 198 | urldata = init(bb.data.getVar('SRC_URI', d, 1).split(), d, False) |
@@ -273,12 +288,14 @@ class FetchData(object): | |||
273 | def setup_localpath(self, d): | 288 | def setup_localpath(self, d): |
274 | self.setup = True | 289 | self.setup = True |
275 | if "localpath" in self.parm: | 290 | if "localpath" in self.parm: |
291 | # if user sets localpath for file, use it instead. | ||
276 | self.localpath = self.parm["localpath"] | 292 | self.localpath = self.parm["localpath"] |
277 | else: | 293 | else: |
294 | bb.fetch.srcrev_internal_call = True | ||
278 | self.localpath = self.method.localpath(self.url, self, d) | 295 | self.localpath = self.method.localpath(self.url, self, d) |
296 | bb.fetch.srcrev_internal_call = False | ||
279 | self.md5 = self.localpath + '.md5' | 297 | self.md5 = self.localpath + '.md5' |
280 | self.lockfile = self.localpath + '.lock' | 298 | self.lockfile = self.localpath + '.lock' |
281 | # if user sets localpath for file, use it instead. | ||
282 | 299 | ||
283 | 300 | ||
284 | class Fetch(object): | 301 | class Fetch(object): |
diff --git a/bitbake/lib/bb/fetch/bzr.py b/bitbake/lib/bb/fetch/bzr.py index c66d17fdd2..76dde3a0bd 100644 --- a/bitbake/lib/bb/fetch/bzr.py +++ b/bitbake/lib/bb/fetch/bzr.py | |||
@@ -48,16 +48,14 @@ class Bzr(Fetch): | |||
48 | if 'rev' in ud.parm: | 48 | if 'rev' in ud.parm: |
49 | ud.revision = ud.parm['rev'] | 49 | ud.revision = ud.parm['rev'] |
50 | else: | 50 | else: |
51 | # ***Nasty hack*** | 51 | rev = data.getVar("SRCREV", d, 1) |
52 | rev = data.getVar("SRCREV", d, 0) | 52 | if rev is "SRCREVINACTION": |
53 | if rev and "get_srcrev" in rev: | 53 | rev = self.latest_revision(url, ud, d) |
54 | ud.revision = self.latest_revision(url, ud, d) | 54 | if rev: |
55 | elif rev: | ||
56 | ud.revision = rev | 55 | ud.revision = rev |
57 | else: | 56 | else: |
58 | ud.revision = "" | 57 | ud.revision = "" |
59 | 58 | ||
60 | |||
61 | ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) | 59 | ud.localfile = data.expand('bzr_%s_%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.revision), d) |
62 | 60 | ||
63 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) | 61 | return os.path.join(data.getVar("DL_DIR", d, True), ud.localfile) |
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index 7d55ee9138..c26ee3fff3 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py | |||
@@ -50,12 +50,15 @@ class Git(Fetch): | |||
50 | if 'protocol' in ud.parm: | 50 | if 'protocol' in ud.parm: |
51 | ud.proto = ud.parm['protocol'] | 51 | ud.proto = ud.parm['protocol'] |
52 | 52 | ||
53 | tag = data.getVar("SRCREV", d, 0) | 53 | tag = data.getVar("SRCREV", d, 1) |
54 | if 'tag' in ud.parm: | 54 | if 'tag' in ud.parm: |
55 | ud.tag = ud.parm['tag'] | 55 | ud.tag = ud.parm['tag'] |
56 | elif tag and "get_srcrev" not in tag and len(tag) == 40: | 56 | elif tag is "SRCREVINACTION": |
57 | ud.tag = tag | 57 | ud.tag = self.latest_revision(url, ud, d) |
58 | else: | 58 | else: |
59 | ud.tag = tag | ||
60 | |||
61 | if ud.tag == "master": | ||
59 | ud.tag = self.latest_revision(url, ud, d) | 62 | ud.tag = self.latest_revision(url, ud, d) |
60 | 63 | ||
61 | ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d) | 64 | ud.localfile = data.expand('git_%s%s_%s.tar.gz' % (ud.host, ud.path.replace('/', '.'), ud.tag), d) |
@@ -93,12 +96,12 @@ class Git(Fetch): | |||
93 | runfetchcmd("git pull --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d) | 96 | runfetchcmd("git pull --tags %s://%s%s" % (ud.proto, ud.host, ud.path), d) |
94 | runfetchcmd("git prune-packed", d) | 97 | runfetchcmd("git prune-packed", d) |
95 | runfetchcmd("git pack-redundant --all | xargs -r rm", d) | 98 | runfetchcmd("git pack-redundant --all | xargs -r rm", d) |
96 | # old method of downloading tags | ||
97 | #runfetchcmd("rsync -a --verbose --stats --progress rsync://%s%s/ %s" % (ud.host, ud.path, os.path.join(repodir, ".git", "")), d) | ||
98 | 99 | ||
99 | os.chdir(repodir) | 100 | os.chdir(repodir) |
100 | bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") | 101 | mirror_tarballs = data.getVar("BB_GENERATE_MIRROR_TARBALLS", d, True) |
101 | runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) | 102 | if mirror_tarballs != "0": |
103 | bb.msg.note(1, bb.msg.domain.Fetcher, "Creating tarball of git repository") | ||
104 | runfetchcmd("tar -czf %s %s" % (repofile, os.path.join(".", ".git", "*") ), d) | ||
102 | 105 | ||
103 | if os.path.exists(codir): | 106 | if os.path.exists(codir): |
104 | prunedir(codir) | 107 | prunedir(codir) |
diff --git a/bitbake/lib/bb/fetch/hg.py b/bitbake/lib/bb/fetch/hg.py index 8e8073e56d..6b93822803 100644 --- a/bitbake/lib/bb/fetch/hg.py +++ b/bitbake/lib/bb/fetch/hg.py | |||
@@ -57,15 +57,14 @@ class Hg(Fetch): | |||
57 | 57 | ||
58 | if 'rev' in ud.parm: | 58 | if 'rev' in ud.parm: |
59 | ud.revision = ud.parm['rev'] | 59 | ud.revision = ud.parm['rev'] |
60 | else: | 60 | #else: |
61 | # | 61 | # rev = data.getVar("SRCREV", d, 1) |
62 | rev = data.getVar("SRCREV", d, 0) | 62 | # if rev is "SRCREVINACTION": |
63 | if rev and "get_srcrev" in rev: | 63 | # rev = self.latest_revision(url, ud, d) |
64 | ud.revision = self.latest_revision(url, ud, d) | 64 | # if rev: |
65 | elif rev: | 65 | # ud.revision = rev |
66 | ud.revision = rev | 66 | # else: |
67 | else: | 67 | # ud.revision = "" |
68 | ud.revision = "" | ||
69 | 68 | ||
70 | ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d) | 69 | ud.localfile = data.expand('%s_%s_%s_%s.tar.gz' % (ud.module.replace('/', '.'), ud.host, ud.path.replace('/', '.'), ud.revision), d) |
71 | 70 | ||
diff --git a/bitbake/lib/bb/fetch/svn.py b/bitbake/lib/bb/fetch/svn.py index 95b21fe20c..c3cebc390d 100644 --- a/bitbake/lib/bb/fetch/svn.py +++ b/bitbake/lib/bb/fetch/svn.py | |||
@@ -62,22 +62,18 @@ class Svn(Fetch): | |||
62 | ud.revision = "" | 62 | ud.revision = "" |
63 | else: | 63 | else: |
64 | # | 64 | # |
65 | # ***Nasty hacks*** | 65 | # ***Nasty hack*** |
66 | # If DATE in unexpanded PV, use ud.date (which is set from SRCDATE) | 66 | # If DATE in unexpanded PV, use ud.date (which is set from SRCDATE) |
67 | # Will warn people to switch to SRCREV here | 67 | # Should warn people to switch to SRCREV here |
68 | # | ||
69 | # How can we tell when a user has overriden SRCDATE? | ||
70 | # check for "get_srcdate" in unexpanded SRCREV - ugly | ||
71 | # | 68 | # |
72 | pv = data.getVar("PV", d, 0) | 69 | pv = data.getVar("PV", d, 0) |
73 | if "DATE" in pv: | 70 | if "DATE" in pv: |
74 | ud.revision = "" | 71 | ud.revision = "" |
75 | else: | 72 | else: |
76 | rev = data.getVar("SRCREV", d, 0) | 73 | rev = data.getVar("SRCREV", d, 1) |
77 | if rev and "get_srcrev" in rev: | 74 | if rev is "SRCREVINACTION": |
78 | ud.revision = self.latest_revision(url, ud, d) | 75 | rev = self.latest_revision(url, ud, d) |
79 | ud.date = "" | 76 | if rev: |
80 | elif rev: | ||
81 | ud.revision = rev | 77 | ud.revision = rev |
82 | ud.date = "" | 78 | ud.date = "" |
83 | else: | 79 | else: |