Create common script file for workon tools. Planning on using in another CL.

Review URL: http://codereview.chromium.org/3022010
This commit is contained in:
Chris Sosa 2010-07-19 11:50:11 -07:00
parent 92d3779dff
commit a5e394704d
2 changed files with 24 additions and 14 deletions

View File

@ -14,6 +14,9 @@
# 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
@ -154,20 +157,6 @@ ebuild_iterate() {
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
}
# --all makes commands operate on different lists
if [ ${FLAGS_all} = "${FLAGS_TRUE}" ]; then
case ${WORKON_CMD} in

21
lib/cros_workon_common.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Common library for functions used by workon tools.
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
}