From c28d7a1dfc08365313980000d0f276f90a248e99 Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Wed, 15 Sep 2010 11:33:54 -0700 Subject: [PATCH] cros_workon: redefine the concept of a "workon" package list to depend on the board * Modified all workon listing functions to also look for keyword * Added a fallback to list all workon ebuilds if keyword is not specified, which is needed for cros_mark_all_as_stable, which does not differentiate between boards. This, amongst other potential issues, resolves the case when it was possible to start working on a package not keyworded for the given board, and making build_packages fail unconditionally. TEST=below $ ./cros_workon list --all --board=x86-generic |wc -l 73 $ ./cros_workon list --all --host |wc -l 57 Looking at the lists rather than "|wc -l" looks correct $ ./cros_mark_all_as_stable ^ Produces satisfactory result BUG=6700 Change-Id: Ieee92a39febcef5fb95e59cf97b6e63281a7c750 Review URL: http://codereview.chromium.org/3400001 --- cros_workon | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cros_workon b/cros_workon index 9720079a8c..74285cd259 100755 --- a/cros_workon +++ b/cros_workon @@ -60,11 +60,13 @@ if [ -n "${FLAGS_board}" ]; then EQUERYCMD=equery-"${FLAGS_board}" EBUILDCMD=ebuild-"${FLAGS_board}" BOARD_STR="${FLAGS_board}" + BOARD_KEYWORD="$(portageq-${FLAGS_board} envvar ARCH)" else BOARD_DIR="" # --host specified EQUERYCMD=equery EBUILDCMD=ebuild BOARD_STR="host" + BOARD_KEYWORD="$(portageq envvar ARCH)" fi WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon @@ -95,7 +97,7 @@ canonicalize_name () { local pkgfile local pkgname - if ! pkgfile=$(ACCEPT_KEYWORDS="**" ${EQUERYCMD} which $1); then + if ! pkgfile=$(ACCEPT_KEYWORDS="~${BOARD_KEYWORD}" ${EQUERYCMD} which $1); then warn "error looking up package $1" 1>&2 return 1 fi @@ -249,7 +251,7 @@ ebuild_iterate() { # --all makes commands operate on different lists if [ ${FLAGS_all} = "${FLAGS_TRUE}" ]; then case ${WORKON_CMD} in - start) ATOM_LIST=$(show_workon_ebuilds);; + start) ATOM_LIST=$(show_workon_ebuilds ${BOARD_KEYWORD});; stop|iterate) ATOM_LIST=$(show_live_ebuilds);; list) ;; *) die "--all is invalid for the given command";; @@ -270,7 +272,7 @@ fi case ${WORKON_CMD} in start) ebuild_to_live "${ATOM_LIST}" ;; stop) ebuild_to_stable "${ATOM_LIST}" ;; - list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_workon_ebuilds ;; + list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_workon_ebuilds ${BOARD_KEYWORD} ;; iterate)ebuild_iterate "${ATOM_LIST}" ;; *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; esac