summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorLee Chee Yang <chee.yang.lee@intel.com>2020-07-23 09:16:13 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-07-25 15:11:05 +0100
commit4eef15704a58f65514d7e7b43d8abe3b3f78fcca (patch)
treebdcd88f590a5f67bf4d2be110fe1e9ada19d05f8 /meta
parent7c3055e70f2dba92787d37d7b04d2486c7772740 (diff)
downloadpoky-4eef15704a58f65514d7e7b43d8abe3b3f78fcca.tar.gz
buildhistory: use pid for temporary txt file name
buildhistory create .txt file bh_installed_pkgs.txt and bh_installed_pkgs_deps.txt while listing down installed package. These file is later removed in buildhistory_get_installed(). when multiple process runs in parellal there are chances to race for the file where one process created the file while another task remove the file right after it. using different file name for each process should avoid the race. So add PID to the file name to make it unique. [yocto #13709] (From OE-Core rev: 214d236d93700abffa2d586cc744a00455818fa4) Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/buildhistory.bbclass11
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index a4288ef9e1..805e976ac5 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -429,8 +429,8 @@ def buildhistory_list_installed(d, rootfs_type="image"):
429 from oe.sdk import sdk_list_installed_packages 429 from oe.sdk import sdk_list_installed_packages
430 from oe.utils import format_pkg_list 430 from oe.utils import format_pkg_list
431 431
432 process_list = [('file', 'bh_installed_pkgs.txt'),\ 432 process_list = [('file', 'bh_installed_pkgs_%s.txt' % os.getpid()),\
433 ('deps', 'bh_installed_pkgs_deps.txt')] 433 ('deps', 'bh_installed_pkgs_deps_%s.txt' % os.getpid())]
434 434
435 if rootfs_type == "image": 435 if rootfs_type == "image":
436 pkgs = image_list_installed_packages(d) 436 pkgs = image_list_installed_packages(d)
@@ -460,9 +460,10 @@ buildhistory_get_installed() {
460 460
461 # Get list of installed packages 461 # Get list of installed packages
462 pkgcache="$1/installed-packages.tmp" 462 pkgcache="$1/installed-packages.tmp"
463 cat ${WORKDIR}/bh_installed_pkgs.txt | sort > $pkgcache && rm ${WORKDIR}/bh_installed_pkgs.txt 463 cat ${WORKDIR}/bh_installed_pkgs_${PID}.txt | sort > $pkgcache && rm ${WORKDIR}/bh_installed_pkgs_${PID}.txt
464 464
465 cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt 465 cat $pkgcache | awk '{ print $1 }' > $1/installed-package-names.txt
466
466 if [ -s $pkgcache ] ; then 467 if [ -s $pkgcache ] ; then
467 cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt 468 cat $pkgcache | awk '{ print $2 }' | xargs -n1 basename > $1/installed-packages.txt
468 else 469 else
@@ -471,8 +472,8 @@ buildhistory_get_installed() {
471 472
472 # Produce dependency graph 473 # Produce dependency graph
473 # First, quote each name to handle characters that cause issues for dot 474 # First, quote each name to handle characters that cause issues for dot
474 sed 's:\([^| ]*\):"\1":g' ${WORKDIR}/bh_installed_pkgs_deps.txt > $1/depends.tmp && 475 sed 's:\([^| ]*\):"\1":g' ${WORKDIR}/bh_installed_pkgs_deps_${PID}.txt > $1/depends.tmp &&
475 rm ${WORKDIR}/bh_installed_pkgs_deps.txt 476 rm ${WORKDIR}/bh_installed_pkgs_deps_${PID}.txt
476 # Remove lines with rpmlib(...) and config(...) dependencies, change the 477 # Remove lines with rpmlib(...) and config(...) dependencies, change the
477 # delimiter from pipe to "->", set the style for recommend lines and 478 # delimiter from pipe to "->", set the style for recommend lines and
478 # turn versioned dependencies into edge labels. 479 # turn versioned dependencies into edge labels.