summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2014-08-22 01:31:27 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-08-23 23:01:34 +0100
commitc8c213bb25b137cf70ba8ce9a45e60065d926735 (patch)
treea0075af185985d9202c02ffe135c608da71a87bc /meta
parent7849e50107a27b0ff2aaac47480ac1a0a79533dc (diff)
downloadopenembedded-core-c8c213bb25b137cf70ba8ce9a45e60065d926735.tar.gz
openembedded-core-c8c213bb25b137cf70ba8ce9a45e60065d926735.tar.bz2
openembedded-core-c8c213bb25b137cf70ba8ce9a45e60065d926735.zip
sanity.bbclass: check the format of MIRRORS
Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS: * Each mirror shoudl contain two memebers. * The local "file://" url must use absolute path (file:///). * The protocol must in protocols list. Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sanity.bbclass33
1 files changed, 33 insertions, 0 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index 3b40ebec0a..dbcc26b184 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -753,6 +753,39 @@ def check_sanity_everybuild(status, d):
if oeroot.find(' ') != -1:
status.addresult("Error, you have a space in your COREBASE directory path. Please move the installation to a directory which doesn't include a space since autotools doesn't support this.")
+ # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
+ mir_types = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
+ protocols = ['http://', 'ftp://', 'file://', 'https://', 'https?$://', \
+ 'git://', 'gitsm://', 'hg://', 'osc://', 'p4://', 'svk://', 'svn://', \
+ 'bzr://', 'cvs://']
+ for mir_type in mir_types:
+ mirros = (d.getVar(mir_type, True) or '').split('\\n')
+ for mir in mirros:
+ mir_list = mir.split()
+ # Should be two members.
+ if len(mir_list) not in [0, 2]:
+ bb.warn('Invalid %s: %s, should be 2 members, but found %s.' \
+ % (mir_type, mir.strip(), len(mir_list)))
+ elif len(mir_list) == 2:
+ # Each member should start with protocols
+ valid_protocol_0 = False
+ valid_protocol_1 = False
+ file_absolute = True
+ for protocol in protocols:
+ if not valid_protocol_0 and mir_list[0].startswith(protocol):
+ valid_protocol_0 = True
+ if not valid_protocol_1 and mir_list[1].startswith(protocol):
+ valid_protocol_1 = True
+ # The file:// must be an absolute path.
+ if protocol == 'file://' and not mir_list[1].startswith('file:///'):
+ file_absolute = False
+ if valid_protocol_0 and valid_protocol_1:
+ break
+ if not (valid_protocol_0 and valid_protocol_1):
+ bb.warn('Invalid protocol in %s: %s' % (mir_type, mir.strip()))
+ if not file_absolute:
+ bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mir_type, mir.strip()))
+
# Check that TMPDIR hasn't changed location since the last time we were run
tmpdir = d.getVar('TMPDIR', True)
checkfile = os.path.join(tmpdir, "saved_tmpdir")