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

Unified Diff: cros_workon

Issue 3143035: cros_workon: simplify by symlinking the keywords file to the unmask file (Closed) Base URL: http://src.chromium.org/git/crosutils.git
Patch Set: Fixed Created 10 years, 4 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 d7ecc65d5d60410cdf78833f0a1e4168da7fb290..ca2dab6072d0343fb9924dfd8ca6a5f25104f458 100755
--- a/cros_workon
+++ b/cros_workon
@@ -68,8 +68,13 @@ UNMASK_FILE=${UNMASK_DIR}/cros-workon
sudo mkdir -p "${KEYWORDS_DIR}" "${UNMASK_DIR}" || \
die "mkdir -p ${KEYWORDS_DIR} ${UNMASK_DIR}"
-sudo touch "${KEYWORDS_FILE}" "${UNMASK_FILE}" || \
- die "touch ${KEYWORDS_FILE} ${UNMASK_FILE}"
+if [ ! -L "${KEYWORDS_FILE}" ]; then
+ sudo rm -f "${KEYWORDS_FILE}"
+ sudo ln -s "${UNMASK_FILE}" "${KEYWORDS_FILE}" || \
+ die "ln -s ${UNMASK_FILE} ${KEYWORDS_FILE}"
+fi
+sudo touch "${UNMASK_FILE}" || \
+ die "touch ${UNMASK_FILE}"
# Canonicalize package name to category/package.
canonicalize_name () {
@@ -108,7 +113,7 @@ canonicalize_names () {
# Display ebuilds currently part of the live branch and open for development.
show_live_ebuilds () {
- cat "${KEYWORDS_FILE}"
+ sed -n 's/^[~=]\(.*\)-9999$/\1/p' "${UNMASK_FILE}"
}
find_repo_dir () {
@@ -138,7 +143,7 @@ regen_manifest_and_sync() {
rm -f "${local_manifest}"
# get new manifest entries
- MANIFEST_ENTRIES=$(cat ${KEYWORDS_FILE} |
+ MANIFEST_ENTRIES=$(show_live_ebuilds |
{
while read line
do
@@ -166,9 +171,8 @@ ebuild_to_live () {
local atoms=$1
for atom in ${atoms}; do
- if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then
- sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\""
- sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\""
+ if ! grep -qx "[~=]${atom}-9999" "${UNMASK_FILE}" ; then
+ sudo bash -c "echo \"=${atom}-9999\" >> \"${UNMASK_FILE}\""
else
warn "Already working on ${atom}"
fi
@@ -180,13 +184,8 @@ ebuild_to_stable () {
local atoms=$1
for atom in ${atoms}; do
- if grep -qx "${atom}" "${KEYWORDS_FILE}" ; then
- # remove the keyword
- sudo bash -c "grep -v '^${atom}\$' \"${KEYWORDS_FILE}\" > \
- \"${KEYWORDS_FILE}+\""
- sudo mv "${KEYWORDS_FILE}+" "${KEYWORDS_FILE}"
- # remove the unmask
- sudo bash -c "grep -v '^~${atom}-9999\$' \"${UNMASK_FILE}\" > \
+ if grep -qx "[~=]${atom}-9999" "${UNMASK_FILE}" ; then
+ sudo bash -c "grep -v '^[~=]${atom}-9999\$' \"${UNMASK_FILE}\" > \
\"${UNMASK_FILE}+\""
sudo mv "${UNMASK_FILE}+" "${UNMASK_FILE}"
else
« 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