]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
bitbake: 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>
Thu, 15 Sep 2016 11:15:07 +0000 (12:15 +0100)
commitc3f630df52c3a278316fba89c92f90b5426c36d8
treec69462547569615a52d5b6eba9a2a5b1a4f730de
parentd5698c0afca89f81d95a4850dcffec56de9bbe3e
bitbake: 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.

(Bitbake rev: 8e6a893cb7f13ea14051fc40c6c9baf41aa47fee)

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