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

Side by Side Diff: cros_workon

Issue 3115001: cros_workon: misc fixes to manifest re-generation (Closed) Base URL: ssh://gitrw.chromium.org/crosutils
Patch Set: Address anush's comments Created 10 years, 4 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
« 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 curdir=`dirname "$curdir"` 122 curdir=`dirname "$curdir"`
123 done 123 done
124 echo "Unable to find .repo directory. Did you checkout with repo?" 124 echo "Unable to find .repo directory. Did you checkout with repo?"
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 local_manifest="${REPODIR}/local_manifest.xml"
133 echo "Trying to generate local manifests for.."
134 rm -f $REPODIR/local_manifest.xml
135 133
134 # preserve old manifest entries
135 MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^<project")
136
137 rm -f "${local_manifest}"
138
139 # get new manifest entries
136 MANIFEST_ENTRIES=$(cat ${KEYWORDS_FILE} | 140 MANIFEST_ENTRIES=$(cat ${KEYWORDS_FILE} |
137 { 141 {
138 while read line 142 while read line
139 do 143 do
140 pkgname=`basename ${line}` 144 pkgname=`basename ${line}`
141 echo "Now working on ... ${pkgname}" 1>&2
142 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) 145 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info)
143 echo "Looking for ${CROS_WORKON_PROJECT}.git" 1>&2
144 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/man ifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//') 146 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/man ifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//')
145 echo "$REPO_ELEMENT" 147 echo "$REPO_ELEMENT"
146 if [ -z "${REPO_ELEMENT}" ] ; then
147 echo "Unable to find ${pkgname} in manifest. Aborting." 1>&2
148 exit 1
149 fi
150 done 148 done
151 }) 149 })
152 150
153 if [ -n "${MANIFEST_ENTRIES}" ]; then 151 if [ -n "${MANIFEST_ENTRIES}" ] || [ -n "${MANIFEST_ENTRIES_OLD}" ]; then
154 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> $REPODIR/local_manifest .xml 152 info "Creating local manifest for workon packages.."
155 echo "<manifest>" >> $REPODIR/local_manifest.xml 153 echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" >> "${local_manifest}"
156 echo "${MANIFEST_ENTRIES}"|sort|uniq >> ${REPODIR}/local_manifest.xml 154 echo "<manifest>" >> "${local_manifest}"
157 echo "</manifest>" >> $REPODIR/local_manifest.xml 155 echo -e "${MANIFEST_ENTRIES}\n${MANIFEST_ENTRIES_OLD}" \
156 | sort | uniq >> "${local_manifest}"
157 echo "</manifest>" >> "${local_manifest}"
158 echo "Please run \"repo sync\" now."
158 fi 159 fi
159 } 160 }
160 161
161 # Move a stable ebuild to the live development catgeory. The ebuild 162 # Move a stable ebuild to the live development catgeory. The ebuild
162 # src_unpack step fetches the package source for local development. 163 # src_unpack step fetches the package source for local development.
163 ebuild_to_live () { 164 ebuild_to_live () {
164 local atoms=$1 165 local atoms=$1
165 166
166 for atom in ${atoms}; do 167 for atom in ${atoms}; do
167 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then 168 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then
168 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" 169 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\""
169 sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\"" 170 sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\""
170 regen_manifest_and_sync
171 else 171 else
172 warn "Already working on ${atom}" 172 warn "Already working on ${atom}"
173 fi 173 fi
174 done 174 done
175 } 175 }
176 176
177 # Move a live development ebuild back to stable. 177 # Move a live development ebuild back to stable.
178 ebuild_to_stable () { 178 ebuild_to_stable () {
179 local atoms=$1 179 local atoms=$1
180 180
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 if [ -z "${ATOM_LIST}" ]; then 220 if [ -z "${ATOM_LIST}" ]; then
221 die "${WORKON_CMD}: No packages specified" 221 die "${WORKON_CMD}: No packages specified"
222 elif ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then 222 elif ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then
223 die "Error parsing package list" 223 die "Error parsing package list"
224 fi;; 224 fi;;
225 *) ;; 225 *) ;;
226 esac 226 esac
227 fi 227 fi
228 228
229 case ${WORKON_CMD} in 229 case ${WORKON_CMD} in
230 start) ebuild_to_live "${ATOM_LIST}" ;; 230 start) ebuild_to_live "${ATOM_LIST}"; regen_manifest_and_sync ;;
231 stop) ebuild_to_stable "${ATOM_LIST}" ;; 231 stop) ebuild_to_stable "${ATOM_LIST}" ;;
232 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 ;;
233 iterate)ebuild_iterate "${ATOM_LIST}" ;; 233 iterate)ebuild_iterate "${ATOM_LIST}" ;;
234 *) die "invalid cros_workon command" ;; 234 *) die "invalid cros_workon command" ;;
235 esac 235 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