Skip to contentSkip to conversation

package.bbclass: Let PR server update PKGV, not PV

PATCH In review Mike Looijmans 2 participants 2 messages Jan 10, 2015 – Jan 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.bbclass: Let PR server update PKGV, not PV

From: Mike Looijmans <[email protected]>

PV is the package version as we need it to be during the build. PKGV is the final version as it ends up in the package, and defaults to PV.

The packager handled builds without PR-server by replacing the AUTOINC string in PKGV, but when the PR-server is being used, the script replaces the contents of PKGV with the PV if the PV contains "AUTOINC". Thus the packager overrides any change to PKGV the recipe might have made.
This breaks classes like gitpkgv that provide a correctly numbered PKGV, the number as calculated by that class will simply be replaced with a 0-based index from the PR-server.

This patch makes the packager look at the PKGV version instead of the PV, and update the PKGV only based on the PKGV contents as set by the recipe.

See also the discussion here:
http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100329.html

From investigating the history of the code and changes in the past year, the
use of "pv" instead of "pkgv" appears to be just an oversight, introduced in:
commit b27b438221e16ac3df6ac66d761b77e3bd43db67 "prs: use the PRServer to replace the BB_URI_LOCALCOUNT functionality" A later commit 865d001de168915a5796e5c760f96bdd04cebd61 "package/prserv: Merge two similar functions into one" silently fixed this only for the case without PR-server by using pkgv there.

---
 meta/classes/package.bbclass |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/package.bbclass +4 -3
index fc501fc..93e2461 100644
@@ -403,9 +403,10 @@ python package_get_auto_pr() {
     if not (host is None):
         d.setVar("PRSERV_HOST", host)
 
+    pkgv = d.getVar("PKGV", True)
+
     # PR Server not active, handle AUTOINC
     if not d.getVar('PRSERV_HOST', True):
-        pkgv = d.getVar("PKGV", True)
         if 'AUTOINC' in pkgv:
             d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
         return
@@ -428,11 +429,11 @@ python package_get_auto_pr() {
         if conn is None:
             conn = oe.prservice.prserv_make_conn(d)
         if conn is not None:
-            if "AUTOINC" in pv:
+            if "AUTOINC" in pkgv:
                 srcpv = bb.fetch2.get_srcrev(d)
                 base_ver = "AUTOINC-%s" % version[:version.find(srcpv)]
                 value = conn.getPR(base_ver, pkgarch, srcpv)
-                d.setVar("PKGV", pv.replace("AUTOINC", str(value)))
+                d.setVar("PKGV", pkgv.replace("AUTOINC", str(value)))
 
             auto_pr = conn.getPR(version, pkgarch, checksum)
     except Exception as e:
Signature · 1 line
1.7.9.5
#1 lore raw

ping?

Quoted 51 lines · Mike Looijmans

From: Mike Looijmans <[email protected]>

PV is the package version as we need it to be during the build. PKGV is the final version as it ends up in the package, and defaults to PV.

The packager handled builds without PR-server by replacing the AUTOINC string in PKGV, but when the PR-server is being used, the script replaces the contents of PKGV with the PV if the PV contains "AUTOINC". Thus the packager overrides any change to PKGV the recipe might have made.
This breaks classes like gitpkgv that provide a correctly numbered PKGV, the number as calculated by that class will simply be replaced with a 0-based index from the PR-server.

This patch makes the packager look at the PKGV version instead of the PV, and update the PKGV only based on the PKGV contents as set by the recipe.

See also the discussion here:
http://lists.openembedded.org/pipermail/openembedded-core/2015-January/100329.html

From investigating the history of the code and changes in the past year, the
use of "pv" instead of "pkgv" appears to be just an oversight, introduced in:
commit b27b438221e16ac3df6ac66d761b77e3bd43db67 "prs: use the PRServer to replace the BB_URI_LOCALCOUNT functionality" A later commit 865d001de168915a5796e5c760f96bdd04cebd61 "package/prserv: Merge two similar functions into one" silently fixed this only for the case without PR-server by using pkgv there.

---
  meta/classes/package.bbclass |    7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/package.bbclass +2 -1
index fc501fc..93e2461 100644
@@ -403,9 +403,10 @@ python package_get_auto_pr() {
      if not (host is None):
          d.setVar("PRSERV_HOST", host)
 
+    pkgv = d.getVar("PKGV", True)
+
      # PR Server not active, handle AUTOINC
      if not d.getVar('PRSERV_HOST', True):
-        pkgv = d.getVar("PKGV", True)
          if 'AUTOINC' in pkgv:
              d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
          return
@@ -428,11 +429,11 @@ python package_get_auto_pr() {
          if conn is None:
              conn = oe.prservice.prserv_make_conn(d)
          if conn is not None:

meta/classes/package.bbclass python package_get_auto_pr() { · line 439

Quoted 10 lines
meta/classes/package.bbclass +2 -2
-            if "AUTOINC" in pv:
+            if "AUTOINC" in pkgv:
                  srcpv = bb.fetch2.get_srcrev(d)
                  base_ver = "AUTOINC-%s" % version[:version.find(srcpv)]
                  value = conn.getPR(base_ver, pkgarch, srcpv)
-                d.setVar("PKGV", pv.replace("AUTOINC", str(value)))
+                d.setVar("PKGV", pkgv.replace("AUTOINC", str(value)))
 
              auto_pr = conn.getPR(version, pkgarch, checksum)
      except Exception as e:

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Systems Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax: (+31) (0) 499 33 69 70
E-mail: [email protected]
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/