From 7966cc0ec86a0cc4c8b7479fabba56874263681c Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 27 Feb 2025 15:37:38 +0100 Subject: [PATCH] Add fix for version --- .github/actions/test-cpan-libs/action.yml | 2 +- .github/workflows/perl-cpan-libraries.yml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/test-cpan-libs/action.yml b/.github/actions/test-cpan-libs/action.yml index bbaff3a562..779fbf45a9 100644 --- a/.github/actions/test-cpan-libs/action.yml +++ b/.github/actions/test-cpan-libs/action.yml @@ -18,7 +18,7 @@ runs: - if: ${{ inputs.package_extension == 'rpm' }} name: Install zstd, perl and Centreon repositories run: | - dnf install -y zstd perl epel-release 'dnf-command(config-manager)' cpanminus + dnf install -y zstd perl epel-release 'dnf-command(config-manager)' perl-App-cpanminus dnf config-manager --set-enabled powertools || true # alma 8 dnf config-manager --set-enabled crb || true # alma 9 # Import Centreon GPG key diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 7e96b06ada..7faa6fff40 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -53,7 +53,7 @@ jobs: "Device::Modbus::RTU::Client", "Device::Modbus::TCP::Client", "Email::Send::SMTP::Gmail", - "Exporter::Tiny", + "Exporter::Tiny", # Required by JSON::Path: the version available in the official repositories doesn't work with the last version of JSON::Path "FFI::CheckLib", "FFI::Platypus", "File::SearchPath", @@ -167,7 +167,7 @@ jobs: run: | cpan_info=$(cpanm --info ${{ matrix.name }}) if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') + CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//') if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" exit 1 @@ -190,7 +190,7 @@ jobs: do_not_build="false" if [[ ! $package_info =~ "no matches found" ]]; then package_version=$(echo $package_info | grep -oP "perl\($(echo ${{ matrix.name }} | tr '[:upper:]' '[:lower:]')\) = \K[0-9]+\.[0-9]+") - if [[ "$package_version" == "${{ steps.package-infos.outputs.package_version }}" ]]; then + if [[ "$package_version" == "${{ steps.package-infos.outputs.package_version }}" || "v$package_version" == "${{ steps.package-infos.outputs.package_version }}" ]]; then echo "::warning::Package ${{ matrix.name }} already exists in the official ${{ matrix.distrib }} repository with the same version." do_not_build="true" else @@ -472,7 +472,7 @@ jobs: apt-get update cpan_info=$(cpanm --info ${{ matrix.name }}) if [ -z "${{ matrix.version }}" ]; then - CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//' | sed 's/v//') + CPAN_PACKAGE_VERSION=$(echo $cpan_info | sed 's/\.tar\.gz$//' | sed 's/.*\-//') if [[ ! $CPAN_PACKAGE_VERSION =~ ^[0-9]+\.[0-9]+ ]]; then echo "::error::Invalid version number: ${CPAN_PACKAGE_VERSION}" exit 1 @@ -498,7 +498,7 @@ jobs: do_not_build="false" if [[ -n $package_info ]]; then candidate_version=$(echo "$package_info" | grep 'Candidate:' | awk '{print $2}') - if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then + if [[ "$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* || "v$candidate_version" == "${{ steps.package-infos.outputs.package_version }}"* ]]; then echo "::warning::Package ${{ steps.package-infos.outputs.package_name }} already exists in the official ${{ matrix.distrib }} repository with the same version." do_not_build="true" else