From: "Mark Hatle" <mark.hatle@kernel.crashing.org>
To: openembedded-core@lists.openembedded.org
Subject: [master][PATCH 3/5] package.bbclass: Move package_get_auto_pr to packagedata.bbclass
Date: Mon, 24 Aug 2020 18:29:28 -0500 [thread overview]
Message-ID: <20200824232930.150388-4-mark.hatle@kernel.crashing.org> (raw)
In-Reply-To: <20200824232930.150388-1-mark.hatle@kernel.crashing.org>
Running package_get_auto_pr during do_package is 'too early' when we need
to evaluate the do_package output to get it's unihash to look up the
right value in the PR database.
Move this function packagedata.bbclass (no changes yet), as subsequent
patches will refactor this function and the order in which it's called.
Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
---
meta/classes/package.bbclass | 50 ---------------------------
meta/classes/packagedata.bbclass | 59 ++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 50 deletions(-)
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 5fa96eb331..003eb71a6e 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -672,56 +672,6 @@ def runtime_mapping_rename (varname, pkg, d):
# Package functions suitable for inclusion in PACKAGEFUNCS
#
-python package_get_auto_pr() {
- import oe.prservice
- import re
-
- # Support per recipe PRSERV_HOST
- pn = d.getVar('PN')
- host = d.getVar("PRSERV_HOST_" + pn)
- if not (host is None):
- d.setVar("PRSERV_HOST", host)
-
- pkgv = d.getVar("PKGV")
-
- # PR Server not active, handle AUTOINC
- if not d.getVar('PRSERV_HOST'):
- if 'AUTOINC' in pkgv:
- d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
- return
-
- auto_pr = None
- pv = d.getVar("PV")
- version = d.getVar("PRAUTOINX")
- pkgarch = d.getVar("PACKAGE_ARCH")
- checksum = d.getVar("BB_TASKHASH")
-
- if d.getVar('PRSERV_LOCKDOWN'):
- auto_pr = d.getVar('PRAUTO_' + version + '_' + pkgarch) or d.getVar('PRAUTO_' + version) or None
- if auto_pr is None:
- bb.fatal("Can NOT get PRAUTO from lockdown exported file")
- d.setVar('PRAUTO',str(auto_pr))
- return
-
- try:
- conn = d.getVar("__PRSERV_CONN")
- if conn is None:
- conn = oe.prservice.prserv_make_conn(d)
- if conn is not None:
- 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", pkgv.replace("AUTOINC", str(value)))
-
- auto_pr = conn.getPR(version, pkgarch, checksum)
- except Exception as e:
- bb.fatal("Can NOT get PRAUTO, exception %s" % str(e))
- if auto_pr is None:
- bb.fatal("Can NOT get PRAUTO from remote PR service")
- d.setVar('PRAUTO',str(auto_pr))
-}
-
LOCALEBASEPN ??= "${PN}"
python package_do_split_locales() {
diff --git a/meta/classes/packagedata.bbclass b/meta/classes/packagedata.bbclass
index a903e5cfd2..981c324909 100644
--- a/meta/classes/packagedata.bbclass
+++ b/meta/classes/packagedata.bbclass
@@ -32,3 +32,62 @@ python read_subpackage_metadata () {
else:
d.setVar(key, sdata[key], parsing=True)
}
+
+package_get_auto_pr[vardepsexclude] = "BB_TASKDEPDATA"
+python package_get_auto_pr() {
+ import oe.prservice
+ import re
+
+ def get_do_package_hash(pn):
+ if d.getVar("BB_RUNTASK") != "do_package":
+ taskdepdata = d.getVar("BB_TASKDEPDATA", False)
+ for dep in taskdepdata:
+ if taskdepdata[dep][1] == "do_package" and taskdepdata[dep][0] == pn:
+ return taskdepdata[dep][6]
+ return d.getVar("BB_UNIHASH")
+
+ # Support per recipe PRSERV_HOST
+ pn = d.getVar('PN')
+ host = d.getVar("PRSERV_HOST_" + pn)
+ if not (host is None):
+ d.setVar("PRSERV_HOST", host)
+
+ pkgv = d.getVar("PKGV")
+
+ # PR Server not active, handle AUTOINC
+ if not d.getVar('PRSERV_HOST'):
+ if 'AUTOINC' in pkgv:
+ d.setVar("PKGV", pkgv.replace("AUTOINC", "0"))
+ return
+
+ auto_pr = None
+ pv = d.getVar("PV")
+ version = d.getVar("PRAUTOINX")
+ pkgarch = d.getVar("PACKAGE_ARCH")
+ checksum = get_do_package_hash(pn)
+
+ if d.getVar('PRSERV_LOCKDOWN'):
+ auto_pr = d.getVar('PRAUTO_' + version + '_' + pkgarch) or d.getVar('PRAUTO_' + version) or None
+ if auto_pr is None:
+ bb.fatal("Can NOT get PRAUTO from lockdown exported file")
+ d.setVar('PRAUTO',str(auto_pr))
+ return
+
+ try:
+ conn = d.getVar("__PRSERV_CONN")
+ if conn is None:
+ conn = oe.prservice.prserv_make_conn(d)
+ if conn is not None:
+ 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", pkgv.replace("AUTOINC", str(value)))
+
+ auto_pr = conn.getPR(version, pkgarch, checksum)
+ except Exception as e:
+ bb.fatal("Can NOT get PRAUTO, exception %s" % str(e))
+ if auto_pr is None:
+ bb.fatal("Can NOT get PRAUTO from remote PR service")
+ d.setVar('PRAUTO',str(auto_pr))
+}
--
2.17.1
next prev parent reply other threads:[~2020-08-24 23:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-24 23:29 [master][PATCH 0/5] Allow PR Service and hash equiv together Mark Hatle
2020-08-24 23:29 ` [master][PATCH 1/5] package_tar.bbclass: Sync to the other package_* classes Mark Hatle
2020-08-25 10:49 ` [OE-core] " Richard Purdie
2020-08-24 23:29 ` [master][PATCH 2/5] hash equivalency and pr service Mark Hatle
2020-08-25 12:50 ` [OE-core] " Joshua Watt
2020-08-25 14:16 ` Mark Hatle
2020-08-25 18:36 ` Richard Purdie
2020-08-24 23:29 ` Mark Hatle [this message]
2020-08-24 23:29 ` [master][PATCH 4/5] package / packagedata bbclass: Change the way PRAUTO and AUTOINC are handled Mark Hatle
2020-08-25 10:56 ` [OE-core] " Richard Purdie
2020-08-25 14:14 ` Mark Hatle
[not found] ` <162E885FFA00831B.12036@lists.openembedded.org>
2020-08-25 16:52 ` Mark Hatle
2020-08-25 17:04 ` Richard Purdie
2020-08-25 22:10 ` Mark Hatle
2020-08-25 11:00 ` Richard Purdie
2020-08-24 23:29 ` [master][PATCH 5/5] buildhistory.bbclass: Rework to use read_subpackage_metadata Mark Hatle
2020-08-24 23:32 ` ✗ patchtest: failure for Allow PR Service and hash equiv together Patchwork
2020-08-25 1:17 ` Mark Hatle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200824232930.150388-4-mark.hatle@kernel.crashing.org \
--to=mark.hatle@kernel.crashing.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox