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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 fi | 146 fi |
147 curdir=`dirname "$curdir"` | 147 curdir=`dirname "$curdir"` |
148 done | 148 done |
149 echo "Unable to find .repo directory. Did you checkout with repo?" | 149 echo "Unable to find .repo directory. Did you checkout with repo?" |
150 exit 1 | 150 exit 1 |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 # 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 # 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. |
155 regen_manifest_and_sync() { | 155 regen_manifest_and_sync() { |
156 find_repo_dir | 156 for pkgname in $(show_live_ebuilds); do |
157 local_manifest="${REPODIR}/local_manifest.xml" | 157 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) |
| 158 local srcdir=$(readlink -f ${CROS_WORKON_SRCDIR}) |
| 159 local trunkdir=$(readlink -f ${CHROOT_TRUNK_DIR}) |
| 160 local project_path=${srcdir#$(readlink -f ${CHROOT_TRUNK_DIR})/} |
158 | 161 |
159 # ensure we don't clobber existing manifest entries | 162 loman add --workon "${CROS_WORKON_PROJECT}" "${project_path}" |
160 if [ -f "${local_manifest}" ]; then | 163 done |
161 grep -q -i "<remote" "${local_manifest}" | 164 echo "Please run \"repo sync\" now." |
162 if [ $? -ne 1 ]; then | |
163 die "Your local manifest will be clobbered running cros_workon. You can no
t have any <remote> tags at all." | |
164 fi | |
165 sed -ne '/^[[:space:]]\+[^[:space:]]/q1' "${local_manifest}" | |
166 if [ $? -ne 0 ]; then | |
167 die "Your local manifest will be clobbered running cros_workon. You can no
t have any tags that span multiple lines or are indented." | |
168 fi | |
169 egrep -q "^[^<]" "${local_manifest}" | |
170 if [ $? -ne 1 ]; then | |
171 die "Your local manifest will be clobbered running cros_workon. You can no
t have any tags that span multiple lines" | |
172 fi | |
173 grep -v "<project" "${local_manifest}" | grep -q -i "<project" | |
174 if [ $? -eq 0 ]; then | |
175 die "Your local manifest has mixed case tags for project. You can not hav
e mixed case tags" | |
176 fi | |
177 fi | |
178 # preserve old manifest entries | |
179 [ -f "${local_manifest}" ] && \ | |
180 MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^<project") | |
181 | |
182 rm -f "${local_manifest}" | |
183 | |
184 # get new manifest entries | |
185 MANIFEST_ENTRIES=$(show_live_ebuilds | | |
186 { | |
187 while read line | |
188 do | |
189 pkgname=`basename ${line}` | |
190 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) | |
191 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/man
ifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//') | |
192 echo "$REPO_ELEMENT" | |
193 done | |
194 }) | |
195 | |
196 if [ -n "${MANIFEST_ENTRIES}" ] || [ -n "${MANIFEST_ENTRIES_OLD}" ]; then | |
197 info "Creating local manifest for workon packages.." | |
198 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> "${local_manifest}" | |
199 echo "<manifest>" >> "${local_manifest}" | |
200 echo -e "${MANIFEST_ENTRIES}\n${MANIFEST_ENTRIES_OLD}" \ | |
201 | sort | uniq >> "${local_manifest}" | |
202 echo "</manifest>" >> "${local_manifest}" | |
203 echo "Please run \"repo sync\" now." | |
204 fi | |
205 } | 165 } |
206 | 166 |
207 # Move a stable ebuild to the live development catgeory. The ebuild | 167 # Move a stable ebuild to the live development catgeory. The ebuild |
208 # src_unpack step fetches the package source for local development. | 168 # src_unpack step fetches the package source for local development. |
209 ebuild_to_live () { | 169 ebuild_to_live () { |
210 local atoms=$1 | 170 local atoms=$1 |
211 local atoms_success="" | 171 local atoms_success="" |
212 | 172 |
213 for atom in ${atoms}; do | 173 for atom in ${atoms}; do |
214 if ! grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then | 174 if ! grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 esac | 233 esac |
274 fi | 234 fi |
275 | 235 |
276 case ${WORKON_CMD} in | 236 case ${WORKON_CMD} in |
277 start) ebuild_to_live "${ATOM_LIST}" ;; | 237 start) ebuild_to_live "${ATOM_LIST}" ;; |
278 stop) ebuild_to_stable "${ATOM_LIST}" ;; | 238 stop) ebuild_to_stable "${ATOM_LIST}" ;; |
279 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; | 239 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ${BOARD_KEYWORD} ;; |
280 iterate)ebuild_iterate "${ATOM_LIST}" ;; | 240 iterate)ebuild_iterate "${ATOM_LIST}" ;; |
281 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; | 241 *) die "$(basename $0): command '${WORKON_CMD}' not recognized" ;; |
282 esac | 242 esac |
OLD | NEW |