Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: cros_workon

Issue 3400001: cros_workon: redefine the concept of a "workon" package list to depend on the board (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: . Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/cros_workon_common.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ 53 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \
54 FLAGS_board="" # kill board 54 FLAGS_board="" # kill board
55 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ 55 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \
56 die "You must specify either --host or --board=" 56 die "You must specify either --host or --board="
57 57
58 if [ -n "${FLAGS_board}" ]; then 58 if [ -n "${FLAGS_board}" ]; then
59 BOARD_DIR=/build/"${FLAGS_board}" # --board specified 59 BOARD_DIR=/build/"${FLAGS_board}" # --board specified
60 EQUERYCMD=equery-"${FLAGS_board}" 60 EQUERYCMD=equery-"${FLAGS_board}"
61 EBUILDCMD=ebuild-"${FLAGS_board}" 61 EBUILDCMD=ebuild-"${FLAGS_board}"
62 BOARD_STR="${FLAGS_board}" 62 BOARD_STR="${FLAGS_board}"
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
67 BOARD_STR="host" 68 BOARD_STR="host"
69 BOARD_KEYWORD="$(portageq envvar ARCH)"
68 fi 70 fi
69 71
70 WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon 72 WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon
71 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords 73 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords
72 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask 74 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask
73 WORKON_FILE=${WORKON_DIR}/${FLAGS_board:-host} 75 WORKON_FILE=${WORKON_DIR}/${FLAGS_board:-host}
74 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon 76 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
75 UNMASK_FILE=${UNMASK_DIR}/cros-workon 77 UNMASK_FILE=${UNMASK_DIR}/cros-workon
76 78
77 # TODO(msb): remove the backward compatibility after 09/01/2010 79 # TODO(msb): remove the backward compatibility after 09/01/2010
(...skipping 10 matching lines...) Expand all
88 die "ln -s ${WORKON_FILE} ${UNMASK_FILE}" 90 die "ln -s ${WORKON_FILE} ${UNMASK_FILE}"
89 fi 91 fi
90 sudo touch "${WORKON_FILE}" || \ 92 sudo touch "${WORKON_FILE}" || \
91 die "touch ${WORKON_FILE}" 93 die "touch ${WORKON_FILE}"
92 94
93 # Canonicalize package name to category/package. 95 # Canonicalize package name to category/package.
94 canonicalize_name () { 96 canonicalize_name () {
95 local pkgfile 97 local pkgfile
96 local pkgname 98 local pkgname
97 99
98 if ! pkgfile=$(ACCEPT_KEYWORDS="**" ${EQUERYCMD} which $1); then 100 if ! pkgfile=$(ACCEPT_KEYWORDS="~${BOARD_KEYWORD}" ${EQUERYCMD} which $1); the n
99 warn "error looking up package $1" 1>&2 101 warn "error looking up package $1" 1>&2
100 return 1 102 return 1
101 fi 103 fi
102 104
103 pkgname=$(\ 105 pkgname=$(\
104 echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }') 106 echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }')
105 107
106 if ! grep -q "cros-workon" ${pkgfile}; then 108 if ! grep -q "cros-workon" ${pkgfile}; then
107 warn "${pkgname} is not a cros-workon package" 1>&2 109 warn "${pkgname} is not a cros-workon package" 1>&2
108 return 1 110 return 1
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 for atom in ${atoms}; do 244 for atom in ${atoms}; do
243 info "Running \"${FLAGS_command}\" on ${atom}" 245 info "Running \"${FLAGS_command}\" on ${atom}"
244 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${atom}) info) 246 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${atom}) info)
245 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") 247 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}")
246 done 248 done
247 } 249 }
248 250
249 # --all makes commands operate on different lists 251 # --all makes commands operate on different lists
250 if [ ${FLAGS_all} = "${FLAGS_TRUE}" ]; then 252 if [ ${FLAGS_all} = "${FLAGS_TRUE}" ]; then
251 case ${WORKON_CMD} in 253 case ${WORKON_CMD} in
252 start) ATOM_LIST=$(show_workon_ebuilds);; 254 start) ATOM_LIST=$(show_workon_ebuilds ${BOARD_KEYWORD});;
253 stop|iterate) ATOM_LIST=$(show_live_ebuilds);; 255 stop|iterate) ATOM_LIST=$(show_live_ebuilds);;
254 list) ;; 256 list) ;;
255 *) die "--all is invalid for the given command";; 257 *) die "--all is invalid for the given command";;
256 esac 258 esac
257 else # not selected --all 259 else # not selected --all
258 case ${WORKON_CMD} in 260 case ${WORKON_CMD} in
259 start|stop|iterate) 261 start|stop|iterate)
260 ATOM_LIST=$@ 262 ATOM_LIST=$@
261 if [ -z "${ATOM_LIST}" ]; then 263 if [ -z "${ATOM_LIST}" ]; then
262 die "${WORKON_CMD}: No packages specified" 264 die "${WORKON_CMD}: No packages specified"
263 elif ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then 265 elif ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then
264 die "Error parsing package list" 266 die "Error parsing package list"
265 fi;; 267 fi;;
266 *) ;; 268 *) ;;
267 esac 269 esac
268 fi 270 fi
269 271
270 case ${WORKON_CMD} in 272 case ${WORKON_CMD} in
271 start) ebuild_to_live "${ATOM_LIST}" ;; 273 start) ebuild_to_live "${ATOM_LIST}" ;;
272 stop) ebuild_to_stable "${ATOM_LIST}" ;; 274 stop) ebuild_to_stable "${ATOM_LIST}" ;;
273 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ;; 275 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ${BOARD_KEYWORD} ;;
274 iterate)ebuild_iterate "${ATOM_LIST}" ;; 276 iterate)ebuild_iterate "${ATOM_LIST}" ;;
275 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; 277 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;;
276 esac 278 esac
OLDNEW
« no previous file with comments | « no previous file | lib/cros_workon_common.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698