From 01772ff58f371940650daf46b45b333f7e489b3c Mon Sep 17 00:00:00 2001 From: Brian Daugherty Date: Wed, 23 Jun 2010 14:43:28 -0600 Subject: [PATCH] cros_workon: initial implementation Moves ebuild(s) between stable and live states. Lists ebuilds currently under development in the testing branch. Stable ebuilds obtain and build against the last known good commit. Live ebuilds (9999) perform a 'git clone' during the src_unpack step to obtain and save the source for development and building. Example usage: Sync & build 'ibus-hangul' testing ebuild (9999) ./cros_workon start app-i18n/ibus-hangul Build 'ibus-hangul' from the last stable commit ./cros_workon stop app-i18n/ibus-hangul List of ebuilds under development ./cros_workon list Change-Id: I2ea4babd7597d5cea9ca96419a74152f9f0b23f1 Note: --board must be specified if the --default option to setup_board was not used. Review URL: http://codereview.chromium.org/2852019 --- cros_workon | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 cros_workon diff --git a/cros_workon b/cros_workon new file mode 100755 index 0000000000..5854b889ab --- /dev/null +++ b/cros_workon @@ -0,0 +1,105 @@ +#!/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 +