OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 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 |
| 5 # found in the LICENSE file. |
| 6 |
| 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 |
| 9 # of the corresponding git repository. |
| 10 |
| 11 # Load common constants. This should be the first executable line. |
| 12 # The path to common.sh should be relative to your script's location. |
| 13 . "$(dirname "$0")/common.sh" |
| 14 |
| 15 # Load common functions for workon scripts. |
| 16 . "$(dirname "$0")/lib/cros_workon_common.sh" |
| 17 |
| 18 get_default_board |
| 19 |
| 20 DEFINE_string board "${DEFAULT_BOARD}" \ |
| 21 "The board to set package keywords for." |
| 22 |
| 23 FLAGS "$@" || exit 1 |
| 24 eval set -- "${FLAGS_ARGV}" |
| 25 |
| 26 set -e |
| 27 |
| 28 BOARD_DIR=/build/"${FLAGS_board}" |
| 29 EQUERYCMD=equery-"${FLAGS_board}" |
| 30 EBUILDCMD=ebuild-"${FLAGS_board}" |
| 31 |
| 32 PACKAGES=$( show_workon_ebuilds ) |
| 33 |
| 34 GRAB_HEAD_COMMIT_CMD="git show HEAD | head -1 | cut -f 2 -d ' '" |
| 35 |
| 36 # Packages to mark as stable. |
| 37 PACKAGE_LIST="" |
| 38 # List of commit ids corresponding to package list. |
| 39 COMMIT_ID_LIST="" |
| 40 |
| 41 # For each package, compares the head commit id to the commit id in the ebuild. |
| 42 # If they do not match, add the package and its commit id into ${PACKAGE_LIST} |
| 43 # and ${COMMIT_ID_LIST} |
| 44 for package in ${PACKAGES}; do |
| 45 ebuild_path=$(${EQUERYCMD} which ${package}) || continue |
| 46 # Sets ${CROS_WORKON_SRCDIR} from the ebuild. |
| 47 eval $(${EBUILDCMD} ${ebuild_path} info) &> /dev/null || continue |
| 48 head_commit=$( cd "${CROS_WORKON_SRCDIR}" &&\ |
| 49 bash -c "${GRAB_HEAD_COMMIT_CMD}" ) || continue |
| 50 egit_commit=\ |
| 51 $(eval echo $(grep CROS_WORKON_COMMIT ${ebuild_path} | cut -f 2 -d '=')) ||\ |
| 52 echo "No CROS_WORKON_COMMIT found in ${ebuild_path}" |
| 53 if [[ ${head_commit} != ${egit_commit} ]] && \ |
| 54 [ -n "${head_commit}" ]; then |
| 55 info\ |
| 56 "HEAD ${head_commit} != CROS_WORKON_COMMIT ${egit_commit} for ${package}" |
| 57 PACKAGE_LIST="${PACKAGE_LIST} ${package}" |
| 58 COMMIT_ID_LIST="${COMMIT_ID_LIST} ${head_commit}" |
| 59 fi |
| 60 done |
| 61 |
| 62 info "Candidate package list ${PACKAGE_LIST}" |
| 63 info "With commit id list ${COMMIT_ID_LIST}" |
| 64 |
| 65 ./cros_mark_as_stable --board ${FLAGS_board} -p "${PACKAGE_LIST}" \ |
| 66 -i "${COMMIT_ID_LIST}" commit || \ |
| 67 die "Could not mark all packages as stable" |
OLD | NEW |