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

Unified Diff: cros_workon

Issue 2883012: cros_workon: quick hack at package name checking (Closed) Base URL: ssh://git@chromiumos-git/crosutils.git
Patch Set: Send again. Created 10 years, 6 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 6f7aeaaf60bc0c2933a6b9fa15c6541a43711853..e327a0d7f8c9a5a73e5546cb399d2d9302fbcf93 100755
--- a/cros_workon
+++ b/cros_workon
@@ -45,12 +45,32 @@ KEYWORDS_FILE=${KEYWORDS_DIR}/cros-workon
sudo mkdir -p "${KEYWORDS_DIR}" || die "mkdir -p ${KEYWORDS_DIR}"
sudo touch "${KEYWORDS_FILE}" || die "touch ${KEYWORDS_FILE}"
+# Canonicalize package name to category/package.
+canonicalize_name () {
+ equery-${FLAGS_board} which $1 | \
sosa 2010/07/01 17:44:07 If only equery list could do this with an option i
+ awk -F '/' '{ print $(NF-2) "/" $(NF-1) }'
+}
+
+# Canonicalize a list of names
sosa 2010/07/01 17:44:07 Period at end.
+canonicalize_names () {
+ local atoms=$1
+ local names
sosa 2010/07/01 17:44:07 Prefer if you explicitly set names to ""
+
+ for atom in ${atoms}; do
+ local name=$(canonicalize_name "${atom}")
+ [ -n "${name}" ] || return 1
+ names+=" ${name}"
+ done
+ echo ${names}
+}
+
# Display ebuilds currently part of the live branch and open for development.
show_live_ebuilds () {
cat "${KEYWORDS_FILE}"
}
ATOM_LIST=$@
+ATOM_LIST=$(canonicalize_names "${ATOM_LIST}") || die "Invalid package name"
[ -n "${ATOM_LIST}" ] || ATOM_LIST=$(show_live_ebuilds)
# Move a stable ebuild to the live development catgeory. The ebuild
« 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