| OLD | NEW |
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Wrapper scripts around cros_mark_as_stable that marks all packages as stable | 7 # Wrapper scripts around cros_mark_as_stable that marks all packages as stable |
| 8 # that have CROS_WORKON_COMMIT that is different than the current HEAD commit | 8 # that have CROS_WORKON_COMMIT that is different than the current HEAD commit |
| 9 # of the corresponding git repository. | 9 # of the corresponding git repository. |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 EBUILDCMD=ebuild-"${FLAGS_board}" | 32 EBUILDCMD=ebuild-"${FLAGS_board}" |
| 33 | 33 |
| 34 PACKAGES=$( show_workon_ebuilds ) | 34 PACKAGES=$( show_workon_ebuilds ) |
| 35 | 35 |
| 36 GRAB_HEAD_COMMIT_CMD="git show HEAD | head -1 | cut -f 2 -d ' '" | 36 GRAB_HEAD_COMMIT_CMD="git show HEAD | head -1 | cut -f 2 -d ' '" |
| 37 | 37 |
| 38 # Packages to mark as stable. | 38 # Packages to mark as stable. |
| 39 PACKAGE_LIST="" | 39 PACKAGE_LIST="" |
| 40 # List of commit ids corresponding to package list. | 40 # List of commit ids corresponding to package list. |
| 41 COMMIT_ID_LIST="" | 41 COMMIT_ID_LIST="" |
| 42 # List of IFS-delimited ebuilds to ignore. |
| 43 PACKAGE_BLACKLIST="" |
| 44 # File containing the names of blacklisted packages. |
| 45 BLACKLIST_FILE=$(dirname "${0}")/cros_mark_as_stable_blacklist |
| 46 |
| 47 [ -f "${BLACKLIST_FILE}" ] && \ |
| 48 PACKAGE_BLACKLIST=$(cat "${BLACKLIST_FILE}") |
| 49 |
| 50 function package_is_blacklisted() { |
| 51 # Makes a list that looks like "\|package1\|package2\|...packagen". |
| 52 local blist_regex=$(for i in ${PACKAGE_BLACKLIST}; do echo -n "\\|${i}"; done) |
| 53 expr "${1}" : "^\(${blist_regex/\\|/}\)$" &> /dev/null && return 0 || return 1 |
| 54 } |
| 42 | 55 |
| 43 # For each package, compares the head commit id to the commit id in the ebuild. | 56 # For each package, compares the head commit id to the commit id in the ebuild. |
| 44 # If they do not match, add the package and its commit id into ${PACKAGE_LIST} | 57 # If they do not match, add the package and its commit id into ${PACKAGE_LIST} |
| 45 # and ${COMMIT_ID_LIST} | 58 # and ${COMMIT_ID_LIST} |
| 46 for package in ${PACKAGES}; do | 59 for package in ${PACKAGES}; do |
| 60 if package_is_blacklisted ${package}; then |
| 61 info "${package} blacklisted, skipping" |
| 62 continue |
| 63 fi |
| 47 ebuild_path=$(${EQUERYCMD} which ${package}) || continue | 64 ebuild_path=$(${EQUERYCMD} which ${package}) || continue |
| 48 # Sets ${CROS_WORKON_SRCDIR} from the ebuild. | 65 # Sets ${CROS_WORKON_SRCDIR} from the ebuild. |
| 49 eval $(${EBUILDCMD} ${ebuild_path} info) &> /dev/null || continue | 66 eval $(${EBUILDCMD} ${ebuild_path} info) &> /dev/null || continue |
| 50 head_commit=$( cd "${CROS_WORKON_SRCDIR}" &&\ | 67 head_commit=$( cd "${CROS_WORKON_SRCDIR}" &&\ |
| 51 bash -c "${GRAB_HEAD_COMMIT_CMD}" ) || continue | 68 bash -c "${GRAB_HEAD_COMMIT_CMD}" ) || continue |
| 52 egit_commit=$(\ | 69 egit_commit=$(\ |
| 53 eval echo $(grep CROS_WORKON_COMMIT ${ebuild_path} | cut -f 2 -d '=')) ||\ | 70 eval echo $(grep CROS_WORKON_COMMIT ${ebuild_path} | cut -f 2 -d '=')) ||\ |
| 54 echo "No CROS_WORKON_COMMIT found in ${ebuild_path}" | 71 echo "No CROS_WORKON_COMMIT found in ${ebuild_path}" |
| 55 if [[ ${head_commit} != ${egit_commit} ]] && \ | 72 if [[ ${head_commit} != ${egit_commit} ]] && \ |
| 56 [ -n "${head_commit}" ]; then | 73 [ -n "${head_commit}" ]; then |
| 57 info\ | 74 info\ |
| 58 "HEAD ${head_commit} != CROS_WORKON_COMMIT ${egit_commit} for ${package}" | 75 "HEAD ${head_commit} != CROS_WORKON_COMMIT ${egit_commit} for ${package}" |
| 59 PACKAGE_LIST="${PACKAGE_LIST} ${package}" | 76 PACKAGE_LIST="${PACKAGE_LIST} ${package}" |
| 60 COMMIT_ID_LIST="${COMMIT_ID_LIST} ${head_commit}" | 77 COMMIT_ID_LIST="${COMMIT_ID_LIST} ${head_commit}" |
| 61 elif [[ ${head_commit} = ${egit_commit} ]]; then | 78 elif [[ ${head_commit} = ${egit_commit} ]]; then |
| 62 info "Commit id's match for ${package}" | 79 info "Commit id's match for ${package}" |
| 63 fi | 80 fi |
| 64 done | 81 done |
| 65 | 82 |
| 66 info "Candidate package list ${PACKAGE_LIST}" | 83 info "Candidate package list ${PACKAGE_LIST}" |
| 67 info "With commit id list ${COMMIT_ID_LIST}" | 84 info "With commit id list ${COMMIT_ID_LIST}" |
| 68 | 85 |
| 69 ./cros_mark_as_stable --board ${FLAGS_board} -p "${PACKAGE_LIST}" \ | 86 ./cros_mark_as_stable --board ${FLAGS_board} -p "${PACKAGE_LIST}" \ |
| 70 -i "${COMMIT_ID_LIST}" -t ${FLAGS_tracking_branch} commit || \ | 87 -i "${COMMIT_ID_LIST}" -t ${FLAGS_tracking_branch} commit || \ |
| 71 die "Could not mark all packages as stable" | 88 die "Could not mark all packages as stable" |
| OLD | NEW |