| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Common library for functions used by workon tools. | 7 # Common library for functions used by workon tools. |
| 8 | 8 |
| 9 find_workon_ebuilds() { | 9 find_keyword_workon_ebuilds() { |
| 10 keyword="${1}" |
| 11 |
| 10 pushd "${BOARD_DIR}"/etc/ 1> /dev/null | 12 pushd "${BOARD_DIR}"/etc/ 1> /dev/null |
| 11 source make.conf | 13 source make.conf |
| 12 popd 1> /dev/null | 14 popd 1> /dev/null |
| 13 local CROS_OVERLAYS="${PORTDIR_OVERLAY}" | 15 local CROS_OVERLAYS="${PORTDIR_OVERLAY}" |
| 14 | 16 |
| 15 # NOTE: overlay may be a symlink, and we have to use ${overlay}/ | 17 # NOTE: overlay may be a symlink, and we have to use ${overlay}/ |
| 16 for overlay in ${CROS_OVERLAYS}; do | 18 for overlay in ${CROS_OVERLAYS}; do |
| 17 # only look up ebuilds named 9999 to eliminate duplicates | 19 # only look up ebuilds named 9999 to eliminate duplicates |
| 18 find ${overlay}/ -name '*9999.ebuild' | xargs fgrep cros-workon | \ | 20 find ${overlay}/ -name '*9999.ebuild' | \ |
| 19 sed -e 's/\([.]ebuild\):.*/\1/'|uniq | 21 xargs grep -l "inherit.*cros-workon" | \ |
| 22 xargs grep -l "KEYWORDS=.*${keyword}.*" |
| 20 done | 23 done |
| 21 } | 24 } |
| 22 | 25 |
| 23 # wrapper script that caches the result of find_workon_ebuilds() | 26 show_workon_ebuilds() { |
| 24 show_workon_ebuilds_files() { | 27 keyword=$1 |
| 25 if [ -z "${CROS_ALL_EBUILDS}" ]; then | 28 |
| 26 CROS_ALL_EBUILDS=$(find_workon_ebuilds) | 29 find_keyword_workon_ebuilds ${keyword} | \ |
| 27 fi | 30 sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/' | \ |
| 28 echo "${CROS_ALL_EBUILDS}" | 31 sort -u |
| 32 # This changes the absolute path to ebuilds into category/package. |
| 29 } | 33 } |
| 30 | |
| 31 show_workon_ebuilds() { | |
| 32 show_workon_ebuilds_files | \ | |
| 33 sed -e 's/.*\/\([^/]*\)\/\([^/]*\)\/.*\.ebuild/\1\/\2/'| sort | |
| 34 } | |
| OLD | NEW |