#!/bin/bash # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # This script moves ebuilds between 'stable' and 'live' states. # By default 'stable' ebuilds point at and build from source at the # last known good commit. Moving an ebuild to 'live' (via cros_workon start) # is intended to support development. The current source tip is fetched, # source modified and built using the unstable 'live' (9999) ebuild. # # Usage: # cros_workon [ ...] [--board=> \"${KEYWORDS_FILE}\"" fi done } # Move a live development ebuild back to stable. ebuild_to_stable () { local atoms=$1 echo echo "Moving live development ebuild to stable:" for atom in ${atoms}; do if [[ -f "${KEYWORDS_FILE}" ]] && $(grep -qx "${atom}" "${KEYWORDS_FILE}") ; then echo " '${atom}'" sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \ \"${KEYWORDS_FILE}+\"" sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}" fi done } # Display ebuilds currently part of the live branch and open for development. show_live_ebuilds () { echo echo "Live development ebuilds:" cat "${KEYWORDS_FILE}" } case ${WORKON_CMD} in start) ebuild_to_live "${ATOM_LIST}" ;; stop) ebuild_to_stable "${ATOM_LIST}" ;; list) show_live_ebuilds ;; *) die "valid cros_workon commands: start|stop|list" ;; esac