OLD | NEW |
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 # Move a stable ebuild to the live development catgeory. The ebuild | 95 # Move a stable ebuild to the live development catgeory. The ebuild |
96 # src_unpack step fetches the package source for local development. | 96 # src_unpack step fetches the package source for local development. |
97 ebuild_to_live () { | 97 ebuild_to_live () { |
98 local atoms=$1 | 98 local atoms=$1 |
99 | 99 |
100 for atom in ${atoms}; do | 100 for atom in ${atoms}; do |
101 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then | 101 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then |
102 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" | 102 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" |
103 sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\"" | 103 sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\"" |
| 104 else |
| 105 warn "Already working on ${atom}" |
104 fi | 106 fi |
105 done | 107 done |
106 } | 108 } |
107 | 109 |
108 # Move a live development ebuild back to stable. | 110 # Move a live development ebuild back to stable. |
109 ebuild_to_stable () { | 111 ebuild_to_stable () { |
110 local atoms=$1 | 112 local atoms=$1 |
111 | 113 |
112 for atom in ${atoms}; do | 114 for atom in ${atoms}; do |
113 # remove the keyword | 115 if grep -qx "${atom}" "${KEYWORDS_FILE}" ; then |
114 sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \ | 116 # remove the keyword |
115 \"${KEYWORDS_FILE}+\"" | 117 sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \ |
116 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}" | 118 \"${KEYWORDS_FILE}+\"" |
117 # remove the unmask | 119 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}" |
118 sudo bash -c "grep -v '^~${atom}-9999\$' \"${UNMASK_FILE}\" > \ | 120 # remove the unmask |
119 \"${UNMASK_FILE}+\"" | 121 sudo bash -c "grep -v '^~${atom}-9999\$' \"${UNMASK_FILE}\" > \ |
120 sudo mv "${UNMASK_FILE}+" "${UNMASK_FILE}" | 122 \"${UNMASK_FILE}+\"" |
121 | 123 sudo mv "${UNMASK_FILE}+" "${UNMASK_FILE}" |
| 124 else |
| 125 warn "Not working on ${atom}" |
| 126 fi |
122 done | 127 done |
123 } | 128 } |
124 | 129 |
125 # Run a command on all or a set of repos. | 130 # Run a command on all or a set of repos. |
126 ebuild_forall() { | 131 ebuild_forall() { |
127 local atoms=$1 | 132 local atoms=$1 |
128 | 133 |
129 for atom in ${atoms}; do | 134 for atom in ${atoms}; do |
130 info "Running \"${FLAGS_command}\" on ${atom}" | 135 info "Running \"${FLAGS_command}\" on ${atom}" |
131 eval $(ebuild-${FLAGS_board} $(${EQUERY} which ${atom}) info) | 136 eval $(ebuild-${FLAGS_board} $(${EQUERY} which ${atom}) info) |
132 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") | 137 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") |
133 done | 138 done |
134 } | 139 } |
135 | 140 |
136 case ${WORKON_CMD} in | 141 case ${WORKON_CMD} in |
137 start) ebuild_to_live "${ATOM_LIST}" ;; | 142 start) ebuild_to_live "${ATOM_LIST}" ;; |
138 stop) ebuild_to_stable "${ATOM_LIST}" ;; | 143 stop) ebuild_to_stable "${ATOM_LIST}" ;; |
139 list) show_live_ebuilds ;; | 144 list) show_live_ebuilds ;; |
140 forall) ebuild_forall "${ATOM_LIST}" ;; | 145 forall) ebuild_forall "${ATOM_LIST}" ;; |
141 *) die "invalid cros_workon command" ;; | 146 *) die "invalid cros_workon command" ;; |
142 esac | 147 esac |
OLD | NEW |