From 1a764cfbe2bf50656de503dc78047f85544a0c0f Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Thu, 19 Dec 2024 17:28:31 +0100 Subject: [PATCH] remove df and free commands + install local dependency only if it doesn't exists on the debian repo --- .github/workflows/perl-cpan-libraries.yml | 31 ++++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/perl-cpan-libraries.yml b/.github/workflows/perl-cpan-libraries.yml index 78116f9dc9..8287c39502 100644 --- a/.github/workflows/perl-cpan-libraries.yml +++ b/.github/workflows/perl-cpan-libraries.yml @@ -657,8 +657,6 @@ jobs: continue fi echo "Installing package: $package" - echo $(df -h) - echo $(free -h) # List dependencies dependencies=$(dpkg-deb -I $package | grep Depends | sed 's/Depends: //' | sed 's/,//g' | sed 's/(\(.*\)//g') || { echo "$error_output" >> $error_log; echo "Error while listing dependencies of the package $package" >> $error_log; true; } for dependency in $dependencies; do @@ -666,31 +664,28 @@ jobs: if [[ $dependency != lib*-perl ]]; then continue fi - # If the dependency has been built in the same workflow, install it - for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do - echo "Installing dependency: $dependency_package" - echo $(dpkg-deb --info $package) - error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } - done + # If the dependency exists in the Debian repository, don't check the local dependencies + dependency_info=$(apt-cache policy $dependency) + if [[ -n $dependency_info ]]; then + echo "Dependency exists in debian repository." + continue + else + # If the dependency has been built in the same workflow, install it + for dependency_package in $(find . -maxdepth 1 -regex "\.\/${dependency}_[0-9].*all\.deb" -o -regex "\.\/${dependency}_[0-9].*${{ matrix.arch }}\.deb"); do + echo "Installing dependency: $dependency_package" + echo $(dpkg-deb --info $package) + error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y ./$dependency_package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the dependency $dependency" >> $error_log; true; } + done + fi done - echo $(df -h) - echo $(free -h) # Install package, then uninstall it with all his dependencies echo "Package installation..." echo $(dpkg-deb --info $package) error_output=$(apt-get -o Debug::pkgProblemResolver=true -o Debug::dpkg=true -o Debug::pkgDepCache::Marker=true install -y $package 2>&1) || { echo "$error_output" >> $error_log; echo "Error during installation of the package $package" >> $error_log; true; } echo "Package installation done." - echo $(df -h) - echo $(free -h) echo "Package uninstallation..." error_output=$(apt-get autoremove -y --purge $(echo $package | sed 's/_[0-9].*\.deb//' | sed 's/.\///') 2>&1) || { echo "$error_output" >> $error_log; echo "Error during autoremove of the package $package" >> $error_log; true; } echo "Package uninstallation done." - echo $(df -h) - echo $(free -h) - apt-get clean - apt-get update - echo $(df -h) - echo $(free -h) done # If the file error_log exists and is not empty, the workflow is in error if [[ -s $error_log ]]; then