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

Side by Side Diff: cros_workon

Issue 2966016: cros_workon: fix forall (broken by --host) :/ (Closed) Base URL: ssh://gitrw.chromium.org/crosutils
Patch Set: Created 10 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 44
45 # board dir config 45 # board dir config
46 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ 46 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \
47 die "Flags --host and --board are mutually exclusive." 47 die "Flags --host and --board are mutually exclusive."
48 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ 48 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \
49 die "You must specify either --host or --board=" 49 die "You must specify either --host or --board="
50 50
51 if [ -n "${FLAGS_board}" ]; then 51 if [ -n "${FLAGS_board}" ]; then
52 BOARD_DIR=/build/"${FLAGS_board}" # --board specified 52 BOARD_DIR=/build/"${FLAGS_board}" # --board specified
53 EQUERY=equery-"${FLAGS_board}" 53 EQUERYCMD=equery-"${FLAGS_board}"
54 EBUILDCMD=ebuild-"${FLAGS_board}"
54 else 55 else
55 BOARD_DIR="" # --host specified 56 BOARD_DIR="" # --host specified
56 EQUERY=equery 57 EQUERYCMD=equery
58 EBUILDCMD=ebuild
57 fi 59 fi
58 60
59 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords 61 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords
60 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask 62 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask
61 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon 63 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
62 UNMASK_FILE=${UNMASK_DIR}/cros-workon 64 UNMASK_FILE=${UNMASK_DIR}/cros-workon
63 65
64 sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || \ 66 sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || \
65 die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}" 67 die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}"
66 sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \ 68 sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \
67 die "touch ${KEYWORDS_FILE} ${UNMASK_FILE}" 69 die "touch ${KEYWORDS_FILE} ${UNMASK_FILE}"
68 70
69 # Canonicalize package name to category/package. 71 # Canonicalize package name to category/package.
70 canonicalize_name () { 72 canonicalize_name () {
71 local pkgfile 73 local pkgfile
72 local pkgname 74 local pkgname
73 75
74 if ! pkgfile=$(${EQUERY} which $1); then 76 if ! pkgfile=$(${EQUERYCMD} which $1); then
75 warn "error looking up package $1" 1>&2 77 warn "error looking up package $1" 1>&2
76 return 1 78 return 1
77 fi 79 fi
78 80
79 pkgname=$(\ 81 pkgname=$(\
80 echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }') 82 echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }')
81 83
82 if ! grep -q "cros-workon" ${pkgfile}; then 84 if ! grep -q "cros-workon" ${pkgfile}; then
83 warn "${pkgname} is not a cros-workon package" 1>&2 85 warn "${pkgname} is not a cros-workon package" 1>&2
84 return 1 86 return 1
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 fi 142 fi
141 done 143 done
142 } 144 }
143 145
144 # Run a command on all or a set of repos. 146 # Run a command on all or a set of repos.
145 ebuild_forall() { 147 ebuild_forall() {
146 local atoms=$1 148 local atoms=$1
147 149
148 for atom in ${atoms}; do 150 for atom in ${atoms}; do
149 info "Running \"${FLAGS_command}\" on ${atom}" 151 info "Running \"${FLAGS_command}\" on ${atom}"
150 eval $(ebuild-${FLAGS_board} $(${EQUERY} which ${atom}) info) 152 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${atom}) info)
151 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") 153 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}")
152 done 154 done
153 } 155 }
154 156
155 show_workon_ebuilds() { 157 show_workon_ebuilds() {
156 pushd "${BOARD_DIR}"/etc/ 1> /dev/null 158 pushd "${BOARD_DIR}"/etc/ 1> /dev/null
157 source make.conf 159 source make.conf
158 popd 1> /dev/null 160 popd 1> /dev/null
159 local CROS_OVERLAYS="${PORTDIR_OVERLAY}" 161 local CROS_OVERLAYS="${PORTDIR_OVERLAY}"
160 162
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 esac 195 esac
194 fi 196 fi
195 197
196 case ${WORKON_CMD} in 198 case ${WORKON_CMD} in
197 start) ebuild_to_live "${ATOM_LIST}" ;; 199 start) ebuild_to_live "${ATOM_LIST}" ;;
198 stop) ebuild_to_stable "${ATOM_LIST}" ;; 200 stop) ebuild_to_stable "${ATOM_LIST}" ;;
199 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ;; 201 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ;;
200 forall) ebuild_forall "${ATOM_LIST}" ;; 202 forall) ebuild_forall "${ATOM_LIST}" ;;
201 *) die "invalid cros_workon command" ;; 203 *) die "invalid cros_workon command" ;;
202 esac 204 esac
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698