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

Side by Side Diff: cros_workon

Issue 2909009: cros_workon: introduce a very simple listall command (Closed) Base URL: ssh://gitrw.chromium.org/crosutils
Patch Set: Removed space at the end of the line. Thanks pre-submit check! 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 11 matching lines...) Expand all
22 "The board to set package keywords for." 22 "The board to set package keywords for."
23 DEFINE_boolean host "${FLAGS_FALSE}" \ 23 DEFINE_boolean host "${FLAGS_FALSE}" \
24 "Uses the host instead of board" 24 "Uses the host instead of board"
25 DEFINE_string command "git status" \ 25 DEFINE_string command "git status" \
26 "The command to be run by forall." 26 "The command to be run by forall."
27 27
28 FLAGS_HELP="usage: $0 <command> [flags] 28 FLAGS_HELP="usage: $0 <command> [flags]
29 commands: 29 commands:
30 start: Moves an ebuild to live (intended to support development) 30 start: Moves an ebuild to live (intended to support development)
31 stop: Moves an ebuild to stable (use last known good) 31 stop: Moves an ebuild to stable (use last known good)
32 list: List of all live ebuilds 32 list: List of current live ebuilds
33 listall: List all possible cros-workon ebuilds
33 forall: For each ebuild, cd to the source dir and run a commond" 34 forall: For each ebuild, cd to the source dir and run a commond"
34 FLAGS "$@" || exit 1 35 FLAGS "$@" || exit 1
35 eval set -- "${FLAGS_ARGV}" 36 eval set -- "${FLAGS_ARGV}"
36 37
38
39 # eat the workon command keywords: start, stop or list.
40 WORKON_CMD=$1
41 shift
42
43
37 # board dir config 44 # board dir config
38 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \ 45 [ -n "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_TRUE} ] && \
39 die "Flags --host and --board are mutually exclusive." 46 die "Flags --host and --board are mutually exclusive."
40 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \ 47 [ -z "${FLAGS_board}" ] && [ "${FLAGS_host}" = ${FLAGS_FALSE} ] && \
41 die "You must specify either --host or --board=" 48 die "You must specify either --host or --board="
42 49
43 if [ -n "${FLAGS_board}" ]; then 50 if [ -n "${FLAGS_board}" ]; then
44 BOARD_DIR=/build/"${FLAGS_board}" # --board specified 51 BOARD_DIR=/build/"${FLAGS_board}" # --board specified
45 EQUERY=equery-"${FLAGS_board}" 52 EQUERY=equery-"${FLAGS_board}"
46 else 53 else
47 BOARD_DIR="" # --host specified 54 BOARD_DIR="" # --host specified
48 EQUERY=equery 55 EQUERY=equery
49 fi 56 fi
50 57
51
52 # eat the workon command keywords: start, stop or list.
53 WORKON_CMD=$1
54 shift
55
56
57 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords 58 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords
58 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask 59 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask
59 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon 60 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
60 UNMASK_FILE=${UNMASK_DIR}/cros-workon 61 UNMASK_FILE=${UNMASK_DIR}/cros-workon
61 62
62 sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || \ 63 sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || \
63 die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}" 64 die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}"
64 sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \ 65 sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \
65 die "touch ${KEYWORDS_FILE} ${UNMASK_FILE}" 66 die "touch ${KEYWORDS_FILE} ${UNMASK_FILE}"
66 67
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ebuild_forall() { 153 ebuild_forall() {
153 local atoms=$1 154 local atoms=$1
154 155
155 for atom in ${atoms}; do 156 for atom in ${atoms}; do
156 info "Running \"${FLAGS_command}\" on ${atom}" 157 info "Running \"${FLAGS_command}\" on ${atom}"
157 eval $(ebuild-${FLAGS_board} $(${EQUERY} which ${atom}) info) 158 eval $(ebuild-${FLAGS_board} $(${EQUERY} which ${atom}) info)
158 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") 159 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}")
159 done 160 done
160 } 161 }
161 162
163 show_workon_ebuilds() {
164 pushd "${BOARD_DIR}"/etc/ 1> /dev/null
165 source make.conf
166 popd 1> /dev/null
167 local CROS_OVERLAYS="${PORTDIR_OVERLAY}"
168
169 for overlay in ${CROS_OVERLAYS}; do
170 pushd ${overlay} 1> /dev/null
171 find . -name '*.ebuild' | xargs fgrep cros-workon | \
172 awk -F / '{ print $2 "/" $3 }' | uniq | sort
173 popd 1> /dev/null
174 done
175 }
176
162 case ${WORKON_CMD} in 177 case ${WORKON_CMD} in
163 start) ebuild_to_live "${ATOM_LIST}" ;; 178 start) ebuild_to_live "${ATOM_LIST}" ;;
164 stop) ebuild_to_stable "${ATOM_LIST}" ;; 179 stop) ebuild_to_stable "${ATOM_LIST}" ;;
165 list) show_live_ebuilds ;; 180 list) show_live_ebuilds ;;
166 forall) ebuild_forall "${ATOM_LIST}" ;; 181 forall) ebuild_forall "${ATOM_LIST}" ;;
182 listall)show_workon_ebuilds ;;
167 *) die "invalid cros_workon command" ;; 183 *) die "invalid cros_workon command" ;;
168 esac 184 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