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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 exit 1 | 125 exit 1 |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 # 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. | 129 # 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. |
130 regen_manifest_and_sync() { | 130 regen_manifest_and_sync() { |
131 find_repo_dir | 131 find_repo_dir |
132 echo Using $REPODIR | 132 echo Using $REPODIR |
133 echo "Trying to generate local manifests for.." | 133 echo "Trying to generate local manifests for.." |
134 rm -f $REPODIR/local_manifest.xml | 134 rm -f $REPODIR/local_manifest.xml |
135 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> $REPODIR/local_manifest.x
ml | |
136 echo "<manifest>" >> $REPODIR/local_manifest.xml | |
137 | 135 |
138 cat ${KEYWORDS_FILE} | | 136 MANIFEST_ENTRIES=$(cat ${KEYWORDS_FILE} | |
139 { | 137 { |
140 while read line | 138 while read line |
141 do | 139 do |
142 pkgname=`basename ${line}` | 140 pkgname=`basename ${line}` |
143 echo "Now working on ... ${pkgname}" | 141 echo "Now working on ... ${pkgname}" 1>&2 |
144 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) | 142 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) |
145 echo "Looking for ${CROS_WORKON_PROJECT}.git" | 143 echo "Looking for ${CROS_WORKON_PROJECT}.git" 1>&2 |
146 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/man
ifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//') | 144 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/man
ifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//') |
147 echo $REPO_ELEMENT | 145 echo "$REPO_ELEMENT" |
148 if [ -z "${REPO_ELEMENT}" ] ; then | 146 if [ -z "${REPO_ELEMENT}" ] ; then |
149 echo "Unable to find ${pkgname} in manifest. Aborting." | 147 echo "Unable to find ${pkgname} in manifest. Aborting." 1>&2 |
150 exit 1 | 148 exit 1 |
151 fi | 149 fi |
152 echo ${REPO_ELEMENT} >> $REPODIR/local_manifest.xml | |
153 done | 150 done |
154 } | 151 }) |
155 echo "</manifest>" >> $REPODIR/local_manifest.xml | 152 |
| 153 if [ -n "${MANIFEST_ENTRIES}" ]; then |
| 154 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> $REPODIR/local_manifest
.xml |
| 155 echo "<manifest>" >> $REPODIR/local_manifest.xml |
| 156 echo "${MANIFEST_ENTRIES}"|sort|uniq >> ${REPODIR}/local_manifest.xml |
| 157 echo "</manifest>" >> $REPODIR/local_manifest.xml |
| 158 fi |
156 } | 159 } |
157 | 160 |
158 # Move a stable ebuild to the live development catgeory. The ebuild | 161 # Move a stable ebuild to the live development catgeory. The ebuild |
159 # src_unpack step fetches the package source for local development. | 162 # src_unpack step fetches the package source for local development. |
160 ebuild_to_live () { | 163 ebuild_to_live () { |
161 local atoms=$1 | 164 local atoms=$1 |
162 | 165 |
163 for atom in ${atoms}; do | 166 for atom in ${atoms}; do |
164 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then | 167 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then |
165 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" | 168 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 esac | 226 esac |
224 fi | 227 fi |
225 | 228 |
226 case ${WORKON_CMD} in | 229 case ${WORKON_CMD} in |
227 start) ebuild_to_live "${ATOM_LIST}" ;; | 230 start) ebuild_to_live "${ATOM_LIST}" ;; |
228 stop) ebuild_to_stable "${ATOM_LIST}" ;; | 231 stop) ebuild_to_stable "${ATOM_LIST}" ;; |
229 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ;; | 232 list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_worko
n_ebuilds ;; |
230 iterate)ebuild_iterate "${ATOM_LIST}" ;; | 233 iterate)ebuild_iterate "${ATOM_LIST}" ;; |
231 *) die "invalid cros_workon command" ;; | 234 *) die "invalid cros_workon command" ;; |
232 esac | 235 esac |
OLD | NEW |