diff options
author | Chris Meyers <chris.meyers.fsu@gmail.com> | 2024-07-12 19:34:34 +0200 |
---|---|---|
committer | Chris Meyers <chrismeyersfsu@users.noreply.github.com> | 2024-07-17 21:10:25 +0200 |
commit | acd834df8b9b9cf262461ce8a99a01f2b6c67952 (patch) | |
tree | c83a67528e98c938dd28f4e0cd48e4946db37909 /requirements | |
parent | Updated the api file to reflect 2024 date (#15369) (diff) | |
download | awx-acd834df8b9b9cf262461ce8a99a01f2b6c67952.tar.xz awx-acd834df8b9b9cf262461ce8a99a01f2b6c67952.zip |
Check and update django-ansible-base
* Check upstream django-ansible-base releases. If the version upstream
does not match the version we are pinned to then submit a PR with the
upstream version.
Diffstat (limited to 'requirements')
-rwxr-xr-x | requirements/django-ansible-base-pinned-version.sh | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/requirements/django-ansible-base-pinned-version.sh b/requirements/django-ansible-base-pinned-version.sh new file mode 100755 index 0000000000..84905fff4e --- /dev/null +++ b/requirements/django-ansible-base-pinned-version.sh @@ -0,0 +1,77 @@ +#!/bin/bash +set +x + +# CONSTANTS +export REGEX_LEFT='https://github.com/ansible/django-ansible-base@' +export REGEX_RIGHT='#egg=django-ansible-base' + +# GLOBALS +SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +REQ_FILE=$SCRIPT_DIR/requirements_git.txt + +# Pin Function +DESIRED_VERSION='' +Pin() +{ + export DESIRED_VERSION + perl -p -i -e 's/\Q$ENV{REGEX_LEFT}\E(.*?)\Q$ENV{REGEX_RIGHT}\E/$ENV{REGEX_LEFT}$ENV{DESIRED_VERSION}$ENV{REGEX_RIGHT}/g' $REQ_FILE +} + +# Current Function +Current() +{ + REQUIREMENTS_LINE=$(grep django-ansible-base $REQ_FILE) + + echo "$REQUIREMENTS_LINE" | perl -nE 'say $1 if /\Q$ENV{REGEX_LEFT}\E(.*?)\Q$ENV{REGEX_RIGHT}\E/' +} + + +Help() +{ + # Display Help + echo "" + echo "Help:" + echo "" + echo "Interact with django-ansible-base in $REQ_FILE." + echo "By default, output the current django-ansible-base pinned version." + echo + echo "Syntax: scriptTemplate [-s|h|v]" + echo "options:" + echo "s Set django-ansible-base version to pin to." + echo "h Print this Help." + echo "v Verbose mode." + echo +} + +if [ $# -eq 0 ]; then + Current + exit +fi + + +while getopts ":hs:" option; do + case $option in + h) # display Help + Help + exit + ;; + s) + DESIRED_VERSION=$OPTARG;; + :) + echo "Option -${OPTARG} requires an argument." + Help + exit 1 + ;; + \?) # Invalid option + echo "Error: Invalid option" + echo "" + Help + exit;; + esac +done + +if [ -n "$DESIRED_VERSION" ]; then + Pin + Current +fi + |