summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/sanity.bbclass73
1 files changed, 35 insertions, 38 deletions
diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
index f655d8bf61..5be5efb8a4 100644
--- a/meta/classes/sanity.bbclass
+++ b/meta/classes/sanity.bbclass
@@ -755,44 +755,41 @@ def check_sanity_everybuild(status, d):
755 755
756 # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS 756 # Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS
757 import re 757 import re
758 mir_types = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS'] 758 mirror_vars = ['MIRRORS', 'PREMIRRORS', 'SSTATE_MIRRORS']
759 protocols = ['http://', 'ftp://', 'file://', 'https://', \ 759 protocols = ['http', 'ftp', 'file', 'https', \
760 'git://', 'gitsm://', 'hg://', 'osc://', 'p4://', 'svk://', 'svn://', \ 760 'git', 'gitsm', 'hg', 'osc', 'p4', 'svk', 'svn', \
761 'bzr://', 'cvs://'] 761 'bzr', 'cvs']
762 for mir_type in mir_types: 762 for mirror_var in mirror_vars:
763 mirros = (d.getVar(mir_type, True) or '').replace('\\n', '\n').split('\n') 763 mirrors = (d.getVar(mirror_var, True) or '').replace('\\n', '\n').split('\n')
764 for mir in mirros: 764 for mirror_entry in mirrors:
765 mir_list = mir.split() 765 mirror_entry = mirror_entry.strip()
766 # Should be two members. 766 if not mirror_entry:
767 if len(mir_list) not in [0, 2]: 767 # ignore blank lines
768 bb.warn('Invalid %s: %s, should be 2 members, but found %s.' \ 768 continue
769 % (mir_type, mir.strip(), len(mir_list))) 769
770 elif len(mir_list) == 2: 770 try:
771 decoded = bb.fetch2.decodeurl(mir_list[0]) 771 pattern, mirror = mirror_entry.split()
772 try: 772 except ValueError:
773 pattern_scheme = re.compile(decoded[0]) 773 bb.warn('Invalid %s: %s, should be 2 members.' % (mirror_var, mirror_entry.strip()))
774 except re.error as exc: 774 continue
775 bb.warn('Invalid scheme regex (%s) in %s: %s' % (decoded[0], mir_type, mir.strip())) 775
776 continue 776 decoded = bb.fetch2.decodeurl(pattern)
777 777 try:
778 # Each member should start with protocols 778 pattern_scheme = re.compile(decoded[0])
779 valid_protocol_0 = False 779 except re.error as exc:
780 valid_protocol_1 = False 780 bb.warn('Invalid scheme regex (%s) in %s; %s' % (pattern, mirror_var, mirror_entry))
781 file_absolute = True 781 continue
782 for protocol in protocols: 782
783 if not valid_protocol_0 and pattern_scheme.match(protocol[:-3]): 783 if not any(pattern_scheme.match(protocol) for protocol in protocols):
784 valid_protocol_0 = True 784 bb.warn('Invalid protocol (%s) in %s: %s' % (decoded[0], mirror_var, mirror_entry))
785 if not valid_protocol_1 and mir_list[1].startswith(protocol): 785 continue
786 valid_protocol_1 = True 786
787 # The file:// must be an absolute path. 787 if not any(mirror.startswith(protocol + '://') for protocol in protocols):
788 if protocol == 'file://' and not mir_list[1].startswith('file:///'): 788 bb.warn('Invalid protocol in %s: %s' % (mirror_var, mirror_entry))
789 file_absolute = False 789 continue
790 if valid_protocol_0 and valid_protocol_1: 790
791 break 791 if mirror.startswith('file://') and not mirror.startswith('file:///'):
792 if not (valid_protocol_0 and valid_protocol_1): 792 bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mirror_var, mirror_entry))
793 bb.warn('Invalid protocol in %s: %s' % (mir_type, mir.strip()))
794 if not file_absolute:
795 bb.warn('Invalid file url in %s: %s, must be absolute path (file:///)' % (mir_type, mir.strip()))
796 793
797 # Check that TMPDIR hasn't changed location since the last time we were run 794 # Check that TMPDIR hasn't changed location since the last time we were run
798 tmpdir = d.getVar('TMPDIR', True) 795 tmpdir = d.getVar('TMPDIR', True)