]> code.ossystems Code Review - openembedded-core.git/commitdiff
base.bbclass: Implement PRINC, a way to increment the PR variable in .bbappend files
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 5 Oct 2010 09:07:00 +0000 (10:07 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 5 Oct 2010 21:26:32 +0000 (22:26 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
meta-emenlow/packages/formfactor/formfactor_0.0.bbappend
meta/classes/base.bbclass

index 9bc9eed5cf4300e7c8ba7f5ee4691c3f1c7b4bd9..4a41d4871de32e483eded6d72e1f642e9b805d5b 100644 (file)
@@ -1,3 +1,3 @@
 FILESEXTRAPATHS := "${THISDIR}/${PN}"
  
-PR = "r26"
+PRINC = "1"
index a9e5657d863935a6b4c26642629b3e375cb4fd3f..9ab8204dbce824ecb4a2243b83fa9c6ed9718f4a 100644 (file)
@@ -440,7 +440,26 @@ do_build = ""
 do_build[func] = "1"
 
 python () {
-    import exceptions
+    import exceptions, string
+
+    # 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:
+            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]
+        bb.data.setVar('PR', pr, d)
 
     pn = bb.data.getVar('PN', d, 1)
     license = bb.data.getVar('LICENSE', d, True)