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
This commit is contained in:
Mandeep Singh Baines 2011-01-31 16:13:30 -08:00
parent 39ed0d0ebe
commit f9ea0036fa
2 changed files with 26 additions and 36 deletions

View File

@ -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

View File

@ -1,33 +0,0 @@
#!/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.
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.
}