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

Side by Side Diff: cros_workon

Issue 2880005: cros_workon: modify to be less verbose (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: Created 10 years, 5 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 25 matching lines...) Expand all
36 # eat the workon command keywords: start, stop or list. 36 # eat the workon command keywords: start, stop or list.
37 WORKON_CMD=$1 37 WORKON_CMD=$1
38 shift 38 shift
39 39
40 ATOM_LIST=$@ 40 ATOM_LIST=$@
41 41
42 BOARD_DIR=/build/"${FLAGS_board}" 42 BOARD_DIR=/build/"${FLAGS_board}"
43 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords 43 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords
44 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon 44 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
45 45
46 sudo mkdir -p "${KEYWORDS_DIR}" || die "mkdir -p ${KEYWORDS_DIR}"
47 sudo touch "${KEYWORDS_FILE}" || die "touch ${KEYWORDS_FILE}"
48
46 # Move a stable ebuild to the live development catgeory. The ebuild 49 # Move a stable ebuild to the live development catgeory. The ebuild
47 # src_unpack step fetches the package source for local development. 50 # src_unpack step fetches the package source for local development.
48 ebuild_to_live () { 51 ebuild_to_live () {
49
50 local atoms=$1 52 local atoms=$1
51 53
52 echo
53 echo "Moving stable ebuild to live development:"
54
55 if [[ -d "${KEYWORDS_DIR}" ]]; then
56 sudo mkdir -p "${KEYWORDS_DIR}"
57 fi
58
59 for atom in ${atoms}; do 54 for atom in ${atoms}; do
60 55 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then
61 if [[ -f "${KEYWORDS_FILE}" ]] &&
62 $(grep -qx "${atom}" "${KEYWORDS_FILE}") ; then
63 echo " '${atom}' already marked for development"
64 else
65 echo " '${atom}'"
66 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" 56 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\""
67 fi 57 fi
68 done 58 done
69 } 59 }
70 60
71 # Move a live development ebuild back to stable. 61 # Move a live development ebuild back to stable.
72 ebuild_to_stable () { 62 ebuild_to_stable () {
73
74 local atoms=$1 63 local atoms=$1
75 64
76 echo
77 echo "Moving live development ebuild to stable:"
78
79 for atom in ${atoms}; do 65 for atom in ${atoms}; do
80 66 sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \
81 if [[ -f "${KEYWORDS_FILE}" ]] && 67 \"${KEYWORDS_FILE}+\""
82 $(grep -qx "${atom}" "${KEYWORDS_FILE}") ; then 68 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}"
83 echo " '${atom}'"
84 » sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \
85 \"${KEYWORDS_FILE}+\""
86 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}"
87 fi
88 done 69 done
89 } 70 }
90 71
91 # Display ebuilds currently part of the live branch and open for development. 72 # Display ebuilds currently part of the live branch and open for development.
92 show_live_ebuilds () { 73 show_live_ebuilds () {
93 echo
94 echo "Live development ebuilds:"
95
96 cat "${KEYWORDS_FILE}" 74 cat "${KEYWORDS_FILE}"
97 } 75 }
98 76
99 case ${WORKON_CMD} in 77 case ${WORKON_CMD} in
100 start) ebuild_to_live "${ATOM_LIST}" ;; 78 start) ebuild_to_live "${ATOM_LIST}" ;;
101 stop) ebuild_to_stable "${ATOM_LIST}" ;; 79 stop) ebuild_to_stable "${ATOM_LIST}" ;;
102 list) show_live_ebuilds ;; 80 list) show_live_ebuilds ;;
103 *) die "valid cros_workon commands: start|stop|list" ;; 81 *) die "valid cros_workon commands: start|stop|list" ;;
104 esac 82 esac
105
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