From 2f6b8ff69cd07c84a83c0216e0523cadebdbe4dc Mon Sep 17 00:00:00 2001 From: "Satadru Pramanik, DO, MPH, MEng" Date: Fri, 23 Aug 2024 21:30:41 -0400 Subject: [PATCH] Handbrake => 1.8.2, update unit test workflow. (#10344) * Handbrake => 1.8.2 Signed-off-by: Satadru Pramanik * Add armv7l exclusion to starting the armv7l container unit test if no armv7l packages have been changed. Signed-off-by: Satadru Pramanik * Adjust logic. Signed-off-by: Satadru Pramanik * Add i686 to the mix. Signed-off-by: Satadru Pramanik * fixup Signed-off-by: Satadru Pramanik * Adjust unit test to avoid exiting on double bracket false. Signed-off-by: Satadru Pramanik * Refactor again. Signed-off-by: Satadru Pramanik * fixup Signed-off-by: Satadru Pramanik * Adjust grep for architecture. Signed-off-by: Satadru Pramanik --------- Signed-off-by: Satadru Pramanik --- .github/workflows/Unit-Test.yml | 92 +++++++++++++++++++++++++-------- packages/handbrake.rb | 33 ++++++------ 2 files changed, 88 insertions(+), 37 deletions(-) diff --git a/.github/workflows/Unit-Test.yml b/.github/workflows/Unit-Test.yml index be52196ee2..5a311b0746 100644 --- a/.github/workflows/Unit-Test.yml +++ b/.github/workflows/Unit-Test.yml @@ -5,7 +5,7 @@ jobs: container_tests: strategy: matrix: - arch: [x86_64, armv7l] + arch: [x86_64, armv7l, i686] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -14,30 +14,57 @@ jobs: - name: Set up QEMU if: matrix.arch == 'armv7l' uses: docker/setup-qemu-action@v3.2.0 + - name: Get non-pkg changed files + id: non-pkg-changed-files + uses: tj-actions/changed-files@v45 + with: + files_ignore: packages/*.rb - name: Get all changed package files id: changed-ruby-files uses: tj-actions/changed-files@v45 with: - files: | - packages/*.rb + files: packages/*.rb - name: Export variables to github context run: | # Convert "packages/foo.rb packages/bar.rb" (from steps.changed-ruby-files.outputs.all_changed_files) into "foo bar" echo "CHANGED_PACKAGES=$(echo "${{ steps.changed-ruby-files.outputs.all_changed_files }}" | xargs basename -s .rb | xargs)" >> $GITHUB_ENV + echo "NON_PKG_CHANGED_FILES=$(echo "${{ steps.non-pkg-changed-files.outputs.all_changed_files }}" | xargs)" >> $GITHUB_ENV - name: Determine glibc and architecture package compatibility run: | - # If a package doesnt have a min_glibc value, or if its below 2.27, add it to the list - echo "PR #${{ github.event.pull_request.number }} has these possibly Glibc 2.27 compatible packages: $(for i in ${CHANGED_PACKAGES} ; do if ! grep -q min_glibc packages/$i.rb; then echo $i ; else grep min_glibc packages/$i.rb | tr -d \' | awk '{exit $2 <= 2.27}' || echo $i ; fi ; done | xargs)" + # If a package doesnt have a min_glibc value, or if its below 2.27, add it to GLIBC_227_COMPATIBLE_PACKAGES. + export GLIBC_227_COMPATIBLE_PACKAGES="$(for i in ${CHANGED_PACKAGES} ; do if grep -q min_glibc packages/${i}.rb; then grep min_glibc packages/${i}.rb | tr -d \' | awk '{exit $2 <= 2.27}' || echo ${i} ; else echo ${i} ; fi ; done | xargs -r)" + if [[ -n ${GLIBC_227_COMPATIBLE_PACKAGES} ]]; then + echo "GLIBC_227_COMPATIBLE_PACKAGES=${GLIBC_227_COMPATIBLE_PACKAGES}" >> $GITHUB_ENV + echo "PR #${{ github.event.pull_request.number }} has these possibly Glibc 2.27 compatible packages: ${GLIBC_227_COMPATIBLE_PACKAGES}" + fi - # If a package doesnt have a min_glibc value, or if its below 2.37, add it to GLIBC_237_COMPATIBLE_PACKAGES - echo "GLIBC_237_COMPATIBLE_PACKAGES=$(for i in ${CHANGED_PACKAGES} ; do grep min_glibc packages/$i.rb | tr -d \' | awk '{exit $2 <= 2.37}' || echo $i ; done | xargs)" >> $GITHUB_ENV - echo "PR #${{ github.event.pull_request.number }} has these possibly Glibc 2.37 compatible packages: ${GLIBC_237_COMPATIBLE_PACKAGES}" + # If a package doesnt have a min_glibc value, or if its below 2.37, add it to GLIBC_237_COMPATIBLE_PACKAGES. + export GLIBC_237_COMPATIBLE_PACKAGES="$(for i in ${CHANGED_PACKAGES} ; do grep min_glibc packages/${i}.rb | tr -d \' | awk '{exit $2 <= 2.37}' || echo ${i} ; done | xargs)" + if [[ -n ${GLIBC_237_COMPATIBLE_PACKAGES} ]]; then + echo "GLIBC_237_COMPATIBLE_PACKAGES=${GLIBC_237_COMPATIBLE_PACKAGES}" >> $GITHUB_ENV + echo "PR #${{ github.event.pull_request.number }} has these possibly Glibc 2.37 compatible packages: ${GLIBC_237_COMPATIBLE_PACKAGES}" + fi - # If a package has a compatibility of 'all' or one that includes 'x86_64', add it to the list. - echo "PR #${{ github.event.pull_request.number }} has these x86_64 compatible packages: $(for p in ${CHANGED_PACKAGES}; do grep -q "compatibility 'all'\|compatibility '.*x86_64.*'" packages/${p}.rb && echo ${p}; done | xargs)" + # If a package has a compatibility of 'all' or one that includes 'x86_64', add it to x86_64_PACKAGES. + export x86_64_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*x86_64" packages/${i}.rb && echo ${i}; done | xargs)" + if [[ -n ${x86_64_PACKAGES} ]]; then + echo "x86_64_PACKAGES=${x86_64_PACKAGES}" >> $GITHUB_ENV + echo "PR #${{ github.event.pull_request.number }} has these x86_64 compatible packages: ${x86_64_PACKAGES}" + fi - # If a package has a compatibility of 'all' or one that includes 'armv7l', add it to the list. - echo "PR #${{ github.event.pull_request.number }} has these armv7l compatible packages: $(for p in ${CHANGED_PACKAGES}; do grep -q "compatibility 'all'\|compatibility '.*armv7l.*'" packages/${p}.rb && echo ${p}; done | xargs)" + ## If a package has a compatibility of 'all' or one that includes 'armv7l', add it to ARMV7L_PACKAGES. + export ARMV7L_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*armv7l" packages/${i}.rb && echo ${i}; done | xargs)" + if [[ -n ${ARMV7L_PACKAGES} ]]; then + echo "ARMV7L_PACKAGES=${ARMV7L_PACKAGES}" >> $GITHUB_ENV + echo "PR #${{ github.event.pull_request.number }} has these armv7l compatible packages: ${ARMV7L_PACKAGES}" + fi + + ## If a package has a compatibility of 'all' or one that includes 'i686', add it to i686_PACKAGES. + export i686_PACKAGES="$(for i in ${CHANGED_PACKAGES}; do grep -q "[[:space:]]compatibility.*all\|[[:space:]]compatibility.*i686" packages/${i}.rb && echo ${i}; done | xargs)" + if [[ -n ${i686_PACKAGES} ]]; then + echo "i686_PACKAGES=${i686_PACKAGES}" >> $GITHUB_ENV + echo "PR #${{ github.event.pull_request.number }} has these i686 compatible packages: ${i686_PACKAGES}" + fi - name: Export target docker container to github context env: TARGET_ARCH: ${{ matrix.arch }} @@ -63,16 +90,37 @@ jobs: echo "PLATFORM=linux/arm/v7" >> $GITHUB_ENV echo "LIB_SUFFIX=" >> $GITHUB_ENV ;; + i686) + # There is only one i686 container based upon M58 with glibc 2.23. + echo "CONTAINER=alex-i686.m58" >> $GITHUB_ENV + echo "PLATFORM=linux/386" >> $GITHUB_ENV + echo "LIB_SUFFIX=" >> $GITHUB_ENV + ;; esac - name: Run unit tests run: | - sudo docker run \ - --platform $PLATFORM \ - -v "${{ github.workspace }}/tests/unit_test.sh:/unit_test.sh" \ - -u chronos \ - -e CHANGED_PACKAGES="$CHANGED_PACKAGES" \ - -e LD_LIBRARY_PATH="/usr/local/lib$LIB_SUFFIX" \ - -e CREW_REPO="${{ github.event.pull_request.head.repo.clone_url }}" \ - -e CREW_BRANCH="${{ github.head_ref }}" \ - "satmandu/crewbuild:$CONTAINER" \ - /usr/local/bin/bash /unit_test.sh + if [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/arm/v7' ]] && [[ -z ${ARMV7L_PACKAGES} ]]; then + # Run the arm container if there are non-package changed files, + # but otherwise do not run the arm container if there are no packages compatible with armv7l. + exit 0 + fi + if [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/amd64' ]] && [[ -z ${x86_64_PACKAGES} ]]; then + # Run the x86_64 container if there are non-package changed files, + # but otherwise do not run the x86_64 container if there are no packages compatible with x86_64. + exit 0 + fi + if [[ -z ${NON_PKG_CHANGED_FILES} ]] && [[ $PLATFORM == 'linux/386' ]] && [[ -z ${i686_PACKAGES} ]]; then + # Run the i686 container if there are non-package changed files, + # but otherwise do not run the i686 container if there are no packages compatible with i686. + exit 0 + fi + sudo docker run \ + --platform $PLATFORM \ + -v "${{ github.workspace }}/tests/unit_test.sh:/unit_test.sh" \ + -u chronos \ + -e CHANGED_PACKAGES="$CHANGED_PACKAGES" \ + -e LD_LIBRARY_PATH="/usr/local/lib$LIB_SUFFIX" \ + -e CREW_REPO="${{ github.event.pull_request.head.repo.clone_url }}" \ + -e CREW_BRANCH="${{ github.head_ref }}" \ + "satmandu/crewbuild:$CONTAINER" \ + /usr/local/bin/bash /unit_test.sh diff --git a/packages/handbrake.rb b/packages/handbrake.rb index 65f8709eaa..cae3857f9b 100644 --- a/packages/handbrake.rb +++ b/packages/handbrake.rb @@ -3,7 +3,7 @@ require 'package' class Handbrake < Package description 'HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs.' homepage 'https://handbrake.fr/' - version '1.8.1' + version '1.8.2' license 'GPL-2' compatibility 'x86_64' min_glibc '2.37' @@ -12,7 +12,7 @@ class Handbrake < Package binary_compression 'tar.zst' binary_sha256({ - x86_64: '8d64386da999ddee0aac087d2b7275062e59cc37acb06a8504ab0290492eb46b' + x86_64: '7da9a4ce810f30c1128cf80e808d0136051a5dfca4e851671474aca993384278' }) depends_on 'at_spi2_core' # R @@ -25,8 +25,10 @@ class Handbrake < Package depends_on 'fribidi' # R depends_on 'gcc_lib' # R depends_on 'gdk_pixbuf' # R + depends_on 'glibc_lib' # R depends_on 'glibc' # R depends_on 'glib' # R + depends_on 'graphene' # R depends_on 'gstreamer' # R depends_on 'gtk4' # R depends_on 'harfbuzz' # R @@ -34,6 +36,7 @@ class Handbrake < Package depends_on 'intel_media_sdk' depends_on 'jansson' # R depends_on 'libass' # R + depends_on 'libdrm' # R depends_on 'libdvdcss' depends_on 'libgudev' # R depends_on 'libjpeg_turbo' # R @@ -52,9 +55,11 @@ class Handbrake < Package depends_on 'onevpl' # R depends_on 'opus' # R depends_on 'pango' # R + depends_on 'rust' => :build depends_on 'speex' # R depends_on 'util_linux' # R depends_on 'vulkan_headers' => :build + depends_on 'vulkan_icd_loader' # R depends_on 'wayland_protocols' => :build depends_on 'xcb_util' => :build depends_on 'xzutils' # R @@ -67,17 +72,15 @@ class Handbrake < Package # with a libtool error. FileUtils.ln_sf "#{CREW_LIB_PREFIX}/libfribidi.la", "#{CREW_PREFIX}/lib/" - unless Dir.exist? 'x86_64-cros-linux-gnu' - system "LDFLAGS+=' -L #{CREW_LIB_PREFIX}' ./configure #{CREW_OPTIONS} \ - --enable-x265 \ - --enable-numa \ - --enable-fdk-aac \ - --enable-qsv \ - --no-harden \ - --force" - end - FileUtils.mkdir_p 'x86_64-cros-linux-gnu/contrib/lib/pkgconfig' - Dir.chdir('x86_64-cros-linux-gnu/contrib/lib/pkgconfig') do + system "LDFLAGS+=' -L #{CREW_LIB_PREFIX}' ./configure #{CREW_OPTIONS} \ + --enable-x265 \ + --enable-numa \ + --enable-fdk-aac \ + --enable-qsv \ + --no-harden \ + --force" + FileUtils.mkdir_p 'build/contrib/lib/pkgconfig' + Dir.chdir('build/contrib/lib/pkgconfig') do @handbrake_libs = %w[glib-2.0 fribidi harfbuzz freetype2] @handbrake_libs.each do |f| next if File.file?("#{f}.pc") @@ -85,14 +88,14 @@ class Handbrake < Package FileUtils.ln_sf "#{CREW_LIB_PREFIX}/pkgconfig/#{f}.pc", "#{f}.pc" end end - system 'make -C x86_64-cros-linux-gnu || make -j1 -C x86_64-cros-linux-gnu' + system 'make -C build || make -j1 -C build' # Remove temporarily created symlink for libfribidi.la. FileUtils.rm_f "#{CREW_PREFIX}/lib/libfribidi.la" end def self.install - Dir.chdir 'x86_64-cros-linux-gnu' do + Dir.chdir 'build' do system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install' end FileUtils.mkdir_p "#{CREW_DEST_PREFIX}/bin"