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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 Loading... |
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 |
OLD | NEW |