All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] Bugfix in PRINC increment
@ 2011-05-16 18:26 Khem Raj
  2011-05-16 18:26 ` [PATCH 1/1] base.bbclass: Fix PR increment bug when PR number is a single digit Khem Raj
  2011-05-17 18:25 ` [PATCH 0/1] Bugfix in PRINC increment Saul Wold
  0 siblings, 2 replies; 3+ messages in thread
From: Khem Raj @ 2011-05-16 18:26 UTC (permalink / raw)
  To: OE core


Pull URL: git://git.openembedded.org/openembedded-core-contrib
  Branch: kraj/princ
  Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/princ

Thanks,
    Khem Raj <raj.khem@gmail.com>
---


Khem Raj (1):
  base.bbclass: Fix PR increment bug when PR number is a single digit

 meta/classes/base.bbclass |   19 ++++++-------------
 1 files changed, 6 insertions(+), 13 deletions(-)

-- 
1.7.4.1




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] base.bbclass: Fix PR increment bug when PR number is a single digit
  2011-05-16 18:26 [PATCH 0/1] Bugfix in PRINC increment Khem Raj
@ 2011-05-16 18:26 ` Khem Raj
  2011-05-17 18:25 ` [PATCH 0/1] Bugfix in PRINC increment Saul Wold
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2011-05-16 18:26 UTC (permalink / raw)
  To: OE core

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 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 d9ed15f..23095ec 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -233,25 +233,18 @@ do_build () {
 }
 
 python () {
-    import exceptions, string
+    import exceptions, string, re
 
     # If PRINC is set, try and increase the PR value by the amount specified
     princ = bb.data.getVar('PRINC', d, True)
     if princ:
         pr = bb.data.getVar('PR', d, True)
-        start = -1
-        end = -1
-        for i in range(len(pr)):
-            if pr[i] in string.digits:
-                if start == -1:
-                    start = i
-                else:
-                    end = i
-        if start == -1 or end == -1:
+        pr_prefix = re.search("\D+",pr)
+        prval = re.search("\d+",pr)
+        if pr_prefix is None or prval is None:
             bb.error("Unable to analyse format of PR variable: %s" % pr)
-        prval = pr[start:end+1]
-        prval = int(prval) + int(princ)
-        pr = pr[0:start] + str(prval) + pr[end:len(pr)-1]
+        nval = int(prval.group(0)) + int(princ)
+        pr = pr_prefix.group(0) + str(nval) + pr[prval.end():]
         bb.data.setVar('PR', pr, d)
 
     pn = bb.data.getVar('PN', d, 1)
-- 
1.7.4.1




^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 0/1] Bugfix in PRINC increment
  2011-05-16 18:26 [PATCH 0/1] Bugfix in PRINC increment Khem Raj
  2011-05-16 18:26 ` [PATCH 1/1] base.bbclass: Fix PR increment bug when PR number is a single digit Khem Raj
@ 2011-05-17 18:25 ` Saul Wold
  1 sibling, 0 replies; 3+ messages in thread
From: Saul Wold @ 2011-05-17 18:25 UTC (permalink / raw)
  To: Patches and discussions about the oe-core layer

On 05/16/2011 11:26 AM, Khem Raj wrote:
>
> Pull URL: git://git.openembedded.org/openembedded-core-contrib
>    Branch: kraj/princ
>    Browse: http://git.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=kraj/princ
>
> Thanks,
>      Khem Raj<raj.khem@gmail.com>
> ---
>
>
> Khem Raj (1):
>    base.bbclass: Fix PR increment bug when PR number is a single digit
>
>   meta/classes/base.bbclass |   19 ++++++-------------
>   1 files changed, 6 insertions(+), 13 deletions(-)
>
Merged into oe-core

Thanks
	Sau!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-17 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-16 18:26 [PATCH 0/1] Bugfix in PRINC increment Khem Raj
2011-05-16 18:26 ` [PATCH 1/1] base.bbclass: Fix PR increment bug when PR number is a single digit Khem Raj
2011-05-17 18:25 ` [PATCH 0/1] Bugfix in PRINC increment Saul Wold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.