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

Side by Side Diff: cros_workon

Issue 3227006: Cause cros_workon to die rather than clobber local_manifest (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git
Patch Set: Changed greps to use -q instead of redirects 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 | 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 echo "Unable to find .repo directory. Did you checkout with repo?" 141 echo "Unable to find .repo directory. Did you checkout with repo?"
142 exit 1 142 exit 1
143 } 143 }
144 144
145 145
146 # 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. 146 # 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.
147 regen_manifest_and_sync() { 147 regen_manifest_and_sync() {
148 find_repo_dir 148 find_repo_dir
149 local_manifest="${REPODIR}/local_manifest.xml" 149 local_manifest="${REPODIR}/local_manifest.xml"
150 150
151 # ensure we don't clobber existing manifest entries
152 if [ -f "${local_manifest}" ]; then
153 grep -q -i "<remote" "${local_manifest}"
154 if [ $? -ne 1 ]; then
155 die "Your local manifest will be clobbered running cros_workon. You ca n not have any <remote> tags at all."
156 fi
157 sed -ne '/^[[:space:]]\+[^[:space:]]/q1' "${local_manifest}"
158 if [ $? -ne 0 ]; then
159 die "Your local manifest will be clobbered running cros_workon. You ca n not have any tags that span multiple lines or are indented."
160 fi
161 egrep -q "^[^<]" "${local_manifest}"
162 if [ $? -ne 1 ]; then
163 die "Your local manifest will be clobbered running cros_workon. You ca n not have any tags that span multiple lines"
164 fi
165 grep -v "<project" "${local_manifest}" | grep -q -i "<project"
166 if [ $? -eq 0 ]; then
167 die "Your local manifest has mixed case tags for project. You can not have mixed case tags"
168 fi
169 fi
151 # preserve old manifest entries 170 # preserve old manifest entries
152 [ -f "${local_manifest}" ] && \ 171 [ -f "${local_manifest}" ] && \
153 MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^<project") 172 MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^<project")
154 173
155 rm -f "${local_manifest}" 174 rm -f "${local_manifest}"
156 175
157 # get new manifest entries 176 # get new manifest entries
158 MANIFEST_ENTRIES=$(show_live_ebuilds | 177 MANIFEST_ENTRIES=$(show_live_ebuilds |
159 { 178 {
160 while read line 179 while read line
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 esac 257 esac
239 fi 258 fi
240 259
241 case ${WORKON_CMD} in 260 case ${WORKON_CMD} in
242 start) ebuild_to_live "${ATOM_LIST}"; regen_manifest_and_sync ;; 261 start) ebuild_to_live "${ATOM_LIST}"; regen_manifest_and_sync ;;
243 stop) ebuild_to_stable "${ATOM_LIST}" ;; 262 stop) ebuild_to_stable "${ATOM_LIST}" ;;
244 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ;; 263 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko n_ebuilds ;;
245 iterate)ebuild_iterate "${ATOM_LIST}" ;; 264 iterate)ebuild_iterate "${ATOM_LIST}" ;;
246 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; 265 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;;
247 esac 266 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