mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 14:06:58 +02:00
Add wrapper script to get list of updates to pass to stablizing script without other changes
TEST=Ran script Review URL: http://codereview.chromium.org/3034011
This commit is contained in:
parent
a5e394704d
commit
db51f31139
67
cros_mark_all_as_stable
Executable file
67
cros_mark_all_as_stable
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
|
||||||
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
|
# found in the LICENSE file.
|
||||||
|
|
||||||
|
# Wrapper scripts around cros_mark_as_stable that marks all packages as stable
|
||||||
|
# that have CROS_WORKON_COMMIT that is different than the current HEAD commit
|
||||||
|
# of the corresponding git repository.
|
||||||
|
|
||||||
|
# Load common constants. This should be the first executable line.
|
||||||
|
# The path to common.sh should be relative to your script's location.
|
||||||
|
. "$(dirname "$0")/common.sh"
|
||||||
|
|
||||||
|
# Load common functions for workon scripts.
|
||||||
|
. "$(dirname "$0")/lib/cros_workon_common.sh"
|
||||||
|
|
||||||
|
get_default_board
|
||||||
|
|
||||||
|
DEFINE_string board "${DEFAULT_BOARD}" \
|
||||||
|
"The board to set package keywords for."
|
||||||
|
|
||||||
|
FLAGS "$@" || exit 1
|
||||||
|
eval set -- "${FLAGS_ARGV}"
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
BOARD_DIR=/build/"${FLAGS_board}"
|
||||||
|
EQUERYCMD=equery-"${FLAGS_board}"
|
||||||
|
EBUILDCMD=ebuild-"${FLAGS_board}"
|
||||||
|
|
||||||
|
PACKAGES=$( show_workon_ebuilds )
|
||||||
|
|
||||||
|
GRAB_HEAD_COMMIT_CMD="git show HEAD | head -1 | cut -f 2 -d ' '"
|
||||||
|
|
||||||
|
# Packages to mark as stable.
|
||||||
|
PACKAGE_LIST=""
|
||||||
|
# List of commit ids corresponding to package list.
|
||||||
|
COMMIT_ID_LIST=""
|
||||||
|
|
||||||
|
# For each package, compares the head commit id to the commit id in the ebuild.
|
||||||
|
# If they do not match, add the package and its commit id into ${PACKAGE_LIST}
|
||||||
|
# and ${COMMIT_ID_LIST}
|
||||||
|
for package in ${PACKAGES}; do
|
||||||
|
ebuild_path=$(${EQUERYCMD} which ${package}) || continue
|
||||||
|
# Sets ${CROS_WORKON_SRCDIR} from the ebuild.
|
||||||
|
eval $(${EBUILDCMD} ${ebuild_path} info) &> /dev/null || continue
|
||||||
|
head_commit=$( cd "${CROS_WORKON_SRCDIR}" &&\
|
||||||
|
bash -c "${GRAB_HEAD_COMMIT_CMD}" ) || continue
|
||||||
|
egit_commit=\
|
||||||
|
$(eval echo $(grep CROS_WORKON_COMMIT ${ebuild_path} | cut -f 2 -d '=')) ||\
|
||||||
|
echo "No CROS_WORKON_COMMIT found in ${ebuild_path}"
|
||||||
|
if [[ ${head_commit} != ${egit_commit} ]] && \
|
||||||
|
[ -n "${head_commit}" ]; then
|
||||||
|
info\
|
||||||
|
"HEAD ${head_commit} != CROS_WORKON_COMMIT ${egit_commit} for ${package}"
|
||||||
|
PACKAGE_LIST="${PACKAGE_LIST} ${package}"
|
||||||
|
COMMIT_ID_LIST="${COMMIT_ID_LIST} ${head_commit}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
info "Candidate package list ${PACKAGE_LIST}"
|
||||||
|
info "With commit id list ${COMMIT_ID_LIST}"
|
||||||
|
|
||||||
|
./cros_mark_as_stable --board ${FLAGS_board} -p "${PACKAGE_LIST}" \
|
||||||
|
-i "${COMMIT_ID_LIST}" commit || \
|
||||||
|
die "Could not mark all packages as stable"
|
@ -275,9 +275,9 @@ class EBuildStableMarker(object):
|
|||||||
elif line.startswith('EAPI'):
|
elif line.startswith('EAPI'):
|
||||||
# Always add new commit_id after EAPI definition.
|
# Always add new commit_id after EAPI definition.
|
||||||
redirect_file.write(line)
|
redirect_file.write(line)
|
||||||
redirect_file.write('EGIT_COMMIT="%s"' % commit_id)
|
redirect_file.write('CROS_WORKON_COMMIT="%s"' % commit_id)
|
||||||
elif not line.startswith('EGIT_COMMIT'):
|
elif not line.startswith('CROS_WORKON_COMMIT'):
|
||||||
# Skip old EGIT_COMMIT definition.
|
# Skip old CROS_WORKON_COMMIT definition.
|
||||||
redirect_file.write(line)
|
redirect_file.write(line)
|
||||||
fileinput.close()
|
fileinput.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user