[OE-core] [YP 2.1] [RFC PATCH] insane.bbclass: check files under /etc/ are marked by CONFFILES

Christopher Larson clarson at kergoth.com
Sat Oct 3 18:39:54 UTC 2015


On Fri, Oct 2, 2015 at 9:36 PM, Robert Yang <liezhi.yang at windriver.com>
wrote:

> +QAPATHTEST[conffiles] = "package_qa_check_conffiles"
> +def package_qa_check_conffiles(path, name, d, elf, messages):
> +    """ Check files in ${sysconfdir} are marked by CONFFILES """
> +
> +    if os.path.islink(path) or not os.path.exists(path):
> +        return True
> +
> +    sysconfdir = d.getVar('sysconfdir', True)
> +    dest = d.getVar('PKGDEST', True)
> +    sysconfdir_path = os.path.join(os.path.join(dest, name), \
> +                        sysconfdir.lstrip('/'))
> +
> +    if not path.startswith(sysconfdir_path):
> +        return True
>

This is missing a trailing slash, so e.g. checking /etcfoo would match, not
just /etc. Whenever you use startswith() on a path, remember to append '/'
or os.sep to the string being checked (of course, if we also need to match
just '/etc' without anything further, which I don't think is the case here,
you'd also have to check explicitly with ==, as '/etc/' won't be found at
the beginning of '/etc'. It's a common thing to miss, I think we have other
occurrences of this in the metadata :)
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20151003/66c182f8/attachment-0002.html>


More information about the Openembedded-core mailing list