simplify pinning scripts

This commit is contained in:
Brad Warren 2021-06-23 08:06:59 -04:00
parent df5d832690
commit 76cd98fb50
2 changed files with 4 additions and 14 deletions

View file

@ -10,12 +10,7 @@ REPO_ROOT="$(git rev-parse --show-toplevel)"
RELATIVE_SCRIPT_PATH="$(realpath --relative-to "$REPO_ROOT" "$WORK_DIR")/$(basename "${BASH_SOURCE[0]}")"
REQUIREMENTS_FILE="$REPO_ROOT/tools/requirements.txt"
# We first write requirements to a temporary file to avoid modifying the
# requirements file if the repinning process fails.
TEMP_REQUIREMENTS=$(mktemp)
trap 'rm $TEMP_REQUIREMENTS' EXIT
"${COMMON_DIR}/export-pinned-dependencies.sh" "${WORK_DIR}" > "${TEMP_REQUIREMENTS}"
PINNINGS=$("${COMMON_DIR}/export-pinned-dependencies.sh" "${WORK_DIR}")
cat << EOF > "$REQUIREMENTS_FILE"
# This file was generated by $RELATIVE_SCRIPT_PATH and can be updated using
# that script.
@ -25,4 +20,4 @@ cat << EOF > "$REQUIREMENTS_FILE"
# https://docs.github.com/en/github/visualizing-repository-data-with-graphs/about-the-dependency-graph#supported-package-ecosystems
# for more info.
EOF
cat "${TEMP_REQUIREMENTS}" >> "${REQUIREMENTS_FILE}"
echo "${PINNINGS}" >> "${REQUIREMENTS_FILE}"

View file

@ -11,14 +11,9 @@ REPO_ROOT="$(git rev-parse --show-toplevel)"
RELATIVE_SCRIPT_PATH="$(realpath --relative-to "$REPO_ROOT" "$WORK_DIR")/$(basename "${BASH_SOURCE[0]}")"
CONSTRAINTS_FILE="$REPO_ROOT/tools/oldest_constraints.txt"
# We first write requirements to a temporary file to avoid modifying the
# requirements file if the repinning process fails.
TEMP_REQUIREMENTS=$(mktemp)
trap 'rm $TEMP_REQUIREMENTS' EXIT
"${COMMON_DIR}/export-pinned-dependencies.sh" "${WORK_DIR}" > "${TEMP_REQUIREMENTS}"
PINNINGS=$("${COMMON_DIR}/export-pinned-dependencies.sh" "${WORK_DIR}")
cat << EOF > "$CONSTRAINTS_FILE"
# This file was generated by $RELATIVE_SCRIPT_PATH and can be updated using
# that script.
EOF
cat "${TEMP_REQUIREMENTS}" >> "${CONSTRAINTS_FILE}"
echo "${PINNINGS}" >> "${CONSTRAINTS_FILE}"