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

Unified Diff: cros_mark_branch_as_stable

Issue 6240018: This starts to fix the scripts so that they load from /usr/lib/crosutils (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: fixing bad merge Created 9 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cros_generate_update_payload ('k') | cros_run_unit_tests » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cros_mark_branch_as_stable
diff --git a/cros_mark_branch_as_stable b/cros_mark_branch_as_stable
index a2dfd7a6932d49d66a06235a55f480e0cce00258..e5382354194efb7ba3a3756976107874cab5ffd7 100755
--- a/cros_mark_branch_as_stable
+++ b/cros_mark_branch_as_stable
@@ -27,9 +27,26 @@
#
# Example usage: ./cros_mark_branch_as_stable
-# Load common constants. This should be the first executable line.
-# The path to common.sh should be relative to your script's location.
-. "$(dirname "$0")/common.sh"
+# --- BEGIN COMMON.SH BOILERPLATE ---
+# Load common CrOS utilities. Inside the chroot this file is installed in
+# /usr/lib/crosutils. Outside the chroot we find it relative to the script's
+# location.
+find_common_sh() {
+ local common_paths=(/usr/lib/crosutils $(dirname "$(readlink -f "$0")"))
+ local path
+
+ SCRIPT_ROOT=
+ for path in "${common_paths[@]}"; do
+ if [ -r "${path}/common.sh" ]; then
+ SCRIPT_ROOT=${path}
+ break
+ fi
+ done
+}
+
+find_common_sh
+. "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1)
+# --- END COMMON.SH BOILERPLATE ---
function is_workon() { xargs grep -lE '^inherit.*cros-workon'; }
function is_stable() { xargs grep -lE '^KEYWORDS=[^~]*$'; }
@@ -38,8 +55,8 @@ function is_unstable() { xargs grep -lE '^KEYWORDS=.*~'; }
function get_workon_commit() {
# Get the latest workon commit associated with an ebuild.
ebuild="$1"
- dir=$(dirname $ebuild)
- CATEGORY=$(basename $(dirname "$dir"))
+ dir=$(dirname "$ebuild")
+ CATEGORY=$(basename "$(dirname "$dir")")
CROS_WORKON_LOCALNAME=$(basename "$dir")
CROS_WORKON_SUBDIR=
@@ -65,7 +82,7 @@ function get_workon_commit() {
cd $SRCDIR && git rev-parse HEAD
}
-BLACKLIST_FILE=$(dirname "$0")/cros_mark_as_stable_blacklist
+BLACKLIST_FILE="${SCRIPTS_DIR}/cros_mark_as_stable_blacklist"
BLACKLIST=$(cat "$BLACKLIST_FILE")
if [[ -n "$BLACKLIST" ]]; then
die "$0 does not support cros_mark_as_stable_blacklist"
« no previous file with comments | « cros_generate_update_payload ('k') | cros_run_unit_tests » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698