diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 20 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 15 |
2 files changed, 29 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index f4cff03225..8b6c3eed6c 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -867,12 +867,6 @@ def srcrev_internal_helper(ud, d, name): | |||
867 | c) None if not specified | 867 | c) None if not specified |
868 | """ | 868 | """ |
869 | 869 | ||
870 | if 'rev' in ud.parm: | ||
871 | return ud.parm['rev'] | ||
872 | |||
873 | if 'tag' in ud.parm: | ||
874 | return ud.parm['tag'] | ||
875 | |||
876 | srcrev = None | 870 | srcrev = None |
877 | pn = d.getVar("PN", True) | 871 | pn = d.getVar("PN", True) |
878 | attempts = [] | 872 | attempts = [] |
@@ -889,6 +883,20 @@ def srcrev_internal_helper(ud, d, name): | |||
889 | if srcrev and srcrev != "INVALID": | 883 | if srcrev and srcrev != "INVALID": |
890 | break | 884 | break |
891 | 885 | ||
886 | if 'rev' in ud.parm and 'tag' in ud.parm: | ||
887 | raise FetchError("Please specify a ;rev= parameter or a ;tag= parameter in the url %s but not both." % (ud.url)) | ||
888 | |||
889 | if 'rev' in ud.parm or 'tag' in ud.parm: | ||
890 | if 'rev' in ud.parm: | ||
891 | parmrev = ud.parm['rev'] | ||
892 | else: | ||
893 | parmrev = ud.parm['tag'] | ||
894 | if srcrev == "INVALID" or not srcrev: | ||
895 | return parmrev | ||
896 | if srcrev != parmrev: | ||
897 | raise FetchError("Conflicting revisions (%s from SRCREV and %s from the url) found, please spcify one valid value" % (srcrev, parmrev)) | ||
898 | return parmrev | ||
899 | |||
892 | rev = srcrev | 900 | rev = srcrev |
893 | if rev == "INVALID" or not rev: | 901 | if rev == "INVALID" or not rev: |
894 | var = "SRCREV_pn-%s" % pn | 902 | var = "SRCREV_pn-%s" % pn |
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index e134a31f12..deb1d3733b 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -382,6 +382,21 @@ class FetcherNetworkTest(FetcherTest): | |||
382 | url1 = url2 = "git://git.openembedded.org/bitbake" | 382 | url1 = url2 = "git://git.openembedded.org/bitbake" |
383 | self.gitfetcher(url1, url2) | 383 | self.gitfetcher(url1, url2) |
384 | 384 | ||
385 | def test_gitfetch_goodsrcrev(self): | ||
386 | # SRCREV is set but matches rev= parameter | ||
387 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5" | ||
388 | self.gitfetcher(url1, url2) | ||
389 | |||
390 | def test_gitfetch_badsrcrev(self): | ||
391 | # SRCREV is set but does not match rev= parameter | ||
392 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=dead05b0b4ba0959fe0624d2a4885d7b70426da5" | ||
393 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) | ||
394 | |||
395 | def test_gitfetch_tagandrev(self): | ||
396 | # SRCREV is set but does not match rev= parameter | ||
397 | url1 = url2 = "git://git.openembedded.org/bitbake;rev=270a05b0b4ba0959fe0624d2a4885d7b70426da5;tag=270a05b0b4ba0959fe0624d2a4885d7b70426da5" | ||
398 | self.assertRaises(bb.fetch.FetchError, self.gitfetcher, url1, url2) | ||
399 | |||
385 | def test_gitfetch_premirror(self): | 400 | def test_gitfetch_premirror(self): |
386 | url1 = "git://git.openembedded.org/bitbake" | 401 | url1 = "git://git.openembedded.org/bitbake" |
387 | url2 = "git://someserver.org/bitbake" | 402 | url2 = "git://someserver.org/bitbake" |