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

Side by Side Diff: cros_workon

Issue 2934007: cros_workon: also create unmask (Closed) Base URL: ssh://gitrw.chromium.org/crosutils
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 21 matching lines...) Expand all
32 FLAGS "$@" || exit 1 32 FLAGS "$@" || exit 1
33 eval set -- "${FLAGS_ARGV}" 33 eval set -- "${FLAGS_ARGV}"
34 34
35 [ -n "${FLAGS_board}" ] || die "--board is required." 35 [ -n "${FLAGS_board}" ] || die "--board is required."
36 36
37 # eat the workon command keywords: start, stop or list. 37 # eat the workon command keywords: start, stop or list.
38 WORKON_CMD=$1 38 WORKON_CMD=$1
39 shift 39 shift
40 40
41 BOARD_DIR=/build/"${FLAGS_board}" 41 BOARD_DIR=/build/"${FLAGS_board}"
42
42 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords 43 KEYWORDS_DIR=${BOARD_DIR}/etc/portage/package.keywords
44 UNMASK_DIR=${BOARD_DIR}/etc/portage/package.unmask
43 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon 45 KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
46 UNMASK_FILE=${UNMASK_DIR}/cros-workon
44 47
45 sudo mkdir -p "${KEYWORDS_DIR}" || die "mkdir -p ${KEYWORDS_DIR}" 48 sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}"
46 sudo touch "${KEYWORDS_FILE}" || die "touch ${KEYWORDS_FILE}" 49 sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || die "touch ${KEYWORDS_FILE} ${ UNMASK_FILE}"
47 50
48 # Canonicalize package name to category/package. 51 # Canonicalize package name to category/package.
49 canonicalize_name () { 52 canonicalize_name () {
50 equery-${FLAGS_board} which $1 | \ 53 equery-${FLAGS_board} which $1 | \
51 awk -F '/' '{ print $(NF-2) "/" $(NF-1) }' 54 awk -F '/' '{ print $(NF-2) "/" $(NF-1) }'
52 } 55 }
53 56
54 # Canonicalize a list of names. 57 # Canonicalize a list of names.
55 canonicalize_names () { 58 canonicalize_names () {
56 local atoms=$1 59 local atoms=$1
(...skipping 17 matching lines...) Expand all
74 [ -n "${ATOM_LIST}" ] || ATOM_LIST=$(show_live_ebuilds) 77 [ -n "${ATOM_LIST}" ] || ATOM_LIST=$(show_live_ebuilds)
75 78
76 # Move a stable ebuild to the live development catgeory. The ebuild 79 # Move a stable ebuild to the live development catgeory. The ebuild
77 # src_unpack step fetches the package source for local development. 80 # src_unpack step fetches the package source for local development.
78 ebuild_to_live () { 81 ebuild_to_live () {
79 local atoms=$1 82 local atoms=$1
80 83
81 for atom in ${atoms}; do 84 for atom in ${atoms}; do
82 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then 85 if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then
83 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" 86 sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\""
87 sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\""
84 fi 88 fi
85 done 89 done
86 } 90 }
87 91
88 # Move a live development ebuild back to stable. 92 # Move a live development ebuild back to stable.
89 ebuild_to_stable () { 93 ebuild_to_stable () {
90 local atoms=$1 94 local atoms=$1
91 95
92 for atom in ${atoms}; do 96 for atom in ${atoms}; do
97 # remove the keyword
93 sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \ 98 sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \
94 \"${KEYWORDS_FILE}+\"" 99 \"${KEYWORDS_FILE}+\""
95 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}" 100 sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}"
101 # remove the unmask
102 sudo bash -c "grep -v '^~${atom}-9999\$' \"${UNMASK_FILE}\" > \
103 \"${UNMASK_FILE}+\""
104 sudo mv "${UNMASK_FILE}+" "${UNMASK_FILE}"
105
96 done 106 done
97 } 107 }
98 108
99 # Run a command on all or a set of repos. 109 # Run a command on all or a set of repos.
100 ebuild_forall() { 110 ebuild_forall() {
101 local atoms=$1 111 local atoms=$1
102 112
103 for atom in ${atoms}; do 113 for atom in ${atoms}; do
104 info "Running \"${FLAGS_command}\" on ${atom}" 114 info "Running \"${FLAGS_command}\" on ${atom}"
105 eval $(ebuild-${FLAGS_board} $(equery-${FLAGS_board} which ${atom}) info) 115 eval $(ebuild-${FLAGS_board} $(equery-${FLAGS_board} which ${atom}) info)
106 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}") 116 (cd "${CROS_WORKON_SRCDIR}" && bash -c "${FLAGS_command}")
107 done 117 done
108 } 118 }
109 119
110 case ${WORKON_CMD} in 120 case ${WORKON_CMD} in
111 start) ebuild_to_live "${ATOM_LIST}" ;; 121 start) ebuild_to_live "${ATOM_LIST}" ;;
112 stop) ebuild_to_stable "${ATOM_LIST}" ;; 122 stop) ebuild_to_stable "${ATOM_LIST}" ;;
113 list) show_live_ebuilds ;; 123 list) show_live_ebuilds ;;
114 forall) ebuild_forall "${ATOM_LIST}" ;; 124 forall) ebuild_forall "${ATOM_LIST}" ;;
115 *) die "invalid cros_workon command" ;; 125 *) die "invalid cros_workon command" ;;
116 esac 126 esac
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