From 76cd98fb50d9f679700ee70b1fc424f36d7c4891 Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Wed, 23 Jun 2021 08:06:59 -0400 Subject: [PATCH] simplify pinning scripts --- tools/pinning/normal/repin.sh | 9 ++------- tools/pinning/oldest/repin.sh | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/tools/pinning/normal/repin.sh b/tools/pinning/normal/repin.sh index 3984c5a3c..91a000b0f 100755 --- a/tools/pinning/normal/repin.sh +++ b/tools/pinning/normal/repin.sh @@ -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}" diff --git a/tools/pinning/oldest/repin.sh b/tools/pinning/oldest/repin.sh index 08ebd6e15..8969e962a 100755 --- a/tools/pinning/oldest/repin.sh +++ b/tools/pinning/oldest/repin.sh @@ -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}"