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

Side by Side Diff: bin/cros_workon_make

Issue 5265009: [crosutils] Add confirmation warning to cros_workon_make --scrub (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: quiet grep instead of redirecting Created 10 years 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 | Annotate | Revision Log
« 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 # Simple wrapper script to build a cros_workon package incrementally. 7 # Simple wrapper script to build a cros_workon package incrementally.
8 # You must already be cros_workon'ing the package in question. 8 # You must already be cros_workon'ing the package in question.
9 9
10 . "$(dirname $0)/../common.sh" 10 . "$(dirname $0)/../common.sh"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 if ! pkgfile=$("${EQUERYCMD}" which "${workon_name}" 2> /dev/null); then 52 if ! pkgfile=$("${EQUERYCMD}" which "${workon_name}" 2> /dev/null); then
53 if ACCEPT_KEYWORDS="~${BOARD_KEYWORD}" "${EQUERYCMD}" which "${workon_name}" \ 53 if ACCEPT_KEYWORDS="~${BOARD_KEYWORD}" "${EQUERYCMD}" which "${workon_name}" \
54 > /dev/null 2>&1; then 54 > /dev/null 2>&1; then
55 die "run './cros_workon --board ${BOARD_STR} start ${1}' first!" 1>&2 55 die "run './cros_workon --board ${BOARD_STR} start ${1}' first!" 1>&2
56 fi 56 fi
57 die "error looking up package $1" 57 die "error looking up package $1"
58 fi 58 fi
59 59
60 if [ "${FLAGS_scrub}" = "${FLAGS_TRUE}" ]; then 60 if [ "${FLAGS_scrub}" = "${FLAGS_TRUE}" ]; then
61 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info) 61 warn "--scrub will destroy ALL FILES unknown to git!"
62 srcdir=$(readlink -m ${CROS_WORKON_SRCDIR}) 62 read -p "Are you sure you want to do this? [y|N]" resp
63 trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR}) 63 if egrep -qi "^y(es)?$" <(echo -n "${resp}"); then
64 project_path=${srcdir#${trunkdir}/} 64 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${workon_name}) info)
65 if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then 65 srcdir=$(readlink -m ${CROS_WORKON_SRCDIR})
66 die "Could not scrub source directory" 66 trunkdir=$(readlink -m ${CHROOT_TRUNK_DIR})
67 project_path=${srcdir#${trunkdir}/}
68 if ! (cd "${GCLIENT_ROOT}/${project_path}" && git clean -xf); then
69 die "Could not scrub source directory"
70 fi
71 else
72 info "Not scrubbing; exiting gracefully"
67 fi 73 fi
68 exit 0 74 exit 0
69 fi 75 fi
70 76
71 workpath=$(\ 77 workpath=$(\
72 echo "${pkgfile}" | \ 78 echo "${pkgfile}" | \
73 awk -F '/' '{ print $(NF-2) "/" $(NF-1) }')-"${unstable_suffix}" 79 awk -F '/' '{ print $(NF-2) "/" $(NF-1) }')-"${unstable_suffix}"
74 80
75 emerge_features= 81 emerge_features=
76 to_do="compile" 82 to_do="compile"
77 if [ "${FLAGS_test}" = "${FLAGS_TRUE}" ]; then 83 if [ "${FLAGS_test}" = "${FLAGS_TRUE}" ]; then
78 to_do="test" 84 to_do="test"
79 emerge_features="test" 85 emerge_features="test"
80 fi 86 fi
81 if [ "${FLAGS_install}" = "${FLAGS_TRUE}" ]; then 87 if [ "${FLAGS_install}" = "${FLAGS_TRUE}" ]; then
82 FEATURES="${emerge_features}" "${EMERGECMD}" "${1}" 88 FEATURES="${emerge_features}" "${EMERGECMD}" "${1}"
83 exit $? 89 exit $?
84 fi 90 fi
85 91
86 clean= 92 clean=
87 if [ "${FLAGS_reconf}" = "${FLAGS_TRUE}" ]; then 93 if [ "${FLAGS_reconf}" = "${FLAGS_TRUE}" ]; then
88 clean="clean" 94 clean="clean"
89 else 95 else
90 rm -f "/build/${BOARD_STR}/tmp/portage/${workpath}/.compiled" 96 rm -f "/build/${BOARD_STR}/tmp/portage/${workpath}/.compiled"
91 fi 97 fi
92 SANDBOX_WRITE=~/trunk CROS_WORKON_INPLACE=1 \ 98 SANDBOX_WRITE=~/trunk CROS_WORKON_INPLACE=1 \
93 "${EBUILDCMD}" "${pkgfile}" ${clean} "${to_do}" 99 "${EBUILDCMD}" "${pkgfile}" ${clean} "${to_do}"
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