From 3d479354779051f1d2a47b60dd0da580b23ebc67 Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Fri, 3 Sep 2010 17:29:09 -0700 Subject: [PATCH] cros_workon: print out short summary of what has been done for start/stop BUG=6325 TEST=cros_workon start and stop for board and host and see it work Change-Id: Ic0680a273391fdf93b6ebbe0e34497807f31f240 Review URL: http://codereview.chromium.org/3352002 --- cros_workon | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/cros_workon b/cros_workon index e9400da47d..57835f8d51 100755 --- a/cros_workon +++ b/cros_workon @@ -59,10 +59,12 @@ if [ -n "${FLAGS_board}" ]; then BOARD_DIR=/build/"${FLAGS_board}" # --board specified EQUERYCMD=equery-"${FLAGS_board}" EBUILDCMD=ebuild-"${FLAGS_board}" + BOARD_STR="${FLAGS_board}" else BOARD_DIR="" # --host specified EQUERYCMD=equery EBUILDCMD=ebuild + BOARD_STR="host" fi WORKON_DIR=${CHROOT_TRUNK_DIR}/.config/cros_workon @@ -200,29 +202,37 @@ regen_manifest_and_sync() { # src_unpack step fetches the package source for local development. ebuild_to_live () { local atoms=$1 + local atoms_success="" for atom in ${atoms}; do if ! grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then - sudo bash -c "echo \"=${atom}-9999\" >> \"${WORKON_FILE}\"" + if sudo bash -c "echo \"=${atom}-9999\" >> \"${WORKON_FILE}\""; then + atoms_success="${atoms_success} ${atom}" + fi else warn "Already working on ${atom}" fi done + [ -n "${atoms_success}" ] && regen_manifest_and_sync && \ + info "Started working on '${atoms_success/ /}' for '${BOARD_STR}'" } # Move a live development ebuild back to stable. ebuild_to_stable () { local atoms=$1 + local atoms_success="" for atom in ${atoms}; do if grep -qx "[~=]${atom}-9999" "${WORKON_FILE}" ; then - sudo bash -c "grep -v '^[~=]${atom}-9999\$' \"${WORKON_FILE}\" > \ - \"${WORKON_FILE}+\"" - sudo mv "${WORKON_FILE}+" "${WORKON_FILE}" + if sudo sed -e "/^[~=]${atom/\//\\/}-9999\$/d" -i "${WORKON_FILE}"; then + atoms_success="${atoms_success} ${atom}" + fi else warn "Not working on ${atom}" fi done + [ -n "${atoms_success}" ] && \ + info "Stopped working on '${atoms_success/ /}' for '${BOARD_STR}'" } # Run a command on all or a set of repos. @@ -258,7 +268,7 @@ else # not selected --all fi case ${WORKON_CMD} in - start) ebuild_to_live "${ATOM_LIST}"; regen_manifest_and_sync ;; + start) ebuild_to_live "${ATOM_LIST}" ;; stop) ebuild_to_stable "${ATOM_LIST}" ;; list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_workon_ebuilds ;; iterate)ebuild_iterate "${ATOM_LIST}" ;;