Sort out parameter to make prep for DEBUG mode

This commit is contained in:
Brian Read 2023-07-05 12:20:56 +01:00
parent 11c8552978
commit 44432a300b

View File

@ -77,10 +77,12 @@ if [ $NOISY ] ; then echo "git-cvs2git.sh $1 $2 $3 $4 $5 $6" ; fi
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
# Make this null if you want lots of output. Still quite a bit anyway # Make this null if you want lots of output. Still quite a bit anyway
QUIET="-q" QUIET="-q"
SILENT="-s" SILENT4CURL="-s"
SILENT4MAKE="-s"
if [ $DEBUG ] ; then if [ $DEBUG ] ; then
QUIET= QUIET=
SILENT="-v" SILENT4CURL="-v"
SILENT4MAKE=
fi fi
# Make this null to get curl to check ssl cert # Make this null to get curl to check ssl cert
checkSSL="-k" checkSSL="-k"
@ -239,7 +241,7 @@ fi
REPO_NAME=$1 REPO_NAME=$1
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
READMECONTENTS= READMECONTENTS=
RESPONSE=$(curl $checkSSL $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME") RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
# If so, clone it (just want the README.md) # If so, clone it (just want the README.md)
@ -253,7 +255,7 @@ if [ "$RESPONSE" == "200" ]; then
fi fi
# Now delete the repo, re-create it and clone it in to local # Now delete the repo, re-create it and clone it in to local
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi
RESPONSE=$(curl "$checkSSL" "$SILENT" -o /dev/null -w "%{http_code}" -X 'DELETE' \ RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -o /dev/null -w "%{http_code}" -X 'DELETE' \
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \ "$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN") -H "Authorization: token $GITEAACCESSTOKEN")
@ -279,7 +281,7 @@ cd $GITFiles
# Re-create the repo # Re-create the repo
# #
if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi
RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'POST' \ RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'POST' \
"$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \ "$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" \ -H "Authorization: token $GITEAACCESSTOKEN" \
@ -310,7 +312,7 @@ if [[ -z "${HTTP_URL}" ]]; then
fi fi
# And check it now exists # And check it now exists
RESPONSE=$(curl "$SILENT" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1") RESPONSE=$(curl "$SILENT4CURL" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
if [[ "$RESPONSE" == "200" ]]; then if [[ "$RESPONSE" == "200" ]]; then
if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
else else
@ -333,7 +335,7 @@ cd $CVSFiles/$1/$BASEORCONTRIB
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree # Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
# applying the patches to the base in the tar file. # applying the patches to the base in the tar file.
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep". # Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
make prep make $SILENT4MAKE prep
#echo `pwd`; exit 0 #echo `pwd`; exit 0
# Extract the directory name for the file tree (it will include the name of the module plus some version information) # Extract the directory name for the file tree (it will include the name of the module plus some version information)
@ -660,7 +662,7 @@ if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
model="text-davinci-003" model="text-davinci-003"
temperature=0.8 temperature=0.8
# Send the request to the API # Send the request to the API
response=$(curl "$SILENT" -X POST https://api.openai.com/v1/engines/$model/completions \ response=$(curl "$SILENT4CURL" -X POST https://api.openai.com/v1/engines/$model/completions \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}') -d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
@ -684,7 +686,7 @@ else
model="text-davinci-003" model="text-davinci-003"
temperature=0.8 temperature=0.8
# Send the request to the API # Send the request to the API
response=$(curl "$SILENT" -X POST https://api.openai.com/v1/engines/$model/completions \ response=$(curl "$SILENT4CURL" -X POST https://api.openai.com/v1/engines/$model/completions \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}') -d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
@ -709,7 +711,7 @@ if [[ -z $WIKILINK ]] ; then
fi fi
# and then update the repo parameters # and then update the repo parameters
RESPONSE=$(curl "$SILENT" -X 'PATCH' "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME" \ RESPONSE=$(curl "$SILENT4CURL" -X 'PATCH' "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" \ -H "Authorization: token $GITEAACCESSTOKEN" \
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \