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 # This script moves ebuilds between 'stable' and 'live' states. | 7 # This script moves ebuilds between 'stable' and 'live' states. |
8 # By default 'stable' ebuilds point at and build from source at the | 8 # By default 'stable' ebuilds point at and build from source at the |
9 # last known good commit. Moving an ebuild to 'live' (via cros_workon start) | 9 # last known good commit. Moving an ebuild to 'live' (via cros_workon start) |
10 # is intended to support development. The current source tip is fetched, | 10 # is intended to support development. The current source tip is fetched, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ | 51 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ |
52 FLAGS_board="" # kill board | 52 FLAGS_board="" # kill board |
53 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ | 53 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ |
54 [ "${WORKON_CMD}" != "list-all" ] && \ | 54 [ "${WORKON_CMD}" != "list-all" ] && \ |
55 die "You must specify either --host or --board=" | 55 die "You must specify either --host or --board=" |
56 | 56 |
57 if [ -n "${FLAGS_board}" ]; then | 57 if [ -n "${FLAGS_board}" ]; then |
58 BOARD_DIR=/build/"${FLAGS_board}" # --board specified | 58 BOARD_DIR=/build/"${FLAGS_board}" # --board specified |
59 EQUERYCMD=equery-"${FLAGS_board}" | 59 EQUERYCMD=equery-"${FLAGS_board}" |
60 EBUILDCMD=ebuild-"${FLAGS_board}" | 60 EBUILDCMD=ebuild-"${FLAGS_board}" |
| 61 PORTAGEQCMD=portageq-"${FLAGS_board}" |
61 BOARD_STR="${FLAGS_board}" | 62 BOARD_STR="${FLAGS_board}" |
62 BOARD_KEYWORD="$(portageq-${FLAGS_board} envvar ARCH)" | 63 BOARD_KEYWORD="$(portageq-${FLAGS_board} envvar ARCH)" |
63 else | 64 else |
64 BOARD_DIR="" # --host specified | 65 BOARD_DIR="" # --host specified |
65 EQUERYCMD=equery | 66 EQUERYCMD=equery |
66 EBUILDCMD=ebuild | 67 EBUILDCMD=ebuild |
| 68 PORTAGEQCMD=portageq |
67 BOARD_STR="host" | 69 BOARD_STR="host" |
68 BOARD_KEYWORD="$(portageq envvar ARCH)" | 70 BOARD_KEYWORD="$(portageq envvar ARCH)" |
69 fi | 71 fi |
70 | 72 |
71 WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon | 73 WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon |
72 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords | 74 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords |
73 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask | 75 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask |
74 WORKON_FILE=${WORKON_DIR}/${FLAGS_board:-host} | 76 WORKON_FILE=${WORKON_DIR}/${FLAGS_board:-host} |
75 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon | 77 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon |
76 UNMASK_FILE=${UNMASK_DIR}/cros-workon | 78 UNMASK_FILE=${UNMASK_DIR}/cros-workon |
(...skipping 14 matching lines...) Expand all Loading... |
91 fi | 93 fi |
92 if [ ! -L "${UNMASK_FILE}" ]; then | 94 if [ ! -L "${UNMASK_FILE}" ]; then |
93 [ -f "${UNMASK_FILE}" ] && sudo mv "${UNMASK_FILE}" "${WORKON_FILE}" | 95 [ -f "${UNMASK_FILE}" ] && sudo mv "${UNMASK_FILE}" "${WORKON_FILE}" |
94 sudo ln -s "${WORKON_FILE}" "${UNMASK_FILE}" || \ | 96 sudo ln -s "${WORKON_FILE}" "${UNMASK_FILE}" || \ |
95 die "ln -s ${WORKON_FILE} ${UNMASK_FILE}" | 97 die "ln -s ${WORKON_FILE} ${UNMASK_FILE}" |
96 fi | 98 fi |
97 | 99 |
98 find_keyword_workon_ebuilds() { | 100 find_keyword_workon_ebuilds() { |
99 keyword="${1}" | 101 keyword="${1}" |
100 | 102 |
101 pushd "${BOARD_DIR}"/etc/ 1> /dev/null | 103 local cros_overlays=$("${PORTAGEQCMD}" envvar PORTDIR_OVERLAY) |
102 source make.conf | |
103 popd 1> /dev/null | |
104 local CROS_OVERLAYS="${PORTDIR_OVERLAY}" | |
105 | 104 |
106 # NOTE: overlay may be a symlink, and we have to use ${overlay}/ | 105 # NOTE: overlay may be a symlink, and we have to use ${overlay}/ |
107 for overlay in ${CROS_OVERLAYS}; do | 106 for overlay in ${cros_overlays}; do |
108 # only look up ebuilds named 9999 to eliminate duplicates | 107 # only look up ebuilds named 9999 to eliminate duplicates |
109 find ${overlay}/ -name '*9999.ebuild' | \ | 108 find ${overlay}/ -name '*9999.ebuild' | \ |
110 xargs grep -l "inherit.*cros-workon" | \ | 109 xargs grep -l "inherit.*cros-workon" | \ |
111 xargs grep -l "KEYWORDS=.*${keyword}.*" | 110 xargs grep -l "KEYWORDS=.*${keyword}.*" |
112 done | 111 done |
113 } | 112 } |
114 | 113 |
115 show_workon_ebuilds() { | 114 show_workon_ebuilds() { |
116 keyword=$1 | 115 keyword=$1 |
117 | 116 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 fi | 266 fi |
268 | 267 |
269 case ${WORKON_CMD} in | 268 case ${WORKON_CMD} in |
270 start) ebuild_to_live "${ATOM_LIST}" ;; | 269 start) ebuild_to_live "${ATOM_LIST}" ;; |
271 stop) ebuild_to_stable "${ATOM_LIST}" ;; | 270 stop) ebuild_to_stable "${ATOM_LIST}" ;; |
272 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; | 271 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; |
273 list-all) show_all_live_ebuilds ;; | 272 list-all) show_all_live_ebuilds ;; |
274 iterate)ebuild_iterate "${ATOM_LIST}" ;; | 273 iterate)ebuild_iterate "${ATOM_LIST}" ;; |
275 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; | 274 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; |
276 esac | 275 esac |
OLD | NEW |