diff options
author | Khem Raj <raj.khem@gmail.com> | 2011-05-16 11:18:38 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-05-17 15:14:44 +0100 |
commit | 339d4933a536e1d672f9d6854742e5ebf16f2639 (patch) | |
tree | 35835c0f8961181ff564e6842cd49c1c59fe586a /meta/classes/base.bbclass | |
parent | 60ab6fc60cba2ec2456125b618d23f98966468bd (diff) | |
download | poky-339d4933a536e1d672f9d6854742e5ebf16f2639.tar.gz |
base.bbclass: Fix PR increment bug when PR number is a single digit
PRINC which should add to base PR value has a problem when
the PR is single digit e.g. r0 - r9. Current algorithm
needed atleasts 2 digits to successfully populate end and begin
markers.
We reimplement the incrementing algorithm using regular expressions
which addressed the above mentioned problem and
simplifies the logic a bit and gets rid of loops and conditionals
(From OE-Core rev: 9aeaae7b786a42d213ad4224743dfd49e2324077)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/base.bbclass')
-rw-r--r-- | meta/classes/base.bbclass | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index 5f03de8247..0c7f8fcae3 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -233,25 +233,18 @@ do_build () { | |||
233 | } | 233 | } |
234 | 234 | ||
235 | python () { | 235 | python () { |
236 | import exceptions, string | 236 | import exceptions, string, re |
237 | 237 | ||
238 | # If PRINC is set, try and increase the PR value by the amount specified | 238 | # If PRINC is set, try and increase the PR value by the amount specified |
239 | princ = bb.data.getVar('PRINC', d, True) | 239 | princ = bb.data.getVar('PRINC', d, True) |
240 | if princ: | 240 | if princ: |
241 | pr = bb.data.getVar('PR', d, True) | 241 | pr = bb.data.getVar('PR', d, True) |
242 | start = -1 | 242 | pr_prefix = re.search("\D+",pr) |
243 | end = -1 | 243 | prval = re.search("\d+",pr) |
244 | for i in range(len(pr)): | 244 | if pr_prefix is None or prval is None: |
245 | if pr[i] in string.digits: | ||
246 | if start == -1: | ||
247 | start = i | ||
248 | else: | ||
249 | end = i | ||
250 | if start == -1 or end == -1: | ||
251 | bb.error("Unable to analyse format of PR variable: %s" % pr) | 245 | bb.error("Unable to analyse format of PR variable: %s" % pr) |
252 | prval = pr[start:end+1] | 246 | nval = int(prval.group(0)) + int(princ) |
253 | prval = int(prval) + int(princ) | 247 | pr = pr_prefix.group(0) + str(nval) + pr[prval.end():] |
254 | pr = pr[0:start] + str(prval) + pr[end:len(pr)-1] | ||
255 | bb.data.setVar('PR', pr, d) | 248 | bb.data.setVar('PR', pr, d) |
256 | 249 | ||
257 | pn = bb.data.getVar('PN', d, 1) | 250 | pn = bb.data.getVar('PN', d, 1) |