From 0295fffe884d514a12d9a3224c3c681235ef2908 Mon Sep 17 00:00:00 2001 From: Mandeep Singh Baines Date: Mon, 31 Jan 2011 16:13:30 -0800 Subject: [PATCH] cros_workon: collapse cros_workon_common.sh cros_workon is the only user of cros_workon_common.sh This is pre-requisite to moving cros_workon into devutils.git BUG=11507 TEST=Ran ./cros_workon --board x86-generic --all list Change-Id: I1eab551ab33646360e507328932c151a0d36f50a Review URL: http://codereview.chromium.org/6347052 --- cros_workon | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cros_workon b/cros_workon index 61b1e47420..0c7ded12ad 100755 --- a/cros_workon +++ b/cros_workon @@ -14,9 +14,6 @@ # The path to common.sh should be relative to your script's location. . "$(dirname "$0")/common.sh" -# Load common functions for workon scripts. -. "$(dirname "$0")/lib/cros_workon_common.sh" - # Script must be run inside the chroot restart_in_chroot_if_needed $* get_default_board @@ -98,6 +95,32 @@ if [ ! -L "${UNMASK_FILE}" ]; then die "ln -s ${WORKON_FILE} ${UNMASK_FILE}" fi +find_keyword_workon_ebuilds() { + keyword="${1}" + + pushd "${BOARD_DIR}"/etc/ 1> /dev/null + source make.conf + popd 1> /dev/null + local CROS_OVERLAYS="${PORTDIR_OVERLAY}" + + # NOTE: overlay may be a symlink, and we have to use ${overlay}/ + for overlay in ${CROS_OVERLAYS}; do + # only look up ebuilds named 9999 to eliminate duplicates + find ${overlay}/ -name '*9999.ebuild' | \ + xargs grep -l "inherit.*cros-workon" | \ + xargs grep -l "KEYWORDS=.*${keyword}.*" + done +} + +show_workon_ebuilds() { + keyword=$1 + + find_keyword_workon_ebuilds ${keyword} | \ + sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/' | \ + sort -u + # This changes the absolute path to ebuilds into category/package. +} + # Canonicalize package name to category/package. canonicalize_name () { local pkgfile