Openembedded Core Discussions
 help / color / mirror / Atom feed
From: pmi183@gmail.com
To: openembedded-core@lists.openembedded.org
Subject: Re: [PATCH] buildhistory: Fix do_package race issues
Date: Mon, 20 May 2024 01:10:19 -0700	[thread overview]
Message-ID: <17234.1716192619114804009@lists.openembedded.org> (raw)
In-Reply-To: <CANNYZj941KS_ULo9iwpyYCKmvpHRur-4djy0AD=bjUvjnwW1XA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4180 bytes --]

Hi Alex,

I made some debug in the flow and i saw a timing issue and since there's no reason to generate files-in-package.txt before sstate-cache operations i moved the call to the postfunc of sstate:

---
meta/classes-global/sstate.bbclass |  5 +++++
meta/classes/buildhistory.bbclass  | 18 +++++++++++++++---
meta/lib/oe/packagedata.py         |  2 +-
3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/meta/classes-global/sstate.bbclass b/meta/classes-global/sstate.bbclass
index 76a7b59636..7e3c3e3c4f 100644
--- a/meta/classes-global/sstate.bbclass
+++ b/meta/classes-global/sstate.bbclass
@@ -104,6 +104,7 @@ SSTATEPOSTCREATEFUNCS = ""
SSTATEPREINSTFUNCS = ""
SSTATEPOSTUNPACKFUNCS = "sstate_hardcode_path_unpack"
SSTATEPOSTINSTFUNCS = ""
+SSTATEPOSTFUNCS = ""
EXTRA_STAGING_FIXMES ?= "HOSTTOOLS_DIR"

# Check whether sstate exists for tasks that support sstate and are in the
@@ -805,6 +806,10 @@ python sstate_task_postfunc () {
sstate_installpkgdir(shared_state, d)

bb.utils.remove(d.getVar("SSTATE_BUILDDIR"), recurse=True)
+
+    for postfunc in (d.getVar('SSTATEPOSTFUNCS') or '').split():
+        # All hooks should run in the SSTATE_INSTDIR
+        bb.build.exec_func(postfunc, d, (sstateinst,))
}
sstate_task_postfunc[dirs] = "${WORKDIR}"

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index fd53e92402..054c213bf5 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -58,6 +58,9 @@ SSTATEPOSTUNPACKFUNCS:append = " buildhistory_emit_outputsigs"
sstate_installpkgdir[vardepsexclude] += "buildhistory_emit_outputsigs"
SSTATEPOSTUNPACKFUNCS[vardepvalueexclude] .= "| buildhistory_emit_outputsigs"

+SSTATEPOSTFUNCS:append = " buildhistory_emit_filesinpackage"
+SSTATEPOSTFUNCS[vardepvalueexclude] .= "| buildhistory_emit_filesinpackage"
+
# All items excepts those listed here will be removed from a recipe's
# build history directory by buildhistory_emit_pkghistory(). This is
# necessary because some of these items (package directories, files that
@@ -87,6 +90,16 @@ buildhistory_emit_sysroot() {
buildhistory_list_files_no_owners $BASE ${BUILDHISTORY_DIR_PACKAGE}/sysroot
}

+#
+# Write out files-in-package for this package
+#
+python buildhistory_emit_filesinpackage() {
+    if d.getVar('BB_CURRENTTASK') in ['package', 'package_setscene']:
+        # Create files-in-<package-name>.txt files containing a list of files of each recipe's package
+        bb.build.exec_func("buildhistory_list_pkg_files", d)
+        return 0
+}
+
#
# Write out metadata about this package for comparison when writing future packages
#
@@ -99,8 +112,6 @@ python buildhistory_emit_pkghistory() {
return 0

if d.getVar('BB_CURRENTTASK') in ['package', 'package_setscene']:
-        # Create files-in-<package-name>.txt files containing a list of files of each recipe's package
-        bb.build.exec_func("buildhistory_list_pkg_files", d)
return 0

if not d.getVar('BB_CURRENTTASK') in ['packagedata', 'packagedata_setscene']:
@@ -599,7 +610,8 @@ buildhistory_list_files_no_owners() {

buildhistory_list_pkg_files() {
# Create individual files-in-package for each recipe's package
-       for pkgdir in $(find ${PKGDEST}/* -maxdepth 0 -type d); do
+    pkgdirlist=$(find ${PKGDEST}/* -maxdepth 0 -type d)
+       for pkgdir in ${pkgdirlist}; do
pkgname=$(basename $pkgdir)
outfolder="${BUILDHISTORY_DIR_PACKAGE}/$pkgname"
outfile="$outfolder/files-in-package.txt"
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 2d1d6ddeb7..e8c503b43b 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -309,7 +309,7 @@ fi
subdata_file = pkgdatadir + "/runtime/%s" % pkg
with open(subdata_file, 'w') as sf:
for var in (d.getVar('PKGDATA_VARS') or "").split():
-                val = write_if_exists(sf, pkg, var)
+                write_if_exists(sf, pkg, var)

write_if_exists(sf, pkg, 'FILERPROVIDESFLIST')
for dfile in sorted((d.getVar('FILERPROVIDESFLIST:' + pkg) or "").split()):
--
2.34.1

[-- Attachment #2: Type: text/html, Size: 5542 bytes --]

  reply	other threads:[~2024-05-20  8:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-23 13:59 [PATCH] buildhistory: Fix do_package race issues Richard Purdie
2021-11-23 14:19 ` [OE-core] " Alexander Kanavin
2024-05-13  9:47 ` pmi183
2024-05-13  9:51   ` [OE-core] " Alexander Kanavin
2024-05-13 10:05     ` pmi183
2024-05-13 11:01       ` [OE-core] " Alexander Kanavin
2024-05-15  9:36         ` pmi183
2024-05-15 10:07           ` [OE-core] " Alexander Kanavin
2024-05-20  8:10             ` pmi183 [this message]
2024-05-20 11:12               ` Jose Quaresma
2024-05-21 10:24               ` Alexander Kanavin
2024-05-23 15:24                 ` pmi183
2024-05-23 15:24                   ` pmi183
     [not found]                   ` <Groupsio.1.30216.1716477852755796076@lists.openembedded.org>
2024-05-24  8:13                     ` [OE-core] " Alexander Kanavin
2024-05-29  8:56                       ` pmi183
2024-05-29  9:01                       ` pmi183
2024-05-29 10:22                         ` [OE-core] " Alexander Kanavin
2024-05-29 11:57                           ` pmi183
2024-05-29 12:17                             ` [OE-core] " Alexander Kanavin
2024-05-29 22:35                               ` Richard Purdie

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=17234.1716192619114804009@lists.openembedded.org \
    --to=pmi183@gmail.com \
    --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