removed unnecessary comments and corrected edge cases

This commit is contained in:
Saipriya-1144 2024-08-29 22:56:16 +05:30
Родитель 9253ec2f8f
Коммит c26c95e3a1
10 изменённых файлов: 142 добавлений и 568 удалений

3
.gitignore поставляемый
Просмотреть файл

@ -269,3 +269,6 @@ src/startupscriptgenerator/src/**/__debug_bin
src/startupscriptgenerator/src/**/run.sh
!**/dynamic/Dockerfile
!**/dynamic/buster.Dockerfile
# needed just for pr description
Updated_Values.txt

Просмотреть файл

@ -1,20 +1,26 @@
# #!/bin/bash
printenv
apt-get update
apt-get install -y python3 python3-pip
pip install bs4
pip install lxml
pip install requests
mkdir generated_files
set -e
error_handler() {
echo "Error occurred in script at line: $1"
exit 1
}
trap 'error_handler $LINENO' ERR
mkdir -p generated_files
curl -o generated_files/php_version.xml "https://www.php.net/downloads.php"
curl -o generated_files/node_version.xml "https://nodejs.org/en/about/previous-releases"
curl -o generated_files/dotnet_version.xml "https://dotnet.microsoft.com/en-us/download/dotnet"
pip install bs4
pip install lxml
pip install requests
create_versionfile() {
FILE=$1
if [ ! -e "$FILE" ]; then
@ -32,7 +38,6 @@ create_versionfile generated_files/python_latest_versions.txt
create_versionfile generated_files/dotnet_latest_versions.txt
create_versionfile generated_files/dotnet_sdk_latest_versions.txt
latest_stack_versions_FILE=latest_stack_versions.yaml
cat <<EOL > $latest_stack_versions_FILE
variables:
@ -52,7 +57,6 @@ chmod +x update_constants.sh
chmod +x update_versions_to_build.sh
./update_versions_to_build.sh
# #create a monitor.yaml pipeline, create multiple jobs in the pipeline.
# # each job for different stack, in each job call the respective .py file for web scrapping, now store the new values in latest_versions file(make diff version file for diff stacks)
# # compare values latest values for each stack and then update the latest_stack_versions.yaml
# # as of now, only minor versions
rm -rf "generated_files"
rm "../images/temp_constants.yaml"
rm "Stack_Updated_values.txt"

Просмотреть файл

@ -1,41 +1,46 @@
variables:
AI_CONNECTION_STRING: "1234(RANDOMVALUE)"
DotNetCoreAgent_version: 2.8.42
GitHubActions_BaseImage_Bookworm: 'mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:ff838f535d6e3bace9ab7eefa360d648ba529f9aa57fdd709335f8ef0516cdde'
GitHubActions_BaseImage_Bullseye: 'mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:25c86292946cce832340fe808ac47e5a845b68c488f177a47ff44fd59040397d'
GitHubActions_BaseImage_Buster: 'mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:be7137ba47bdf421d3950abe1200322631e8db11b468cd6f0ebf3d687e556c90'
NODE_APP_INSIGHTS_SDK_VERSION: 1.8.7
NPM_VERSION: 10.7.0
PM2_VERSION: 5.3.1
SDK_STORAGE_BASE_URL_VALUE: 'https://oryxsdksdev.blob.core.windows.net'
USER_DOTNET_AI_VERSION: 2.8.42
YARN_MAJOR_VERSION: 1
YARN_MINOR_VERSION: 1.22
YARN_MAJOR_VERSION: "1"
YARN_MINOR_VERSION: "1.22"
YARN_VERSION: 1.22.15
USER_DOTNET_AI_VERSION: 2.8.42
AI_CONNECTION_STRING: 1234(RANDOMVALUE)
SDK_STORAGE_BASE_URL_VALUE: https://oryxsdksdev.blob.core.windows.net
node18DebianFlavors: bullseye
node20DebianFlavors: bullseye,bookworm
python38DebianFlavors: buster,bullseye
python39DebianFlavors: buster,bullseye
python310DebianFlavors: buster,bullseye
python311DebianFlavors: bullseye,bookworm
python312DebianFlavors: bullseye,bookworm
dotnet60DebianFlavors: buster,bullseye
dotnet70DebianFlavors: buster,bullseye
dotnet80DebianFlavors: bullseye,bookworm
dotnet90DebianFlavors: bookworm
php81DebianFlavors: bullseye,buster
php82DebianFlavors: bullseye,buster
php83DebianFlavors: bullseye,buster,bookworm
debianFlavors: 'buster,bullseye,bookworm'
dotnet60DebianFlavors: 'buster,bullseye'
dotnet70DebianFlavors: 'buster,bullseye'
dotnet80DebianFlavors: 'bullseye,bookworm'
dotnet90DebianFlavors: 'bookworm'
dotnetDebianFlavors: 'bookworm,bullseye,buster'
node18DebianFlavors: 'bullseye'
node20DebianFlavors: 'bullseye,bookworm'
nodejsDebianFlavors: 'bookworm,bullseye'
php81DebianFlavors: 'bullseye,buster'
php81_GPG_keys: '528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544'
php82DebianFlavors: 'bullseye,buster'
php82_GPG_keys: '1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544'
php83DebianFlavors: 'bullseye,buster,bookworm'
php83_GPG_keys: '1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA'
phpDebianFlavors: 'bookworm,bullseye,buster'
python310DebianFlavors: 'buster,bullseye'
python310_GPG_keys: 'A035C8C19219BA821ECEA86B64E628F8D684696D'
python311DebianFlavors: 'bullseye,bookworm'
python311_GPG_keys: 'A035C8C19219BA821ECEA86B64E628F8D684696D'
python312DebianFlavors: 'bullseye,bookworm'
python312_GPG_keys: '7169605F62C751356D054A26A821E680E5FA6305'
python38DebianFlavors: 'buster,bullseye'
python38_GPG_keys: 'E3FF2839C048B25C084DEBE9B26995E310250568'
python39DebianFlavors: 'buster,bullseye'
python39_GPG_keys: 'E3FF2839C048B25C084DEBE9B26995E310250568'
pythonDebianFlavors: 'bookworm,bullseye,buster'
DotNetCoreAgent_version: 2.8.42
GitHubActions_BaseImage_Buster: mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:be7137ba47bdf421d3950abe1200322631e8db11b468cd6f0ebf3d687e556c90
GitHubActions_BaseImage_Bullseye: mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:25c86292946cce832340fe808ac47e5a845b68c488f177a47ff44fd59040397d
GitHubActions_BaseImage_Bookworm: mcr.microsoft.com/mirror/docker/library/buildpack-deps@sha256:ff838f535d6e3bace9ab7eefa360d648ba529f9aa57fdd709335f8ef0516cdde
debianFlavors: 'buster,bullseye,bookworm'
dotnetDebianFlavors: 'bookworm,bullseye,buster'
nodejsDebianFlavors: 'bookworm,bullseye'
phpDebianFlavors: 'bookworm,bullseye,buster'
pythonDebianFlavors: 'bookworm,bullseye,buster'
php81_GPG_keys: '528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544'
php82_GPG_keys: '1198C0117593497A5EC5C199286AF1F9897469DC 39B641343D8C104B2B146DC3F9C39DC0B9698544'
php83_GPG_keys: '1198C0117593497A5EC5C199286AF1F9897469DC AFD8691FDAEDF03BDF6E460563F15A9B715376CA'
python310_GPG_keys: 'A035C8C19219BA821ECEA86B64E628F8D684696D'
python311_GPG_keys: 'A035C8C19219BA821ECEA86B64E628F8D684696D'
python312_GPG_keys: '7169605F62C751356D054A26A821E680E5FA6305'
python38_GPG_keys: 'E3FF2839C048B25C084DEBE9B26995E310250568'
python39_GPG_keys: 'E3FF2839C048B25C084DEBE9B26995E310250568'

Просмотреть файл

@ -1,23 +1,24 @@
# #!/bin/bash
sort_versions_to_build_file(){
versionsToBuild_File="$1"
tempfile1=$(mktemp)
tempfile2=$(mktemp)
while IFS= read -r line; do
echo "Sdk_version line is $line"
if [[ "$line" = *"$value"* ]]; then
sdk_version=$(echo $line | cut -d':' -f2- | tr -d '\n')
echo "after processing sdk_version is $sdk_version"
# version_found=false
# while IFS= read -r line_in_versionsToBuild; do
# if [[ "$line_in_versionsToBuild" = *"$sdk_version"* ]]; then
# version_found=true
# fi
# done < "$versionsToBuild_FILE"
while IFS= read -r line; do
if [[ "$line" = *"#"* ]]; then
echo "$line" >> "$tempfile1"
elif [[ -n "$line" ]]; then
echo "$line" >> "$tempfile2"
fi
done < "$versionsToBuild_File"
sort -V $tempfile2 -o $tempfile2
cat $tempfile2 >> $tempfile1
cp $tempfile1 $versionsToBuild_File
}
versionsToBuild_File=$(cd .. && pwd)/platforms/python/versions/bookworm/versionsToBuild.txt
sort_versions_to_build_file "$versionsToBuild_File"
# if ! $version_found; then
# if [ -n "$(tail -c 1 "$versionsToBuild_FILE")" ]; then
# echo "" >> "$versionsToBuild_FILE"
# fi
# echo -n "$sdk_version" >> "$versionsToBuild_FILE"
# updated_files+=("$versionsToBuild_FILE")
# # sort_versions_to_build_file $versionsToBuild_FILE
# fi
fi
done < "generated_files/dotnet_sdk_latest_versions.txt"

Просмотреть файл

@ -13,11 +13,9 @@ EOL
Updated_ValuesFILE=Updated_Values.txt
echo -n "" > $Updated_ValuesFILE
Stack_Updated_values=Stack_Updated_values.txt
echo -n "" > $Stack_Updated_values
update_constants_file(){
while IFS= read -r line; do
# Use yq to parse the YAML line and extract the key and value
@ -37,17 +35,16 @@ update_constants_file(){
old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
if [ $old_value = $value ]; then
yq eval ".variables.$key = \"$value\"" -i $constants_FILE
echo "$key is already upto date"
else
// during updating php or python versions we need gpg keys as well during sdk building
// so if it is not present in Temp_constants_FILE or in variable group, ask for it
# during updating php or python versions we need gpg keys as well during sdk building
# so if it is not present in Temp_constants_FILE or in variable group, ask for it
if [[ "$1" = "latest_stack_versions.yaml" && ("$key" = *"python"* || "$key" = *"php"*) && "$key" != *"SHA"* ]]; then
gpgkeys=$(echo "$key" | sed 's/Version.*//')
gpgkeys+="_GPG_keys"
echo "$gpgkeys"
if ! yq eval ".variables | has(\"$gpgkeys\")" $Temp_constants_FILE; then
echo "GPG Keys needed for $key" >&2
exit 1
@ -111,355 +108,4 @@ update_constants_file(){
}
update_constants_file "override_constants.yaml"
update_constants_file "latest_stack_versions.yaml"
# // update the values of override_constants.yaml and copy the final file to constants.yaml
# update_from_override_constants(){
# while IFS= read -r line; do
# # Use yq to parse the YAML line and extract the key and value
# key=$(echo "$line" | yq e 'keys' - | sed 's/^[[:space:]]*-*//' | sed 's/^[[:space:]]*//')
# value=$(echo "$line" | yq e '.[]' -)
# echo "Key: $key, Value: $value,"
# keyInVariableGroup=$(echo "$key" | tr '[:lower:]' '[:upper:]')
# # Check if the key exists in the environment variables
# if printenv "$keyInVariableGroup" > /dev/null; then
# # If the key exists, get its value
# valueInVariableGroup=$(printenv "$keyInVariableGroup")
# echo "The value of $key is: $valueInVariableGroup"
# if [[ "$valueInVariableGroup" = "latest" || "$valueInVariableGroup" = "dont_change" ]]; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# else
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# if [ $old_value = $valueInVariableGroup ]; then
# echo "$key has required value in constants.yml"
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# else
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# echo "Updated constants.yml with given value $key=$valueInVariableGroup"
# update_line="Updated $key from $old_value to $valueInVariableGroup"
# echo "$update_line" >> "$Updated_ValuesFILE"
# fi
# fi
# else
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# fi
# done < <(yq e '.[]' "override_constants.yaml")
# }
# update_from_latest_stack_versions(){
# Stack_Updated_values=Stack_Updated_values.txt
# cat <<EOL > $Stack_Updated_values
# EOL
# while IFS= read -r line; do
# # Use yq to parse the YAML line and extract the key and value
# key=$(echo "$line" | yq e 'keys' - | sed 's/^[[:space:]]*-*//' | sed 's/^[[:space:]]*//')
# value=$(echo "$line" | yq e '.[]' -)
# echo "Key: $key, Value: $value,"
# keyInVariableGroup=$(echo "$key" | tr '[:lower:]' '[:upper:]')
# # Check if the key exists in the environment variables
# if printenv "$keyInVariableGroup" > /dev/null; then
# # If the key exists, get its value
# valueInVariableGroup=$(printenv "$keyInVariableGroup")
# echo "The value of $key is: $valueInVariableGroup"
# if [ "$valueInVariableGroup" = "latest" ]; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# if [ $old_value = $value ]; then
# echo "$key is already upto date"
# else
# // during updating php or python versions we need gpg keys as well during sdk building
# // so if it is not present in Temp_constants_FILE or in variable group, ask for it
# if [[ ("$key" = *"python"* || "$key" = *"php"*) && "$key" != *"SHA"* ]]; then
# gpgkeys=$(echo "$key" | sed 's/Version.*//')
# gpgkeys+="_GPG_keys"
# echo "$gpgkeys"
# if ! yq eval ".variables | has(\"$gpgkeys\")" $override_constants; then
# if printenv "$gpgkeys" > /dev/null; then
# gpgkeysvalue=$(printenv "$gpgkeys")
# yq eval ".variables.$gpgkeys = \"$gpgkeysvalue\"" -i "override_constants.yaml"
# else
# echo "GPG Keys needed for $key" >&2
# exit 1
# fi
# fi
# fi
# yq eval ".variables.$key = \"$value\"" -i $constants_FILE
# echo "Updated constants.yml with latest value $key=$value"
# # This is for all updates (for PR description)
# if [[ "$key" != *"SHA"* ]]; then
# echo "$key=$value" >> "$Stack_Updated_values"
# if [ -n $old_value ]; then
# update_line="Updated $key from $old_value to $value"
# else
# update_line="Added $key to $value"
# fi
# echo "$update_line" >> "$Updated_ValuesFILE"
# fi
# fi
# elif [ "$valueInVariableGroup" = "dont_change" ]; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# else
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# if [ $old_value = $valueInVariableGroup ]; then
# echo "$key has required value in constants.yml"
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# else
# if [[ ("$key" = *"python"* || "$key" = *"php"*) && "$key" != *"SHA"* ]]; then
# gpgkeys=$(echo "$key" | sed 's/Version.*//')
# gpgkeys+="_GPG_keys"
# if ! yq eval ".variables | has(\"$gpgkeys\")" $override_constants; then
# if printenv "$gpgkeys" > /dev/null; then
# gpgkeysvalue=$(printenv "$gpgkeys")
# yq eval ".variables.$gpgkeys = \"$gpgkeysvalue\"" -i "override_constants.yaml"
# else
# echo "GPG Keys needed for $key" >&2
# exit 1
# fi
# fi
# fi
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# echo "Updated constants.yml with given value $key=$valueInVariableGroup"
# # This is for all updates (for PR description)
# if [[ "$key" != *"SHA"* ]]; then
# echo "$key=$valueInVariableGroup" >> "$Stack_Updated_values"
# if [ -n $old_value ]; then
# update_line="Updated $key from $old_value to $value"
# else
# update_line="Added $key to $value"
# fi
# echo "$update_line" >> "$Updated_ValuesFILE"
# fi
# fi
# fi
# else
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# fi
# done < <(yq e '.[]' "latest_stack_versions.yaml")
# }
# update_from_latest_stack_versions
# yq eval -i 'sort_keys(..)' "override_constants.yaml"
# update_from_override_constants
# while IFS= read -r line; do
# key=$(echo "$line" | yq e 'keys' - | sed 's/^[[:space:]]*-*//' | sed 's/^[[:space:]]*//')
# value=$(echo "$line" | yq e '.[]' -)
# echo "Key: $key, Value: $value,"
# yq eval ".variables.$key = \"$value\"" -i $constants_FILE
# done < <(yq e '.[]' "override_constants.yaml")
# update_node_versions_to_build(){
# node_versionsToBuild_FILE="$1"
# version="$2"
# value="$3"
# echo "$version"
# echo "$value"
# version_found=false
# while IFS= read -r line; do
# if [[ "$line" == *"$value"* ]]; then
# version_found=true
# echo "version is found"
# break
# fi
# done < "$node_versionsToBuild_FILE"
# if ! $version_found; then
# echo -e "\n$value" >> "$node_versionsToBuild_FILE"
# echo "adding this version to build file"
# sort -V "$node_versionsToBuild_FILE" -o "$node_versionsToBuild_FILE"
# fi
# }
# update_stack_versions_to_build(){
# stack_versionsToBuild_FILE="$1"
# version="$2"
# value="$3"
# key="$4"
# echo "$version"
# echo "$value"
# version_found=false
# while IFS= read -r line; do
# if [[ "$line" == *"$value"* ]]; then
# version_found=true
# echo "version is found"
# break
# fi
# done < "$stack_versionsToBuild_FILE"
# if ! $version_found; then
# if [[ "$key" == *"node"* ]]
# echo -e "\n$value" >> "$node_versionsToBuild_FILE"
# echo "adding this version to build file"
# elif [[ "$key" == *"python"* ]]
# gpgkey="python${version}gpg"
# echo -e "\n$value, $gpgkey"
# elif [[ "$key" == *"php"* ]]
# gpgkey
# fi
# sort -V "$stack_versionsToBuild_FILE" -o "$stack_versionsToBuild_FILE"
# fi
# }
# update_versions_to_build() {
# key="$1"
# value="$2"
# version=${key//[^0-9]/}
# if [[ "$key" == *"node"* ]]; then
# versionsToBuild_Folder=$(cd .. && pwd)/platforms/nodejs/versions
# debianFlavors="node$version"
# elif [[ "$key" == *"python"* ]]; then
# versionsToBuild_Folder=$(cd .. && pwd)/platforms/python/versions
# debianFlavors="python$version"
# elif [[ "$key" == *"php"* ]]; then
# versionsToBuild_Folder=$(cd .. && pwd)/platforms/php/versions
# debianFlavors="php$version"
# elif [[ "$key" == *"NET"* ]]; then
# versionsToBuild_Folder=$(cd .. && pwd)/platforms/dotnet/versions
# debianFlavors="dotnet$version"
# fi
# debianFlavors+="DebianFlavors"
# echo "The one which needs to be searched is $debianFlavors"
# alldebianFlavors=$(yq eval ".variables.$debianFlavors" override_constants.yaml)
# echo "$alldebianFlavors"
# IFS=','
# for flavor in $alldebianFlavors; do
# echo "$flavor"
# versionsToBuild_FILE="$versionsToBuild_Folder/$flavor/versionsToBuild.txt"
# if [[ "$key" == *"node"* ]]; then
# update_node_versions_to_build $versionsToBuild_FILE $version $value $key
# elif [[ "$key" == *"python"* ]]; then
# update_python_versions_to_build $versionsToBuild_FILE $version $value $key
# elif [[ "$key" == *"php"* ]]; then
# update_python_versions_to_build $versionsToBuild_FILE $version $value $key $3
# fi
# done
# }
# update_constants_file() {
# while IFS= read -r line; do
# # Use yq to parse the YAML line and extract the key and value
# key=$(echo "$line" | yq e 'keys' - | sed 's/^[[:space:]]*-*//' | sed 's/^[[:space:]]*//')
# value=$(echo "$line" | yq e '.[]' -)
# echo "Key: $key, Value: $value,"
# keyInVariableGroup=$(echo "$key" | tr '[:lower:]' '[:upper:]')
# # Check if the key exists in the environment variables
# if printenv "$keyInVariableGroup" > /dev/null; then
# # If the key exists, get its value
# valueInVariableGroup=$(printenv "$keyInVariableGroup")
# echo "The value of $key is: $valueInVariableGroup"
# if [ "$valueInVariableGroup" = "latest" ]; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# if [ $old_value = $value ]; then
# echo "$key is already upto date"
# else
# yq eval ".variables.$key = \"$value\"" -i $constants_FILE
# echo "Updated constants.yml with latest value $key=$value"
# if [[ "$key" != *"SHA"* ]]; then
# if [ -n $old_value ]; then
# update_line="Updated $key from $old_value to $value"
# else
# update_line="Added $key to $value"
# fi
# echo "$update_line" >> "$Updated_ValuesFILE"
# if [[ "$key" = *"php"* ]]; then
# phpSHAName="php${version}Version_SHA"
# phpSHAValue=$(yq eval ".variables.$phpSHAName" latest_stack_versions.yaml)
# update_versions_to_build $key $value $phpSHAValue
# else
# update_versions_to_build $key $value
# fi
# fi
# fi
# elif [ "$valueInVariableGroup" = "dont_change" ]; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# else
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# if [ $old_value = $valueInVariableGroup ]; then
# echo "$key has required value in constants.yml"
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# else
# yq eval ".variables.$key = \"$valueInVariableGroup\"" -i $constants_FILE
# echo "Updated constants.yml with given value $key=$valueInVariableGroup"
# if [[ "$key" != *"SHA"* ]]; then
# update_line="Updated $key from $old_value to $valueInVariableGroup"
# echo "$update_line" >> "$Updated_ValuesFILE"
# if [[ "$key" = *"php"* ]]; then
# phpSHAName="php${version}Version_SHA"
# phpSHAValue=$(printenv "$phpSHAName")
# update_versions_to_build $key $value $phpSHAValue
# else
# update_versions_to_build $key $value
# fi
# fi
# fi
# fi
# else
# if yq eval ".variables | has(\"$key\")" $Temp_constants_FILE | grep -q 'true'; then
# old_value=$(yq eval ".variables.$key" $Temp_constants_FILE)
# yq eval ".variables.$key = \"$old_value\"" -i $constants_FILE
# echo "constants.yml with old value $key=$old_value"
# else
# yq eval ".variables.$key = \"$value\"" -i $constants_FILE
# echo "Added $key = $value in constants.yml"
# fi
# fi
# done < <(yq e '.[]' "$1")
# }
# update_constants_file "latest_stack_versions.yaml"
update_constants_file "latest_stack_versions.yaml"

Просмотреть файл

@ -1,95 +1,66 @@
# add_line_to_versions_to_build() {
# update_file=$1
# line_to_be_added=$2
# awk -v line="$line_to_be_added" '
# BEGIN { added = 0 }
# /^[[:space:]]*$/ { print; next } # Skip empty lines
# /^#/ { print; next } # Skip comment lines
# {
# split(line, new_fields, ", ")
# split($0, fields, ", ")
# # Use sort -V to compare versions
# cmd = "echo \"" fields[1] "\n" new_fields[1] "\" | sort -V | head -n 1"
# cmd | getline result
# close(cmd)
# if (!added && result == new_fields[1]) {
# print line
# added = 1
# }
# print
# }
# END {
# if (!added) print line
# }' "$update_file" > temp && mv temp "$update_file"
# }
sort_versions_to_build_file(){
versionsToBuild_FILE="$1"
versionsToBuild_File="$1"
tempfile1=$(mktemp)
tempfile2=$(mktemp)
while IFS= read -r line; do
while IFS= read -r line || [[ -n "$line" ]]; do
if [[ "$line" = *"#"* ]]; then
echo "$line" >> "$tempfile1"
elif [[ -n "$line" ]]; then
elif [[ "$line" =~ [^[:space:]] ]]; then
echo "$line" >> "$tempfile2"
fi
done < "$versionsToBuild_FILE"
done < "$versionsToBuild_File"
sort -V $tempfile2 -o $tempfile2
cat $tempfile2 >> $tempfile1
cp $tempfile1 $versionsToBuild_FILE
cp $tempfile1 $versionsToBuild_File
}
update_stack_versions_to_build(){
stack_versionsToBuild_FILE="$1"
versionsToBuild_FILE="$1"
version="$2"
value="$3"
key="$4"
echo "$version"
echo "$value"
version_found=false
while IFS= read -r line; do
if [[ "$line" == *"$value"* ]]; then
version_found=true
echo "version is found"
echo "version already exists in sdks"
break
fi
done < "$stack_versionsToBuild_FILE"
done < "$versionsToBuild_FILE"
if ! $version_found; then
if [[ "$key" = *"node"* ]]; then
if [[ "$key" == *"node"* ]]; then
# Check if the last line is empty
if [ -n "$(tail -c 1 "$stack_versionsToBuild_FILE")" ]; then
echo "" >> "$stack_versionsToBuild_FILE"
if [ -n "$(tail -c 1 "$versionsToBuild_FILE")" ]; then
echo "" >> "$versionsToBuild_FILE"
fi
echo -n "$value" >> "$stack_versionsToBuild_FILE"
sort_versions_to_build_file "$stack_versionsToBuild_FILE"
elif [[ "$key" = *"python"* ]]; then
echo -n "$value" >> "$versionsToBuild_FILE"
updated_files+=("$versionsToBuild_FILE")
# sort_versions_to_build_file "$versionsToBuild_FILE"
elif [[ "$key" == *"python"* ]]; then
gpgkeyname="python${version}_GPG_keys"
gpgkeysvalue=$(yq eval ".variables.$gpgkeyname" override_constants.yaml)
if [ -n "$(tail -c 1 "$stack_versionsToBuild_FILE")" ]; then
echo "" >> "$stack_versionsToBuild_FILE"
if [ -n "$(tail -c 1 "$versionsToBuild_FILE")" ]; then
echo "" >> "$versionsToBuild_FILE"
fi
echo -n "$value, $gpgkeysvalue," >> "$stack_versionsToBuild_FILE"
sort_versions_to_build_file "$stack_versionsToBuild_FILE"
elif [[ "$key" = *"php"* ]]; then
echo -n "$value, $gpgkeysvalue," >> "$versionsToBuild_FILE"
updated_files+=("$versionsToBuild_FILE")
# sort_versions_to_build_file "$versionsToBuild_FILE"
elif [[ "$key" == *"php"* ]]; then
gpgkeyname="php${version}_GPG_keys"
gpgkeysvalue=$(yq eval ".variables.$gpgkeyname" override_constants.yaml)
phpSHAName="php${version}Version_SHA"
phpSHAValue=$(yq eval ".variables.$phpSHAName" latest_stack_versions.yaml)
if [ -n "$(tail -c 1 "$stack_versionsToBuild_FILE")" ]; then
echo "" >> "$stack_versionsToBuild_FILE"
if [ -n "$(tail -c 1 "$versionsToBuild_FILE")" ]; then
echo "" >> "$versionsToBuild_FILE"
fi
echo -n "$value, $phpSHAValue, $gpgkeysvalue," >> "$stack_versionsToBuild_FILE"
sort_versions_to_build_file "$stack_versionsToBuild_FILE"
echo -n "$value, $phpSHAValue, $gpgkeysvalue," >> "$versionsToBuild_FILE"
updated_files+=("$versionsToBuild_FILE")
# sort_versions_to_build_file "$versionsToBuild_FILE"
fi
fi
}
@ -122,15 +93,15 @@ update_versions_to_build() {
echo "$flavor"
versionsToBuild_FILE="$versionsToBuild_Folder/$flavor/versionsToBuild.txt"
if [[ "$key" == *"NET"* ]]; then
if [[ "$key" = *"NET"* ]]; then
while IFS= read -r line; do
echo "Sdk_version line is $line"
if [[ "$line" == *"$value"* ]]; then
sdk_version=$(echo $line | cut -d':' -f2- | tr -d '\n')
if [[ "$line" = *"$value"* ]]; then
sdk_version=$(echo "$line" | sed 's/^[^:]*://')
echo "after processing sdk_version is $sdk_version"
version_found=false
while IFS= read -r line_in_versionsToBuild; do
if [[ "$line_in_versionsToBuild" == *"$sdk_version"* ]]; then
while IFS= read -r line_in_versionsToBuild || [[ -n "$line_in_versionsToBuild" ]]; do
if [[ "$line_in_versionsToBuild" = *"$sdk_version"* ]]; then
version_found=true
fi
done < "$versionsToBuild_FILE"
@ -139,20 +110,20 @@ update_versions_to_build() {
if [ -n "$(tail -c 1 "$versionsToBuild_FILE")" ]; then
echo "" >> "$versionsToBuild_FILE"
fi
echo -n "$sdk_version" >> "$versionsToBuild_FILE"
sort_versions_to_build_file "$stack_versionsToBuild_FILE"
echo "$sdk_version" >> "$versionsToBuild_FILE"
updated_files+=("$versionsToBuild_FILE")
fi
fi
done < "generated_files/dotnet_sdk_latest_versions.txt"
done < "generated_files/dotnet_sdk_latest_versions.txt"
else
update_stack_versions_to_build $versionsToBuild_FILE $version $value $key
sort -V $versionsToBuild_FILE -o $versionsToBuild_FILE
fi
done
}
file="Stack_Updated_values.txt"
# for sorting the updated files later
updated_files=()
# Read the file line by line
while IFS='=' read -r key value; do
@ -162,3 +133,6 @@ while IFS='=' read -r key value; do
update_versions_to_build $key $value
done < "$file"
for element in "${updated_files[@]}"; do
sort_versions_to_build_file "$element"
done

Просмотреть файл

@ -7,6 +7,7 @@ with open('generated_files/dotnet_version.xml','r') as file:
soup = BeautifulSoup(content, 'lxml-xml')
version_table=soup.select('#supported-versions-table .table tr')
print("Available Dotnet Versions on Web")
def scrape_CheckSum(version,category,type):
runtime_version="".join([category,version])
@ -21,55 +22,15 @@ def scrape_CheckSum(version,category,type):
check_sum=soup.select('#checksum')[0]['value']
return check_sum
def find_sdks(version):
print(f"sdk version for {version}")
url=f"https://dotnet.microsoft.com/en-us/download/dotnet/{version}"
response=requests.get(url)
html_content=response.text
# Parse the HTML content with BeautifulSoup
soup = BeautifulSoup(html_content, 'html.parser')
if 'preview' in version:
downloads_table=soup.select('.download-wrap .row .col-md-6 dl')
print(downloads_table)
for each_version_table in downloads_table:
each_version=each_version_table.select()
for element in each_version:
if element.text == "Full version":
sdk_version=element.next_sibling().text
break
check_sum=scrape_CheckSum(sdk_version,"","sdk")
with open('generated_files/dotnet_sdk_latest_versions.txt', 'a') as version_file:
version_file.write(f"{sdk_version},{check_sum}")
else:
downloads_table=soup.select('.download-wrap .row .col-md-6 h3')
print(downloads_table)
for element in downloads_table:
if "SDK" in element.id:
sdk_version=(element.text).replace("SDK ","").strip()
check_sum=scrape_CheckSum(sdk_version,"","sdk")
with open('generated_files/dotnet_sdk_latest_versions.txt', 'a') as version_file:
version_file.write(f"{sdk_version},{check_sum}")
return
def scrap_sdk_versions(HTML_CONTENT,version):
def scrap_sdk_versions(HTML_CONTENT,ASPNET_runtime_version,NET_runtime_version):
all_version_tags=HTML_CONTENT.select('h3')
all_description_tags=HTML_CONTENT.select('dl')
print(all_version_tags)
for index,version_tag in enumerate(all_version_tags):
print(version_tag)
if "sdk" in version_tag.get('id'):
sdk_version=(version_tag.text).replace("SDK ","").strip()
check_sum=scrape_CheckSum(sdk_version,"","sdk")
# This is to check for full_version
if(len(all_description_tags)>index):
description_title_tags=all_description_tags[index].select('dt')
@ -80,23 +41,24 @@ def scrap_sdk_versions(HTML_CONTENT,version):
print(f"sdk_version is {sdk_version}, SHA is {check_sum}")
with open('generated_files/dotnet_sdk_latest_versions.txt', 'a') as version_file:
version_file.write(f"{version}:{sdk_version}, {check_sum},\n")
version_file.write(f"{ASPNET_runtime_version}:{sdk_version}, {check_sum},\n")
version_file.write(f"{NET_runtime_version}:{sdk_version}, {check_sum},\n")
return
def scrap_runtime_versions(HTML_CONTENT,major_version):
all_version_tags=HTML_CONTENT.select('h3')
all_description_tags=HTML_CONTENT.select('dl')
print(f"all_description_tags length is {len(all_description_tags)}")
x=major_version.replace('.','')
ASPNET_runtime_version=None
NET_runtime_version=None
for index,version_tag in enumerate(all_version_tags):
if ("runtime" in version_tag.get('id')) and not ("desktop" in version_tag.get('id')):
if ("ASP.NET Core Runtime" in version_tag.text):
runtime_version=(version_tag.text).replace("ASP.NET Core Runtime ","").strip()
check_sum=scrape_CheckSum(runtime_version,"aspnetcore-","runtime")
print(f"{index} in asp")
if(len(all_description_tags)>index):
print(f"{all_description_tags[index]}")
description_title_tags=all_description_tags[index].select('dt')
for title_tag in description_title_tags:
@ -104,6 +66,7 @@ def scrap_runtime_versions(HTML_CONTENT,major_version):
full_version=title_tag.find_next_sibling().text
runtime_version=full_version
ASPNET_runtime_version=runtime_version
print(f"ASP_runtime_version is {runtime_version}, SHA is {check_sum}")
with open('generated_files/dotnet_latest_versions.txt', 'a') as version_file:
version_file.write(f"ASPNET_CORE_APP_{x}={runtime_version},")
@ -112,10 +75,8 @@ def scrap_runtime_versions(HTML_CONTENT,major_version):
if (".NET Runtime" in version_tag.text):
runtime_version=(version_tag.text).replace(".NET Runtime ","").strip()
check_sum=scrape_CheckSum(runtime_version,"","runtime")
print(f"{index} in net")
if(len(all_description_tags)>index):
print(f"{all_description_tags[index]}")
description_title_tags=all_description_tags[index].select('dt')
for title_tag in description_title_tags:
@ -123,12 +84,13 @@ def scrap_runtime_versions(HTML_CONTENT,major_version):
full_version=title_tag.find_next_sibling().text
runtime_version=full_version
NET_runtime_version=runtime_version
print(f"NET_runtime_version is {runtime_version}, SHA is {check_sum}")
with open('generated_files/dotnet_latest_versions.txt', 'a') as version_file:
version_file.write(f"NET_CORE_APP_{x}={runtime_version},")
version_file.write(f"NET_CORE_APP_{x}_SHA={check_sum}\n")
return
return [ASPNET_runtime_version,NET_runtime_version]
def scrap_particular_version(major_version,version):
url=f"https://dotnet.microsoft.com/en-us/download/dotnet/{major_version}"
@ -140,9 +102,9 @@ def scrap_particular_version(major_version,version):
version_details=soup.select('.download-wrap .row .col-md-6')
scrap_sdk_versions(version_details[0],version)
scrap_runtime_versions(version_details[1],major_version)
runtime_fullversions=scrap_runtime_versions(version_details[1],major_version)
scrap_sdk_versions(version_details[0],runtime_fullversions[0],runtime_fullversions[1])
return
for index,each_version in enumerate(version_table):
@ -153,30 +115,6 @@ for index,each_version in enumerate(version_table):
major_version='.'.join(split_version[:2])
print(f"version is {version}")
print(f"major version is {major_version}")
scrap_particular_version(major_version,version)
# print(version)
# find_sdks(version)
# check_sum_aspnetcore=scrape_CheckSum(version,"aspnetcore-","runtime")
# check_sum_netcore=scrape_CheckSum(version,"","runtime")
# index_of_colon1=version.find('.')
# first_part=version[0:index_of_colon1]
# index_of_colon2=version.find('.',index_of_colon1+1)
# second_part=version[index_of_colon1+1:index_of_colon2]
# x="".join([first_part,second_part])
# with open('generated_files/dotnet_latest_versions.txt', 'a') as version_file:
# version_file.write(f"NET_CORE_APP_{x}={version},")
# version_file.write(f"NET_CORE_APP_{x}_SHA={check_sum_netcore}\n")
# version_file.write(f"ASPNET_CORE_APP_{x}={version},")
# version_file.write(f"ASPNET_CORE_APP_{x}_SHA={check_sum_aspnetcore}\n")

Просмотреть файл

@ -7,12 +7,12 @@ soup = BeautifulSoup(content, 'lxml-xml')
versions_table=soup.find(id='tbVersions').find('tbody').find_all('tr')
print("Available Node Versions on Web")
for version_elements in versions_table:
version_element = version_elements.find('td', {'data-label': 'Version'})
index_of_colon = version_element.text.find('.')
major_version=version_element.text[1:index_of_colon]
# globals()[f'node{major_version}Version']=version_element.text[1:]
with open('generated_files/node_latest_versions.txt', 'a') as version_file:
print(f"{version_element.text[1:]}")
version_file.write(f"node{major_version}Version={version_element.text[1:]}\n")

Просмотреть файл

@ -7,7 +7,9 @@ soup = BeautifulSoup(content, 'lxml-xml')
elements = soup.select('h3[id^=v8]')
file_type="tar.bz2"
file_type="tar.xz"
print("Available Php Versions on Web")
for element in elements:
version=(element.get('id')[1:])
@ -22,7 +24,7 @@ for element in elements:
sha256_spans = li_element.find_all(class_='sha256')
if sha256_spans:
x=version[2]
print(f"{version}")
with open('generated_files/php_latest_versions.txt', 'a') as version_file:
version_file.write(f"php8{x}Version={version},")
version_file.write(f"php8{x}Version_SHA={sha256_spans[0].text}\n")

Просмотреть файл

@ -12,10 +12,10 @@ with open('generated_files/python_version.xml','r') as file:
soup = BeautifulSoup(content, 'lxml-xml')
print("Available Python Versions on Web")
version_table = soup.select('.row.download-list-widget .list-row-container.menu li')
for version_tab in version_table:
# version=version_tab.find(class__='release-number').find('a').text
# print(f"{version}\n")
version_full=version_tab.select('.release-number a')[0].text
# Initialize variables to store the indices
@ -36,5 +36,6 @@ for version_tab in version_table:
second_part=version_full[index_of_colon1+1:index_of_colon2]
key="".join(["python",first_part,second_part,"Version"])
print(f"{version}")
with open('generated_files/python_latest_versions.txt', 'a') as version_file:
version_file.write(f"{key}={version}\n")