]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
bitbake: fetch2: Make SRCREV_FORMAT name substitution safer
authorUlf Magnusson <ulfalizer@gmail.com>
Mon, 12 Sep 2016 22:40:37 +0000 (00:40 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 14 Sep 2016 22:04:04 +0000 (23:04 +0100)
commit8e6a893cb7f13ea14051fc40c6c9baf41aa47fee
treeff5e80c345300e406a3d7cbe8491df200800fe23
parentb4705c80add1f618c11a9223cdd9578d763b50ec
bitbake: fetch2: Make SRCREV_FORMAT name substitution safer

The implementation of SRCREV_FORMAT has at least two issues:

 1. Given two names "foo" and "foobar" and SRCREV_FORMAT = "foo_foobar",
    "foo" might currently get substituted twice, and "foobar" not at
    all.

 2. If the revision substitued for some name happens to contain another
    name as a substring, then that substring might incorrectly get
    replaced.

Fix both issues by sorting the names with the longest ones first and
replacing all names at once with a regular expression. This was inspired
by
http://stackoverflow.com/questions/6116978/python-replace-multiple-strings.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/fetch2/__init__.py