Skip to content

Commit

Permalink
Move installations in docker image + check package existence for rpms
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepassio committed Dec 31, 2024
1 parent 8b3d5d4 commit 1191b0d
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 35 deletions.
14 changes: 13 additions & 1 deletion .github/docker/packaging/Dockerfile.packaging-plugins-alma8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion .github/docker/packaging/Dockerfile.packaging-plugins-alma9
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 19 additions & 33 deletions .github/workflows/perl-cpan-libraries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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=""
Expand Down Expand Up @@ -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}
Expand All @@ -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: |
Expand All @@ -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 }}
Expand Down Expand Up @@ -350,7 +337,6 @@ jobs:
- rpm_provides: ""
- version: ""
- use_dh_make_perl: "true"
- spec_file: ""
- distrib: bullseye
package_extension: deb
image: packaging-plugins-bullseye
Expand Down

0 comments on commit 1191b0d

Please sign in to comment.