From 8683b8082f8ddffd96b6fff408db5c257bbe3aba Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Tue, 13 Jul 2010 16:48:12 -0700 Subject: [PATCH] cros_workon: introduce a very simple listall command TBR: sosa, msb - I already got the LGTM, then made a silly whitespace change! Review URL: http://codereview.chromium.org/2909009 --- cros_workon | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/cros_workon b/cros_workon index 0e5534063f..4ff535c0cb 100755 --- a/cros_workon +++ b/cros_workon @@ -29,11 +29,18 @@ FLAGS_HELP="usage: $0 [flags] commands: start: Moves an ebuild to live (intended to support development) stop: Moves an ebuild to stable (use last known good) - list: List of all live ebuilds + list: List of current live ebuilds + listall: List all possible cros-workon ebuilds forall: For each ebuild, cd to the source dir and run a commond" FLAGS "$@" || exit 1 eval set -- "${FLAGS_ARGV}" + +# eat the workon command keywords: start, stop or list. +WORKON_CMD=$1 +shift + + # board dir config [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ die "Flags --host and --board are mutually exclusive." @@ -48,12 +55,6 @@ else EQUERY=equery fi - -# eat the workon command keywords: start, stop or list. -WORKON_CMD=$1 -shift - - KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon @@ -159,10 +160,25 @@ ebuild_forall() { done } +show_workon_ebuilds() { + pushd "${BOARD_DIR}"/etc/ 1> /dev/null + source make.conf + popd 1> /dev/null + local CROS_OVERLAYS="${PORTDIR_OVERLAY}" + + for overlay in ${CROS_OVERLAYS}; do + pushd ${overlay} 1> /dev/null + find . -name '*.ebuild' | xargs fgrep cros-workon | \ + awk -F / '{ print $2 "/" $3 }' | uniq | sort + popd 1> /dev/null + done +} + case ${WORKON_CMD} in start) ebuild_to_live "${ATOM_LIST}" ;; stop) ebuild_to_stable "${ATOM_LIST}" ;; list) show_live_ebuilds ;; forall) ebuild_forall "${ATOM_LIST}" ;; + listall)show_workon_ebuilds ;; *) die "invalid cros_workon command" ;; esac