From ac93534191b9c254c00fbab9dddcbbdda1f3c4c3 Mon Sep 17 00:00:00 2001 From: Aaron Colwell <300262+acolwell@users.noreply.github.com> Date: Mon, 22 Jan 2024 00:23:12 -0800 Subject: [PATCH] Replace firebird2 dependency with firebird and refactor repo logic. (#939) Msys2 has removed its firebird2 package. This change replaces the package reference in our mingw-w64-natron-build-deps-qt5 package. The pacman repo building workflow logic has been reworked so that it generates versioned .zip files and builds the repo locally if it can't download the current repo version. This allows changes to the repo to generate the new zip file AND allows the installer and CI workflows to pass at the same time. This makes it easier to verify that the changes to the repo actually fix build issues when the pull request workflows run. --- .github/workflows/build_installer.yml | 16 +------- .github/workflows/build_pacman_repo.yml | 21 ++++++---- .github/workflows/ci.yml | 8 +--- .../workflows/install_natron_pacman_repo.sh | 39 +++++++++++++++++++ .../build_natron_package_repo.sh | 8 ++-- .../mingw-w64-natron-build-deps-qt5/PKGBUILD | 2 +- .../windows_pacman_repo_version.txt | 1 + 7 files changed, 61 insertions(+), 34 deletions(-) create mode 100644 .github/workflows/install_natron_pacman_repo.sh create mode 100644 tools/MINGW-packages/windows_pacman_repo_version.txt diff --git a/.github/workflows/build_installer.yml b/.github/workflows/build_installer.yml index 2797cb013..a29001e68 100644 --- a/.github/workflows/build_installer.yml +++ b/.github/workflows/build_installer.yml @@ -31,13 +31,7 @@ jobs: - name: Install Natron pacman repository run: | - mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo - cd ${GITHUB_WORKSPACE}/natron_pacman_repo - wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip - unzip natron_package_repo.zip - NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` - echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf - pacman -Syl natron + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Build @@ -93,13 +87,7 @@ jobs: - name: Install Natron pacman repository run: | - mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo - cd ${GITHUB_WORKSPACE}/natron_pacman_repo - wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip - unzip natron_package_repo.zip - NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` - echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf - pacman -Syl natron + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Build diff --git a/.github/workflows/build_pacman_repo.yml b/.github/workflows/build_pacman_repo.yml index d99acb21f..bba04eb2c 100644 --- a/.github/workflows/build_pacman_repo.yml +++ b/.github/workflows/build_pacman_repo.yml @@ -39,32 +39,37 @@ jobs: - name: Install Inno Setup run: choco install innosetup shell: pwsh + - name: Prep MinGW package version list + run: | + pacman -Sl mingw64 msys > mingw-package-version-list.txt - name: Restore natron repo directory from cache id: restore-natron-repo-cache uses: actions/cache/restore@v3 with: - path: tools/MINGW-packages/natron_repo - key: ${{ env.cache-name }}-${{ hashFiles('tools/MINGW-packages/**/PKGBUILD') }} + path: natron_repo + key: ${{ env.cache-name }}-${{ hashFiles('mingw-package-version-list.txt', 'tools/MINGW-packages/**/PKGBUILD') }} - name: Build natron package repo id: build-package-repo # Allow continuing after error so cache gets updated and makes reruns faster. continue-on-error: true run: | - cd tools/MINGW-packages - ./build_natron_package_repo.sh natron_repo + tools/MINGW-packages/build_natron_package_repo.sh natron_repo + + REPO_VERSION=`cat ${GITHUB_WORKSPACE}/tools/MINGW-packages/windows_pacman_repo_version.txt` + echo "REPO_VERSION=${REPO_VERSION}" >> "$GITHUB_OUTPUT" - name: Save natron repo directory to cache id: save-natron-repo-cache uses: actions/cache/save@v3 # save even if build fails. if: always() with: - path: tools/MINGW-packages/natron_repo - key: ${{ env.cache-name }}-${{ hashFiles('tools/MINGW-packages/**/PKGBUILD') }} + path: natron_repo + key: ${{ env.cache-name }}-${{ hashFiles('mingw-package-version-list.txt', 'tools/MINGW-packages/**/PKGBUILD') }} - name: Upload natron_package_repo artifacts uses: actions/upload-artifact@v3 with: - name: natron_package_repo - path: tools/MINGW-packages/natron_repo + name: natron_package_repo-${{ steps.build-package-repo.outputs.REPO_VERSION }} + path: natron_repo - name: Check on failures if: steps.build-package-repo.outcome != 'success' run: exit 1 \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 540fcf5e3..b263e5a61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -143,13 +143,7 @@ jobs: - name: Install Natron pacman repository run: | - mkdir ${GITHUB_WORKSPACE}/natron_pacman_repo - cd ${GITHUB_WORKSPACE}/natron_pacman_repo - wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/natron_package_repo.zip - unzip natron_package_repo.zip - NATRON_REPO_PATH=`cygpath -u $GITHUB_WORKSPACE` - echo -e "#NATRON_REPO_START\n[natron]\nSigLevel = Optional TrustAll\nServer = file://${NATRON_REPO_PATH}/natron_pacman_repo/\n#NATRON_REPO_END" >> /etc/pacman.conf - pacman -Syl natron + ${GITHUB_WORKSPACE}/.github/workflows/install_natron_pacman_repo.sh ${GITHUB_WORKSPACE} ${GITHUB_WORKSPACE}/natron_pacman_repo pacman -S --needed --noconfirm mingw-w64-x86_64-natron-build-deps-qt5 - name: Download OpenColorIO-Configs diff --git a/.github/workflows/install_natron_pacman_repo.sh b/.github/workflows/install_natron_pacman_repo.sh new file mode 100644 index 000000000..0812f9ad0 --- /dev/null +++ b/.github/workflows/install_natron_pacman_repo.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +NATRON_DIR= +NATRON_REPO_DIR= +if [[ -z $1 || -z $2 ]]; then + echo "Usage: $(basename $0) " + exit 1 +else + NATRON_DIR=$(realpath $1) + NATRON_REPO_DIR=$(realpath $2) +fi + +source ${NATRON_DIR}/tools/MINGW-packages/natron_repo_common.sh + +if [[ ! -d ${NATRON_REPO_DIR} ]]; then + mkdir ${NATRON_REPO_DIR} +fi + +cd ${NATRON_REPO_DIR} + +WINDOWS_PACMAN_REPO_VERSION=`cat ${NATRON_DIR}/tools/MINGW-packages/windows_pacman_repo_version.txt` +ZIP_FILENAME="natron_package_repo-${WINDOWS_PACMAN_REPO_VERSION}.zip" +wget https://github.com/NatronGitHub/Natron/releases/download/windows-mingw-package-repo/${ZIP_FILENAME} + +if [[ -e ${ZIP_FILENAME} ]]; then + unzip ${ZIP_FILENAME} +else + echo "Failed to fetch ${ZIP_FILENAME}" + + echo "Building pacman repo locally." + + # install necessary dependencies for building pacman repo. + pacman -S --needed --noconfirm git base-devel + + ${NATRON_DIR}/tools/MINGW-packages/build_natron_package_repo.sh ${NATRON_REPO_DIR} +fi + +UNIX_NATRON_REPO_DIR=`cygpath -u ${NATRON_REPO_DIR}` +natron_repo_init ${UNIX_NATRON_REPO_DIR} diff --git a/tools/MINGW-packages/build_natron_package_repo.sh b/tools/MINGW-packages/build_natron_package_repo.sh index ae87d01ef..dc08294d5 100644 --- a/tools/MINGW-packages/build_natron_package_repo.sh +++ b/tools/MINGW-packages/build_natron_package_repo.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e #set -x -CWD=$(pwd) +BUILD_SCRIPT_DIR=$(realpath $(dirname "${BASH_SOURCE[0]}")) PKGS=" mingw-w64-natron-setup @@ -21,7 +21,7 @@ mingw-w64-dump_syms mingw-w64-natron-build-deps-qt5 " -source ./natron_repo_common.sh +source "${BUILD_SCRIPT_DIR}/natron_repo_common.sh" trap natron_repo_cleanup EXIT @@ -37,7 +37,7 @@ natron_repo_init ${NATRON_REPO_DIR} for pkg_dir in ${PKGS}; do echo -e "\n\nEntering package directory ${pkg_dir}." - cd "${CWD}/${pkg_dir}" + cd "${BUILD_SCRIPT_DIR}/${pkg_dir}" PACKAGE_NAME=`makepkg --printsrcinfo | awk '/pkgname/{print $3}'` @@ -71,5 +71,5 @@ for pkg_dir in ${PKGS}; do fi echo -e "Leaving package directory ${pkg_dir}." - cd "${CWD}" + cd "${BUILD_SCRIPT_DIR}" done diff --git a/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD b/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD index 69ea0e05c..88940a8b6 100644 --- a/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD +++ b/tools/MINGW-packages/mingw-w64-natron-build-deps-qt5/PKGBUILD @@ -41,7 +41,7 @@ depends=( # installer "zip" "unzip" - "${MINGW_PACKAGE_PREFIX}-firebird2-git" + "${MINGW_PACKAGE_PREFIX}-firebird" "${MINGW_PACKAGE_PREFIX}-breakpad-git" "${MINGW_PACKAGE_PREFIX}-python-sphinx" "${MINGW_PACKAGE_PREFIX}-python-sphinx_rtd_theme" diff --git a/tools/MINGW-packages/windows_pacman_repo_version.txt b/tools/MINGW-packages/windows_pacman_repo_version.txt new file mode 100644 index 000000000..d861e6ecd --- /dev/null +++ b/tools/MINGW-packages/windows_pacman_repo_version.txt @@ -0,0 +1 @@ +20240120-1