awalsh128 / cache-apt-pkgs-action

Cache APT packages in GitHub Actions
Other
205 stars 35 forks source link

"Packages argument cannot be empty." even if `PACKAGES` is set. #116

Closed koppor closed 12 months ago

koppor commented 12 months ago

I ran following

      - name: Setup ctanify requirements
        uses: awalsh128/cache-apt-pkgs-action@latest
        with:
          packages: libfile-copy-recursive-perl
          debug: true
          version: 1.0

I get following output

 ${GITHUB_ACTION_PATH}/pre_cache_action.sh \
    ~/cache-apt-pkgs \
    "$VERSION" \
    "$EXEC_INSTALL_SCRIPTS" \
    "$DEBUG" \
    "$PACKAGES"
  echo "CACHE_KEY=$(cat ~/cache-apt-pkgs/cache_key.md5)" >> $GITHUB_ENV
  shell: bash --noprofile --norc -e -o pipefail {0}
  env:
    VERSION: 1
    EXEC_INSTALL_SCRIPTS: false
    DEBUG: true
    PACKAGES: libfile-copy-recursive-perl
realpath: --: No such file or directory
+ cache_dir=/github/home/cache-apt-pkgs
+ version=1
+ execute_install_scripts=false
+ debug=true
+ input_packages=libfile-copy-recursive-perl
++ get_normalized_package_list libfile-copy-recursive-perl
+++ echo libfile-copy-recursive-perl
+++ sed 's/[,\]/ /g; s/\s\+/ /g; s/^\s\+//g; s/\s\+$//g'
+++ sort '-t '
++ packages=libfile-copy-recursive-perl
++ log_err 'resolving package versions...'
+++ date +%T.%3N
++ echo 19:46:34. 'resolving package versions...'
19:46:34. resolving package versions...
+++ apt-cache --quiet=0 --no-all-versions show libfile-copy-recursive-perl
+++ grep -E '^(Package|Version|N):'
++ data=
++ log_err resolved
+++ date +%T.%3N
++ echo 19:46:34. resolved
19:46:34. resolved
++ local 'ORIG_IFS=     
'
++ IFS='
'
++ declare -A missing
++ local package_versions=
++ local package= separator=
++ IFS='    
'
++ '[' 0 -gt 0 ']'
++ echo ''
+ packages=
+ mkdir -p /github/home/cache-apt-pkgs
+ log 'Validating action arguments (version='\''1'\'', packages='\'''\'')...'
++ date +%T.%3N
+ echo 19:46:34. 'Validating action arguments (version='\''1'\'', packages='\'''\'')...'
19:46:34. Validating action arguments (version='1', packages='')...
+ grep -q ' '
+ test -z ''
+ log aborted
++ date +%T.%3N
+ echo 19:46:34. aborted
19:46:34. aborted
+ log 'Packages argument cannot be empty.'
++ date +%T.%3N
+ echo 19:46:34. 'Packages argument cannot be empty.'
19:46:34. Packages argument cannot be empty.
+ exit 3

Why does it say

    PACKAGES: libfile-copy-recursive-perl

But fails with

19:46:34. Packages argument cannot be empty.

On a random Ubuntu machine, the output of apt-cache show is as follows

# apt-cache --quiet=0 --no-all-versions show libfile-copy-recursive-perl
Package: libfile-copy-recursive-perl
Architecture: all
Version: 0.45-1
Priority: optional
Section: universe/perl
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 48
Depends: perl
Filename: pool/universe/libf/libfile-copy-recursive-perl/libfile-copy-recursive-perl_0.45-1_all.deb
Size: 17252
MD5sum: 162971ea438eefd47fa3a6740ed482a2
SHA1: 01895634a8c4c527686de7a222463dc00e48e3ae
SHA256: e8878ff9eb1f84026daa5186f9c75fb3e2b8730775748eb834dd357e6abe3f64
SHA512: 09061b4b3a0a4d9f454902d84d3d86d6a3a34004224b01e4f2e6f7531dc9da757013f3314cfc683bdc9aeac99466e56f9b524ad63e54c7c2852405ac771ce988
Homepage: https://metacpan.org/release/File-Copy-Recursive
Description-en: Perl extension for recursively copying files and directories
 File::Copy::Recursive module copies and moves directories recursively
 (or single files, well... singley) to an optional depth and attempts
 to preserve each file or directory's mode.
Description-md5: a107442d1b00e794c7a17b73e1706430

The requested package exists: https://packages.debian.org/buster/libfile-copy-recursive-perl


PR is https://github.com/gi-ev/biblatex-lni/pull/22


There should be at least some hint in the README.md what to do if "Packages argument cannot be empty." is shown.

awalsh128 commented 12 months ago

Hi @koppor, the reason it doesn't give an informative message is because this is an unexpected scenario. Normally that message is when the user has put in empty packages as an arg.

I believe this bug was introduced in PR 104 and v1.3.0 will not contain this error. I have some time today and am going to try and get it all resolved since it is fairly outstanding.

From the output you posted it looks like it couldn't grab any of the package info.

+++ apt-cache --quiet=0 --no-all-versions show libfile-copy-recursive-perl
+++ grep -E '^(Package|Version|N):'
++ data=

Although a local run of the function get_normalized_package_list libfile-copy-recursive-perl produces

+++ apt-cache --quiet=0 --no-all-versions show libfile-copy-recursive-perl
+++ grep -E '^(Package|Version|N):'
++ data='Package: libfile-copy-recursive-perl
Version: 0.45-1'

I am curious to see what apt-cache --quiet=0 --no-all-versions show libfile-copy-recursive-perl produces on your runner. Can you link to your action file that you are using?

koppor commented 12 months ago

Thank you for the quick reply @awalsh128.

It is a no-issue, because the workflow does not run on Ubuntu. I am very sorry for the noise!

Deep link to the usage of a docker image: https://github.com/gi-ev/biblatex-lni/blob/59ca278df4b2d489d33f0723eab81d129fc168bf/.github/workflows/check.yml#L33