Skip to content

Commit

Permalink
enact-dev-native=r9
Browse files Browse the repository at this point in the history
:Release Notes:
Add defensive codes for "npm install" in Enact CLI

:Detailed Notes:
* Add "timeouted-npm-install with 5 times" structure in enact-dev-native.bb
* Remove "npm install" codes in webos_enactjs_env.bbclass
* Reason:
All enact apps inherit webos_enactjs_env so each apps call duplicated "npm install" in enact_cli each times.
For that reason, "npm install" has been moved to enact-dev-native(it calls only one time).
That can reduce useless function calls and sometimes errors.

:Testing Performed:
Verf built and locally tested

:QA Notes:

:Issues Addressed:
[PLAT-144070] random build failures occurs from NPM
[PLAT-144565] CCC: enact-dev-native=r9

Change-Id: Icffbad032aec354b0e11548cdc107ad71a952169
  • Loading branch information
hong6316 authored and Hyunjae Shin committed Jun 23, 2021
1 parent 40b530d commit e2c5cde
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 10 deletions.
8 changes: 0 additions & 8 deletions meta-webos/classes/webos_enactjs_env.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,3 @@ ENACT_JSDOC_TO_TS ??= "${WEBOS_NODE_BIN} ${WEBOS_ENACTJS_JSDOC_TO_TS_PATH}/bin/j
ENACT_BOOTSTRAP_OVERRIDE ??= "${ENACT_DEV} bootstrap --base=false --sampler=false --link=false --override"

inherit webos_npm_env

do_configure_append() {
# npm install on cli & jsdoc-to-ts
bbnote "Enact cli & jsdoc-to-ts npm install"
${WEBOS_NPM_BIN} install -C ${WEBOS_ENACTJS_TOOL_PATH}
${WEBOS_NPM_BIN} install -C ${WEBOS_ENACTJS_TOOL_LEGACY_PATH}
${WEBOS_NPM_BIN} install -C ${WEBOS_ENACTJS_JSDOC_TO_TS_PATH}
}
34 changes: 32 additions & 2 deletions meta-webos/recipes-webos/enact-dev/enact-dev-native.bb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ SECTION = "webos/devel/tools"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"

# Dependencies:
# - nodejs-native to get node & npm
# - coreutils-native to use timeout utility to prevent frozen NPM processes
DEPENDS_append = " nodejs-native coreutils-native"

inherit webos_enact_repo
inherit native
inherit webos_npm_env

# NOTE: It's only necessary to bump PR if the recipe itself changes
# No need to bump PR when changing the values of PV and SRCREV (below)
PR = "r8"
PR = "r9"

S = "${WORKDIR}/git"

Expand Down Expand Up @@ -39,7 +45,31 @@ SRCREV_jsdoc-to-ts = "91e3709da01f4a8e0d57c2ed80d068789acf37eb"

# Skip unneeded tasks
do_configure[noexec] = "1"
do_compile[noexec] = "1"

# npm install on cli & jsdoc-to-ts
do_compile() {
bbnote "Enact cli & jsdoc-to-ts npm install"
for LOC_TOOL in ${S}/* ; do
ATTEMPTS=0
STATUS=-1
while [ ${STATUS} -ne 0 ] ; do
ATTEMPTS=$(expr ${ATTEMPTS} + 1)
if [ ${ATTEMPTS} -gt 5 ] ; then
bberror "All attempts to NPM install have failed; exiting!"
exit ${STATUS}
fi

bbnote "NPM install attempt #${ATTEMPTS} (of 5)..." && echo
STATUS=0
timeout --kill-after=5m 15m ${WEBOS_NPM_BIN} ${WEBOS_NPM_INSTALL_FLAGS} install -C ${LOC_TOOL} || eval "STATUS=\$?"
if [ ${STATUS} -ne 0 ] ; then
bbwarn "...NPM process failed with status ${STATUS}"
else
bbnote "...NPM process succeeded" && echo
fi
done
done
}

# Install enact-dev in sysroot for use in Enact app recipes
do_install() {
Expand Down

0 comments on commit e2c5cde

Please sign in to comment.