Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Martin Jansa <martin.jansa@gmail.com>
To: openembedded-core@lists.openembedded.org,
	Robert Yang <liezhi.yang@windriver.com>
Cc: openembedded-commits@lists.openembedded.org
Subject: Re: [oe-commits] Robert Yang : sanity.bbclass: check the format of MIRRORS
Date: Sun, 24 Aug 2014 17:56:25 +0200	[thread overview]
Message-ID: <20140824155625.GJ20524@jama> (raw)
In-Reply-To: <20140823220223.0DA1E50496@opal.openembedded.org>

[-- Attachment #1: Type: text/plain, Size: 4450 bytes --]

On Sat, Aug 23, 2014 at 10:02:23PM +0000, git@git.openembedded.org wrote:
> Module: openembedded-core.git
> Branch: master
> Commit: c8c213bb25b137cf70ba8ce9a45e60065d926735
> URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=c8c213bb25b137cf70ba8ce9a45e60065d926735
> 
> Author: Robert Yang <liezhi.yang@windriver.com>
> Date:   Fri Aug 22 01:31:27 2014 -0700
> 
> sanity.bbclass: check the format of MIRRORS
> 
> Check the format of MIRRORS, PREMIRRORS and SSTATE_MIRRORS:
> * Each mirror shoudl contain two memebers.

shoudl -> should

> * The local "file://" url must use absolute path (file:///).
> * The protocol must in protocols list.

must "be"? seems like something is missing

> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
> 
> ---
> 
>  meta/classes/sanity.bbclass | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass
> index 3b40ebe..dbcc26b 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')

Is the "\n" (followed by actuall line break) really required as separator?

openembedded-core/meta/classes/own-mirrors.bbclass doesn't separate the
entries with "\n".

and bitbake code seems to handle them both:
def mirror_from_string(data):
    return [ i.split() for i in (data or "").replace('\\n','\n').split('\n') if i ]

If you want to unify the format to enforce "\\n" then I think it would
be better to show the warning in bitbake fetcher, not in stanity.bbclass

Also the list of supported protocols would be IMHO better in bitbake fetcher module.

> +        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")
> 
> -- 
> _______________________________________________
> Openembedded-commits mailing list
> Openembedded-commits@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-commits

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 188 bytes --]

       reply	other threads:[~2014-08-24 15:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140823220223.0DA1E50496@opal.openembedded.org>
2014-08-24 15:56 ` Martin Jansa [this message]
2014-08-25  2:14   ` [oe-commits] Robert Yang : sanity.bbclass: check the format of MIRRORS Robert Yang
2014-08-25 10:12     ` Martin Jansa
2014-08-25 11:45       ` Robert Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140824155625.GJ20524@jama \
    --to=martin.jansa@gmail.com \
    --cc=liezhi.yang@windriver.com \
    --cc=openembedded-commits@lists.openembedded.org \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox