From 1191b0d72333c51bdfad185357d2c15162e6c53a Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Tue, 31 Dec 2024 16:05:10 +0100 Subject: [PATCH] Move installations in docker image + check package existence for rpms --- .../Dockerfile.packaging-plugins-alma8 | 14 ++++- .../Dockerfile.packaging-plugins-alma9 | 14 ++++- .github/workflows/perl-cpan-libraries.yml | 52 +++++++------------ 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 index e9fe67b494..c320444449 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 @@ -10,10 +10,22 @@ baseurl=https://repo.goreleaser.com/yum/ enabled=1 gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo -dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel +dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel yum-utils +dnf config-manager --set-enabled powertools dnf -y install perl-App-cpanminus perl-JSON cpanm App::FatPacker cpanm File::Copy::Recursive + +# For cpan libs +dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +cpanm Module::Build::Tiny +cpanm Module::Install +# Install fpm (ruby 3 is required) +dnf module reset -y ruby +dnf module enable -y ruby:3.1 +dnf install -y ruby ruby-devel +gem install fpm + dnf clean all EOF diff --git a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 index 23bd219eb5..18db17cdcb 100644 --- a/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 +++ b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 @@ -10,10 +10,22 @@ baseurl=https://repo.goreleaser.com/yum/ enabled=1 gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo -dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel +dnf -y install gcc git gettext rpm-build dos2unix python3 epel-release nfpm-2.41.0 openssl-devel jq zstd selinux-policy-devel yum-utils +dnf config-manager --set-enabled crb dnf -y install perl-App-cpanminus perl-JSON cpanm App::FatPacker cpanm File::Copy::Recursive + +# For cpan libs +dnf install -y libcurl-devel libssh-devel expat-devel libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny +cpanm Module::Build::Tiny +cpanm Module::Install +# Install fpm (ruby 3 is required) +dnf module reset -y ruby +dnf module enable -y ruby:3.1 +dnf install -y ruby ruby-devel +gem install fpm + dnf clean all EOF diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index ef7614f11c..328dc2d10e 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -149,35 +149,25 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + name: Check if package already exists + id: check-package-existance run: | - yum install -y yum-utils epel-release git - yum config-manager --set-enabled crb || true # alma 9 - yum config-manager --set-enabled powertools || true # alma 8 - yum install -y cpanminus rpm-build libcurl-devel libssh-devel expat-devel gcc libuuid-devel zeromq-devel libxml2-devel libffi-devel perl-DBI perl-Net-Pcap freetds freetds-devel perl-Module-Build-Tiny - - dnf module reset -y ruby - dnf module enable -y ruby:3.1 - dnf install -y ruby ruby-devel - shell: bash - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - with: - repository: kduret/fpm - ref: fix-rpm-perl-dependency-name-unchanged - path: fpm - - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} - name: Build and install fpm # waiting https://github.com/jordansissel/fpm/pull/2066 - run: | - dnf install -y bsdtar - cd fpm - gem install bundler - bundle install - make install + package_search=$(dnf provides 'perl('${{ matrix.name }}') 2>&1) + do_not_build="false" + if [[ $package_search =~ "No Matches found" ]]; then + package_version=$(echo $package_info | grep -oP 'perl\(DBI\) = \K[0-9]+\.[0-9]+') + if [[ -z "${{ matrix.version }}" || "$package_version" == "${{ matrix.version }}" ]]; then + echo "::warning::Package ${{ matrix.name }} already exists in the official ${{ matrix.distrib }} repository with the same version." + do_not_build="true" + else + echo "::warning::Package ${{ matrix.name }} exists in the official ${{ matrix.distrib }} repository with a different version." + do_not_build="false" + fi + fi + echo "do_not_build=$do_not_build" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file == '' }} run: | if [ -z "${{ matrix.version }}" ]; then PACKAGE_VERSION="" @@ -205,15 +195,12 @@ jobs: done fi - cpanm Module::Build::Tiny - cpanm Module::Install - export SYBASE="/usr" fpm -s cpan -t ${{ matrix.package_extension }} --rpm-dist ${{ matrix.distrib }} --verbose --cpan-verbose --no-cpan-test$PACKAGE_DEPENDENCIES$PACKAGE_PROVIDES$PACKAGE_VERSION ${{ matrix.name }} shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) && matrix.spec_file != '' }} run: | mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} @@ -222,7 +209,7 @@ jobs: cp -r ~/rpmbuild/RPMS/noarch/*.rpm . shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} name: Replace '::' with - in the feature path id: package-name run: | @@ -232,7 +219,7 @@ jobs: echo "name_with_dash=$name_with_dash" >> $GITHUB_OUTPUT shell: bash - - if: ${{ contains(matrix.build_distribs, matrix.distrib) }} + - if: ${{ steps.check-package-existance.outputs.do_not_build == 'false' && contains(matrix.build_distribs, matrix.distrib) }} uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: packages-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ steps.package-name.outputs.name_with_dash }} @@ -350,7 +337,6 @@ jobs: - rpm_provides: "" - version: "" - use_dh_make_perl: "true" - - spec_file: "" - distrib: bullseye package_extension: deb image: packaging-plugins-bullseye