diff --git a/common.sh b/common.sh index c93644b..ef2870f 100644 --- a/common.sh +++ b/common.sh @@ -64,30 +64,40 @@ function package-and-test() { echo # Assume choco is on WSL path as well - choco.exe pack - - if choco.exe list --local-only | grep "${package}"; then - script=" - choco install -y '${package}' --source . ; - " - echo "Existing install found. Testing upgrade..." - else - script=" - choco install -y '${package}' --source . --x86 ; - choco uninstall -y '${package}' ; - choco install -y '${package}' --source . ; - choco uninstall -y '${package}' ; - " - echo "Testing x86 install, x86 uninstall, x64 install, x64 uninstall..." - fi + choco.exe pack "${package}.nuspec" + + script=" + choco install -y '${package}' --source . --x86 ; + pause ; + choco uninstall -y --removedependencies '${package}' ; + pause ; + choco install -y '${package}' --source . ; + pause ; + choco uninstall -y --removedependencies '${package}' ; + pause ; + " + echo "Testing x86 install, x86 uninstall, x64 install, x64 uninstall..." # Start an admin PowerShell to take care of the install powershell.exe -c "Start-Process powershell.exe -ArgumentList \" echo ${windows_dir} ; cd ${windows_dir} ; ${script} - pause ; \" -Verb RunAs" + + read -p "Waiting for any key..." +} + +function choco-push() { + package="${1}" + version="${2}" + + if [ -z "${package}" ] || [ -z "${version}" ]; then + echo "Usage: ${FUNCNAME[0]} PACKAGE_NAME VERSION" + return 1 + fi + + choco.exe push -source https://push.chocolatey.org/ "${package}.${version}.nupkg" } function commit-and-push() { @@ -107,8 +117,7 @@ function commit-and-push() { echo git commit -m "Release ${package} ${version}" - - choco.exe push -source https://push.chocolatey.org/ "${package}.${version}.nupkg" + git push origin main } function calc-sha256() { diff --git a/gstreamer/tools/chocolateyInstall.ps1 b/gstreamer/tools/chocolateyInstall.ps1 index 5f8caa3..ba3a6f6 100644 --- a/gstreamer/tools/chocolateyInstall.ps1 +++ b/gstreamer/tools/chocolateyInstall.ps1 @@ -9,8 +9,21 @@ $version = "${major}.${minor}.${revision}" $packageName = "${ENV:ChocolateyPackageName}" $packageTitle = "${ENV:ChocolateyPackageTitle}" -$url = "https://gstreamer.freedesktop.org/data/pkg/windows/${version}/msvc/gstreamer-1.0-msvc-x86-${version}.msi" -$url64 = "https://gstreamer.freedesktop.org/data/pkg/windows/${version}/msvc/gstreamer-1.0-msvc-x86_64-${version}.msi" + +$nameSplit = ${packageName}.Split('-') +$toolchain = "msvc" +$devel = "" + +# gstreamer, gstreamer-devel, gstreamer-mingw, or gstreamer-mingw-devel +if (${packageName}.Contains("devel")) { + $devel = "devel-" +} +if (${nameSplit}.Length -gt 1 -and ${nameSplit}[1] -ne "devel") { + $toolchain = ${nameSplit}[1] +} + +$url = "https://gstreamer.freedesktop.org/data/pkg/windows/${version}/${toolchain}/gstreamer-1.0-${devel}${toolchain}-x86-${version}.msi" +$url64 = "https://gstreamer.freedesktop.org/data/pkg/windows/${version}/${toolchain}/gstreamer-1.0-${devel}${toolchain}-x86_64-${version}.msi" $silentArgs = "ADDLOCAL=ALL /qn /norestart /l*v `"$(${ENV:TEMP})\$(${packageName}).$(${version}).MsiInstall.log`"" $packageArgs = @{ @@ -21,9 +34,9 @@ $packageArgs = @{ fileType = "msi" silentArgs = "${silentArgs}" validExitCodes = @(0) - checksum = "1ec5b05d6f8d792dbe151f640440a5ccce6cbb375d71428ba4ae57ba5f1f879f" + checksum = "" checksumType = "sha256" - checksum64 = "22a2ef63b9d57ff7ea45a98eb3467a5df3244893b6583ed8fe921a57e160fc29" + checksum64 = "" checksumType64 = "sha256" } @@ -33,7 +46,7 @@ Write-Output "" # Must install to User path since we need to expand a User environment variable if (${ENV:OS_IS64BIT} -And -Not ${ENV:ChocolateyForceX86}) { - Install-ChocolateyPath -PathToInstall "%GSTREAMER_1_0_ROOT_MSVC_X86_64%\bin" -PathType "User" + Install-ChocolateyPath -PathToInstall "%GSTREAMER_1_0_ROOT_$(${toolchain}.ToUpper())_X86_64%\bin" -PathType "User" } else { - Install-ChocolateyPath -PathToInstall "%GSTREAMER_1_0_ROOT_MSVC_X86%\bin" -PathType "User" -} \ No newline at end of file + Install-ChocolateyPath -PathToInstall "%GSTREAMER_1_0_ROOT_$(${toolchain}.ToUpper())_X86%\bin" -PathType "User" +} diff --git a/gstreamer/update.sh b/gstreamer/update.sh index 5d0ca5f..c94b2f4 100755 --- a/gstreamer/update.sh +++ b/gstreamer/update.sh @@ -21,24 +21,42 @@ old_dir="${PWD}" package="gstreamer" new_version="${1}" -bump-nuspec-version "${package}" "${new_version}" +packages=("gstreamer" "gstreamer-devel" "gstreamer-mingw" "gstreamer-mingw-devel") -download_url=$(sed -nr 's|\$url[ ]+=[ ]+"([^"]*)"|\1|p' tools/chocolateyInstall.ps1) -download_url_64=$(sed -nr 's|\$url64[ ]+=[ ]+"([^"]*)"|\1|p' tools/chocolateyInstall.ps1) +for package in ${packages[@]}; do -download_url=$(version="${new_version}" eval "echo ${download_url}") -download_url_64=$(version="${new_version}" eval "echo ${download_url_64}") + bump-nuspec-version "${package}" "${new_version}" -echo "x86 Download URL: ${download_url}" -echo "x64 Download URL: ${download_url_64}" -echo + download_url=$(sed -nr 's|\$url[ ]+=[ ]+"([^"]*)"|\1|p' tools/chocolateyInstall.ps1) + download_url_64=$(sed -nr 's|\$url64[ ]+=[ ]+"([^"]*)"|\1|p' tools/chocolateyInstall.ps1) + + # This is pretty disgusting since it repeats chocolateyInstall.ps1, but it works for now + toolchain="msvc" + devel="" + first=$(echo "${package}" | awk '{split($0, a, "-"); print a[2]}') + second=$(echo "${package}" | awk '{split($0, a, "-"); print a[3]}') + + [ "${first}" != "devel" ] && [ ! -z "${first}" ] && toolchain="${first}" + [ "${first}" == "devel" ] && devel="devel-" + [ "${second}" == "devel" ] && devel="devel-" + + download_url=$(version="${new_version}" eval "echo ${download_url}") + download_url_64=$(version="${new_version}" eval "echo ${download_url_64}") + + echo "x86 Download URL: ${download_url}" + echo "x64 Download URL: ${download_url_64}" + echo + + echo "Fetching checksums..." + checksum=$(curl --fail --silent --show-error "${download_url}.sha256sum" | cut -d ' ' -f 1) + checksum_64=$(curl --fail --silent --show-error "${download_url_64}.sha256sum" | cut -d ' ' -f 1) -echo "Fetching checksums..." -checksum=$(curl --fail --silent --show-error "${download_url}.sha256sum" | cut -d ' ' -f 1) -checksum_64=$(curl --fail --silent --show-error "${download_url_64}.sha256sum" | cut -d ' ' -f 1) + replace-checksums "${checksum}" "${checksum_64}" -replace-checksums "${checksum}" "${checksum_64}" + package-and-test "${package}" -package-and-test "${package}" + choco-push "${package}" "${new_version}" +done +replace-checksums "" "" commit-and-push "${package}" "${new_version}"