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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 local name=$(canonicalize_name "${atom}") | 128 local name=$(canonicalize_name "${atom}") |
129 [ -n "${name}" ] || return 1 | 129 [ -n "${name}" ] || return 1 |
130 names+=" ${name}" | 130 names+=" ${name}" |
131 done | 131 done |
132 | 132 |
133 echo "${names}" | 133 echo "${names}" |
134 } | 134 } |
135 | 135 |
136 # Display ebuilds currently part of the live branch and open for development. | 136 # Display ebuilds currently part of the live branch and open for development. |
137 show_live_ebuilds () { | 137 show_live_ebuilds () { |
138 sed -n 's/^[~=]\(.*\)-9999$/\1/p' "${WORKON_FILE}" | 138 sed -n 's/^=\(.*\)-9999$/\1/p' "${WORKON_FILE}" |
139 } | 139 } |
140 | 140 |
141 # Display ebuilds currently part of the live branch and open for development | 141 # Display ebuilds currently part of the live branch and open for development |
142 # for any board that currently has live ebuilds. | 142 # for any board that currently has live ebuilds. |
143 show_all_live_ebuilds () { | 143 show_all_live_ebuilds () { |
144 for workon_file in ${WORKON_DIR}/*; do | 144 for workon_file in ${WORKON_DIR}/*; do |
145 if [ -s "${workon_file}" ]; then | 145 if [ -s "${workon_file}" ]; then |
146 echo -e "${V_BOLD_GREEN}$(basename ${workon_file}):${V_VIDOFF}" | 146 echo -e "${V_BOLD_GREEN}$(basename ${workon_file}):${V_VIDOFF}" |
147 sed -n 's/^[~=]\(.*\)-9999$/ \1/p' "${workon_file}" | 147 sed -n 's/^=\(.*\)-9999$/ \1/p' "${workon_file}" |
148 echo "" | 148 echo "" |
149 fi | 149 fi |
150 done | 150 done |
151 } | 151 } |
152 | 152 |
153 # This is called only for "cros-workon start". We dont handle the "stop" case si
nce the local changes are ignored anyway since the 9999.ebuild is masked and we
dont want to deal with what to do with the user's local changes. | 153 # This is called only for "cros-workon start". We dont handle the "stop" case si
nce the local changes are ignored anyway since the 9999.ebuild is masked and we
dont want to deal with what to do with the user's local changes. |
154 regen_manifest_and_sync() { | 154 regen_manifest_and_sync() { |
155 # Nothing to do unless you are working on the minilayout | 155 # Nothing to do unless you are working on the minilayout |
156 local manifest=${CHROOT_TRUNK_DIR}/.repo/manifest.xml | 156 local manifest=${CHROOT_TRUNK_DIR}/.repo/manifest.xml |
157 if [ $(basename $(readlink -f ${manifest})) != "minilayout.xml" ]; then | 157 if [ $(basename $(readlink -f ${manifest})) != "minilayout.xml" ]; then |
(...skipping 11 matching lines...) Expand all Loading... |
169 echo "Please run \"repo sync\" now." | 169 echo "Please run \"repo sync\" now." |
170 } | 170 } |
171 | 171 |
172 # Move a stable ebuild to the live development catgeory. The ebuild | 172 # Move a stable ebuild to the live development catgeory. The ebuild |
173 # src_unpack step fetches the package source for local development. | 173 # src_unpack step fetches the package source for local development. |
174 ebuild_to_live () { | 174 ebuild_to_live () { |
175 local atoms=$1 | 175 local atoms=$1 |
176 local atoms_success="" | 176 local atoms_success="" |
177 | 177 |
178 for atom in ${atoms}; do | 178 for atom in ${atoms}; do |
179 if ! grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then | 179 if ! grep -qx "=${atom}-9999" "${WORKON_FILE}" ; then |
180 if sudo bash -c "echo \"=${atom}-9999\" >> \"${WORKON_FILE}\""; then | 180 if sudo bash -c "echo \"=${atom}-9999\" >> \"${WORKON_FILE}\""; then |
181 atoms_success="${atoms_success} ${atom}" | 181 atoms_success="${atoms_success} ${atom}" |
182 fi | 182 fi |
183 else | 183 else |
184 warn "Already working on ${atom}" | 184 warn "Already working on ${atom}" |
185 fi | 185 fi |
186 done | 186 done |
187 [ -n "${atoms_success}" ] && regen_manifest_and_sync && \ | 187 [ -n "${atoms_success}" ] && regen_manifest_and_sync && \ |
188 info "Started working on '${atoms_success/ /}' for '${BOARD_STR}'" | 188 info "Started working on '${atoms_success/ /}' for '${BOARD_STR}'" |
189 } | 189 } |
190 | 190 |
191 # Move a live development ebuild back to stable. | 191 # Move a live development ebuild back to stable. |
192 ebuild_to_stable () { | 192 ebuild_to_stable () { |
193 local atoms=$1 | 193 local atoms=$1 |
194 local atoms_success="" | 194 local atoms_success="" |
195 | 195 |
196 for atom in ${atoms}; do | 196 for atom in ${atoms}; do |
197 if grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then | 197 if grep -qx "=${atom}-9999" "${WORKON_FILE}" ; then |
198 if sudo sed -e "/^[~=]${atom/\//\\/}-9999\$/d" -i "${WORKON_FILE}"; then | 198 if sudo sed -e "/^=${atom/\//\\/}-9999\$/d" -i "${WORKON_FILE}"; then |
199 atoms_success="${atoms_success} ${atom}" | 199 atoms_success="${atoms_success} ${atom}" |
200 fi | 200 fi |
201 else | 201 else |
202 warn "Not working on ${atom}" | 202 warn "Not working on ${atom}" |
203 fi | 203 fi |
204 done | 204 done |
205 [ -n "${atoms_success}" ] && \ | 205 [ -n "${atoms_success}" ] && \ |
206 info "Stopped working on '${atoms_success/ /}' for '${BOARD_STR}'" | 206 info "Stopped working on '${atoms_success/ /}' for '${BOARD_STR}'" |
207 } | 207 } |
208 | 208 |
(...skipping 30 matching lines...) Expand all Loading... |
239 fi | 239 fi |
240 | 240 |
241 case ${WORKON_CMD} in | 241 case ${WORKON_CMD} in |
242 start) ebuild_to_live "${ATOM_LIST}" ;; | 242 start) ebuild_to_live "${ATOM_LIST}" ;; |
243 stop) ebuild_to_stable "${ATOM_LIST}" ;; | 243 stop) ebuild_to_stable "${ATOM_LIST}" ;; |
244 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; | 244 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; |
245 list-all) show_all_live_ebuilds ;; | 245 list-all) show_all_live_ebuilds ;; |
246 iterate)ebuild_iterate "${ATOM_LIST}" ;; | 246 iterate)ebuild_iterate "${ATOM_LIST}" ;; |
247 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; | 247 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; |
248 esac | 248 esac |
OLD | NEW |