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

Unified Diff: cros_workon

Issue 2985003: cros_workon: check selected packages if they are cros-workon, related fixes (Closed) Base URL: ssh://gitrw.chromium.org/crosutils
Patch Set: Simplified CL, only handling equery errors and non-cros-workon packages 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cros_workon
diff --git a/cros_workon b/cros_workon
index fb73f09abd8d936f4ce94c3484dd57a7b8e03229..0e5534063faf9eb441af2f69a895757b6a3e1a37 100755
--- a/cros_workon
+++ b/cros_workon
@@ -66,8 +66,23 @@ sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \
# Canonicalize package name to category/package.
canonicalize_name () {
- ${EQUERY} which $1 | \
- awk -F '/' '{ print $(NF-2) "/" $(NF-1) }'
+ local pkgfile
+ local pkgname
+
+ if ! pkgfile=$(${EQUERY} which $1); then
+ warn "error looking up package $1" 1>&2
+ return 1
+ fi
+
+ pkgname=$(\
+ echo "${pkgfile}" |awk -F '/' '{ print $(NF-2) "/" $(NF-1) }')
+
+ if ! grep -q "cros-workon" ${pkgfile}; then
+ warn "${pkgname} is not a cros-workon package" 1>&2
+ return 1
+ fi
+ echo "${pkgname}"
+ return 0
}
# Canonicalize a list of names.
@@ -80,7 +95,8 @@ canonicalize_names () {
[ -n "${name}" ] || return 1
names+=" ${name}"
done
- echo ${names}
+
+ echo "${names}"
}
# Display ebuilds currently part of the live branch and open for development.
@@ -89,8 +105,13 @@ show_live_ebuilds () {
}
ATOM_LIST=$@
-ATOM_LIST=$(canonicalize_names "${ATOM_LIST}") || die "Invalid package name"
-[ -n "${ATOM_LIST}" ] || ATOM_LIST=$(show_live_ebuilds)
+if [ -z "${ATOM_LIST}" ]; then
+ ATOM_LIST=$(show_live_ebuilds)
+else
+ if ! ATOM_LIST=$(canonicalize_names "${ATOM_LIST}"); then
+ die "Error parsing package list"
+ fi
+fi
# Move a stable ebuild to the live development catgeory. The ebuild
# src_unpack step fetches the package source for local development.
« 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