From c2e8607b9915db88ab3cf5c0c9109cd9127d8889 Mon Sep 17 00:00:00 2001 From: Zdenek Behan Date: Mon, 9 Aug 2010 18:03:01 -0700 Subject: [PATCH] cros_workon: misc fixes to manifest re-generation * Only run the regenerate once, after start * Make regenerate preserve old projects from local manifest * Make pkgname not found a non-fatal error * Delete misc debug messages modified: cros_workon Review URL: http://codereview.chromium.org/3115001 --- cros_workon | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/cros_workon b/cros_workon index e2c04bc45b..9fb7c37bee 100755 --- a/cros_workon +++ b/cros_workon @@ -129,32 +129,33 @@ find_repo_dir () { # This is called only for "cros-workon start". We dont handle the "stop" case since the local changes are ignored anyway since the 9999.ebuild is masked and we dont want to deal with what to do with the user's local changes. regen_manifest_and_sync() { find_repo_dir - echo Using $REPODIR - echo "Trying to generate local manifests for.." - rm -f $REPODIR/local_manifest.xml + local_manifest="${REPODIR}/local_manifest.xml" + # preserve old manifest entries + MANIFEST_ENTRIES_OLD=$(cat "${local_manifest}" | grep "^&2 eval $(${EBUILDCMD} $(${EQUERYCMD} which ${pkgname}) info) - echo "Looking for ${CROS_WORKON_PROJECT}.git" 1>&2 REPO_ELEMENT=$(sed -n '/START_MINILAYOUT/,/STOP_MINILAYOUT/p' $REPODIR/manifest.xml | grep "name=\"${CROS_WORKON_PROJECT}\"" | sed -e 's/^[ \t]*//') echo "$REPO_ELEMENT" - if [ -z "${REPO_ELEMENT}" ] ; then - echo "Unable to find ${pkgname} in manifest. Aborting." 1>&2 - exit 1 - fi done }) - if [ -n "${MANIFEST_ENTRIES}" ]; then - echo "" >> $REPODIR/local_manifest.xml - echo "" >> $REPODIR/local_manifest.xml - echo "${MANIFEST_ENTRIES}"|sort|uniq >> ${REPODIR}/local_manifest.xml - echo "" >> $REPODIR/local_manifest.xml + if [ -n "${MANIFEST_ENTRIES}" ] || [ -n "${MANIFEST_ENTRIES_OLD}" ]; then + info "Creating local manifest for workon packages.." + echo "" >> "${local_manifest}" + echo "" >> "${local_manifest}" + echo -e "${MANIFEST_ENTRIES}\n${MANIFEST_ENTRIES_OLD}" \ + | sort | uniq >> "${local_manifest}" + echo "" >> "${local_manifest}" + echo "Please run \"repo sync\" now." fi } @@ -167,7 +168,6 @@ ebuild_to_live () { if ! grep -qx "${atom}" "${KEYWORDS_FILE}" ; then sudo bash -c "echo \"${atom}\" >> \"${KEYWORDS_FILE}\"" sudo bash -c "echo \"~${atom}-9999\" >> \"${UNMASK_FILE}\"" - regen_manifest_and_sync else warn "Already working on ${atom}" fi @@ -227,7 +227,7 @@ else # not selected --all fi case ${WORKON_CMD} in - start) ebuild_to_live "${ATOM_LIST}" ;; + start) ebuild_to_live "${ATOM_LIST}"; regen_manifest_and_sync ;; stop) ebuild_to_stable "${ATOM_LIST}" ;; list) [ ${FLAGS_all} = "${FLAGS_FALSE}" ] && show_live_ebuilds || show_workon_ebuilds ;; iterate)ebuild_iterate "${ATOM_LIST}" ;;