Open hurricup opened 1 year ago
I'm late in responding, but I responded with the following commit. Please check. https://github.com/ouest/asdf-perl/commit/e49d5066af159b7bd43a665d4b3b3dae61ae72b6
Something broken in last 24 hours. See: https://github.com/Camelcade/Perl5-IDEA/actions
In: https://github.com/Camelcade/Perl5-IDEA/actions/runs/4587619448/jobs/8101343504
git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 && ~/.asdf/bin/asdf plugin add perl || ~/.asdf/bin/asdf update
bash -c '~/.asdf/bin/asdf install perl 5.[3](https://github.com/Camelcade/Perl5-IDEA/actions/runs/4587619448/jobs/8101343504#step:5:3)6.0 --noman -j 8 || true'
~/.asdf/bin/asdf exec cpan install App::cpanminus
~/.asdf/bin/asdf exec cpanm --notest Mojolicious HURRICUP/Devel-Camelcadedb-v2023.1.tar.gz Devel::Cover JSON App::Prove::Plugin::PassEnv TAP::Formatter::Camelcade Devel::NYTProf Perl::Tidy Perl::Critic B::Debug Types::Serialiser
~/.asdf/bin/asdf reshim perl
Getting
...
---> Successfully installed perl 5.36.0
/Users/runner/.asdf/plugins/perl/bin/install: line 94: asdf: command not found
unknown command: cpan. Perhaps you have to reshim?
Error: Process completed with exit code 1.
You definitely need to make tests for your project.
In https://github.com/ouest/asdf-perl/commit/e49d5066af159b7bd43a665d4b3b3dae61ae72b6 you are running reshim
after perl installation, but this is not what ticket about. I guess asdf
does reshim after install
command by itself.
asdf reshim
should be run after running cpan
or cpanm
shims somehow.
Also seems it should be done in more sophisticated way.
Ruby plugin does this by patching environment for exec
command and injecting patch for rubygems
, see: https://github.com/asdf-vm/asdf-ruby/blob/master/bin/exec-env and https://github.com/asdf-vm/asdf-ruby/blob/master/rubygems-plugin/rubygems_plugin.rb
Here is information about testing on GHA: https://github.com/asdf-vm/actions#plugin-test
It was fine when we tested it here, but very sorry. https://github.com/ouest/asdf-perl/actions/runs/4587346393
For now, I have rescinded it with the following commit. https://github.com/ouest/asdf-perl/commit/f1b20400f2e15f20f5c09a93331b4e0a832e06c1
By the way, am I right in thinking that the following code is failing? https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L100
If I am correct in that understanding, I don't need to install cpanm with cpan because asdf perl installs cpanm, right? https://github.com/ouest/asdf-perl/blob/main/bin/install#L92 https://github.com/ouest/asdf-perl/blob/main/bin/install#L39-L44
It was fine when we tested it here, but very sorry. https://github.com/ouest/asdf-perl/actions/runs/4587346393 For now, I have rescinded it with the following commit. f1b2040
Oh, you've added actions!!! Nice!!!
By the way, am I right in thinking that the following code is failing? https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L100
No. install
command fails because of this last line with asdf reshim
If I am correct in that understanding, I don't need to install cpanm with cpan because asdf perl installs cpanm, right? https://github.com/ouest/asdf-perl/blob/main/bin/install#L92 https://github.com/ouest/asdf-perl/blob/main/bin/install#L39-L44
I didn't know that it does and didn't expect it.
Thanks for your reply.
No. install command fails because of this last line with asdf reshim
https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L99-L102 For example, if you changed the above section to the following, would it not work correctly?
~/.asdf/bin/asdf global perl ${{ env.PERL_TEST_VERSION }}
~/.asdf/bin/asdf exec cpanm --notest ${{ env.TEST_PERL_MODULES }}
Perl version is set there https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L95 and install command fails, not the next one.
bash -c '~/.asdf/bin/asdf install perl ${{ env.PERL_TEST_VERSION }} --noman -j 8 || true'
Unlike plenv, asdf cannot use that version of cpanm unless after doing asdf global perl 5.8.9.
https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L97-L101 For example, the following code, similar to the above, will succeed when executed on a bare Ubuntu.
apt update >/dev/null 2>&1 \
&& apt install -y git curl build-essential >/dev/null 2>&1 \
&& git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf plugin add perl >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf install perl 5.8.9 --noman -j 8 || true \
&& ~/.asdf/bin/asdf global perl 5.8.9 \
&& ~/.asdf/bin/asdf exec cpanm --notest File::Slurp
Below is a log from a bare-bones Ubuntu run with Docker.
$ docker run -it --name test ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
2ab09b027e7f: Pull complete
Digest: sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21
Status: Downloaded newer image for ubuntu:latest
root@63af7490544d:/# apt update >/dev/null 2>&1 \
&& apt install -y git curl build-essential >/dev/null 2>&1 \
&& git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf plugin add perl >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf install perl 5.8.9 --noman -j 8 || true \
&& ~/.asdf/bin/asdf global perl 5.8.9 \
&& ~/.asdf/bin/asdf exec cpanm --notest File::Slurp
Downloading perl-install...
Cloning into '/root/.asdf/plugins/perl/perl-install'...
remote: Enumerating objects: 429, done.
remote: Counting objects: 100% (429/429), done.
remote: Compressing objects: 100% (188/188), done.
remote: Total 429 (delta 275), reused 358 (delta 232), pack-reused 0
Receiving objects: 100% (429/429), 129.01 KiB | 3.07 MiB/s, done.
Resolving deltas: 100% (275/275), done.
perl-install -j=16 5.8.9 /root/.asdf/installs/perl/5.8.9
---> Using work directory /tmp/perl-install-1680588588.3890
---> Downloading https://cpan.metacpan.org/authors/id/N/NW/NWCLARK/perl-5.8.9.tar.gz
---> Unpacking /tmp/perl-install-1680588588.3890/perl-5.8.9.tar.gz
---> Applying Devel::PatchPerl 2.08 (patchperl-extracted 0.0.2)
---> Building perl 5.8.9
---> See /tmp/perl-install-1680588588.3890/build.log for progress
---> ./Configure -des -Dprefix=/root/.asdf/installs/perl/5.8.9 -Dscriptdir=/root/.asdf/installs/perl/5.8.9/bin -Dman1dir=none -Dman3dir=none
---> make --jobs=16
---> make install
---> Successfully installed perl 5.8.9
--> Working on File::Slurp
Fetching http://www.cpan.org/authors/id/C/CA/CAPOEIRAB/File-Slurp-9999.32.tar.gz ... OK
==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.70.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.70 ... OK
Building ExtUtils-MakeMaker-7.70 ... OK
Successfully installed ExtUtils-MakeMaker-7.70 (upgraded from 6.48)
Configuring File-Slurp-9999.32 ... OK
Building File-Slurp-9999.32 ... OK
Successfully installed File-Slurp-9999.32
2 distributions installed
root@63af7490544d:/#
I hope I am communicating my intentions correctly.
Setting environment variable mimics asdf shell
not asdf global
I'm not sure why do we discuss my configuration which was working.
It is correct and it is work.
Your change does not work because it is implies that asdf
is available in PATH
or as a shell funciton. But it is not. And it still should work. I believe that asdf sets some env variables with asdf home path or something and you should use them when running something.
And again - you don't need to reshim after perl installation.
I'm very sorry. I had overlooked the following. https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L95
https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L97-L102 The following code, similar to the above, successfully installed File::Slurp.
export ASDF_PERL_VERSION=5.8.9 && (apt update >/dev/null 2>&1 \
&& apt install -y git curl build-essential >/dev/null 2>&1 \
&& git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf plugin add perl >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf install perl 5.8.9 --noman -j 8 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf exec cpanm --notest File::Slurp)
Below is the log.
$ docker run -it --name test ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
2ab09b027e7f: Pull complete
Digest: sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21
Status: Downloaded newer image for ubuntu:latest
root@96e262a8975b:/# export ASDF_PERL_VERSION=5.8.9 && (apt update >/dev/null 2>&1 \
&& apt install -y git curl build-essential >/dev/null 2>&1 \
&& git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf plugin add perl >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf install perl 5.8.9 --noman -j 8 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf exec cpanm --notest File::Slurp)
--> Working on File::Slurp
Fetching http://www.cpan.org/authors/id/C/CA/CAPOEIRAB/File-Slurp-9999.32.tar.gz ... OK
==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.70.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.70 ... OK
Building ExtUtils-MakeMaker-7.70 ... OK
Successfully installed ExtUtils-MakeMaker-7.70 (upgraded from 6.48)
Configuring File-Slurp-9999.32 ... OK
Building File-Slurp-9999.32 ... OK
Successfully installed File-Slurp-9999.32
2 distributions installed
Given the above, the error that is occurring now seems to be that ASDF_PERL_VERSION is not set in the following line. // Not sure why ASDF_PERL_VERSION is not set. https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L101 Therefore, you may want to try the following.
ASDF_PERL_VERSION=${{ env.PERL_TEST_VERSION }} ~/.asdf/bin/asdf exec cpanm --notest ${{ env.TEST_PERL_MODULES }}
I'm sorry, I still don't get what are you trying to explain to me. It works after https://github.com/ouest/asdf-perl/commit/f1b20400f2e15f20f5c09a93331b4e0a832e06c1
My English is poor, so I apologize for the lack of clarity.
I believe the following code should work fine except for line 99.
https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml#L94-L101
However, given that it is not actually working, I assume that ASDF_PERL_VERSION is not passed properly in line 100.
Therefore, why not explicitly specify ASDF_PERL_VERSION=${{ env.PERL_TEST_VERSION }}
at line 100?
I'm not an english speaker as well, so no problems :)
why do you think that something is not passed properly anywhere? Everything is fine with the script. The only issue we have now that your plugin need to reshim somehow after running cpan/cpanm
I'm not an english speaker as well, so no problems :)
Thanks.
why do you think that something is not passed properly anywhere?
The reason I don't think it is crossing over well is that cpanm is successfully kicking in the following code. The code below is the same as the code I sent you the other day.
$ docker run -it --name test ubuntu /bin/bash
Unable to find image 'ubuntu:latest' locally
latest: Pulling from library/ubuntu
2ab09b027e7f: Pull complete
Digest: sha256:67211c14fa74f070d27cc59d69a7fa9aeff8e28ea118ef3babc295a0428a6d21
Status: Downloaded newer image for ubuntu:latest
root@96e262a8975b:/# export ASDF_PERL_VERSION=5.8.9 && (apt update >/dev/null 2>&1 \
&& apt install -y git curl build-essential >/dev/null 2>&1 \
&& git clone --depth 1 https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.2 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf plugin add perl >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf install perl 5.8.9 --noman -j 8 >/dev/null 2>&1 \
&& ~/.asdf/bin/asdf exec cpanm --notest File::Slurp)
--> Working on File::Slurp
Fetching http://www.cpan.org/authors/id/C/CA/CAPOEIRAB/File-Slurp-9999.32.tar.gz ... OK
==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching http://www.cpan.org/authors/id/B/BI/BINGOS/ExtUtils-MakeMaker-7.70.tar.gz ... OK
Configuring ExtUtils-MakeMaker-7.70 ... OK
Building ExtUtils-MakeMaker-7.70 ... OK
Successfully installed ExtUtils-MakeMaker-7.70 (upgraded from 6.48)
Configuring File-Slurp-9999.32 ... OK
Building File-Slurp-9999.32 ... OK
Successfully installed File-Slurp-9999.32
2 distributions installed
This code has been installed on bare Ubuntu in the following order and all have been successful
No need to reshim with asdf-perl, I thought ASDF_PERL_VERSION was not set when running ~/.asdf/bin/asdf exec cpanm
.
I created a simple GitHub workflow here and tried it, and was able to successfully install a Perl module with cpam without reshim. https://github.com/ouest/test-asdf-perl/blob/main/.github/workflows/test.yml https://github.com/ouest/test-asdf-perl/actions/runs/4644325253
I'm wondering if there might be something wrong with https://github.com/Camelcade/Perl5-IDEA/blob/master/.github/workflows/_tests.yml
Just checked on clean ubuntu:22.04 image:
# install asdf and perl 5.36 and run following:
export ASDF_PERL_VERSION=5.36.0
~/.asdf/bin/asdf exec cpanm Carton
~/.asdf/bin/asdf exec carton -v
# get:
unknown command: carton. Perhaps you have to reshim?
# run
~/.asdf/bin/asdf reshim perl
~/.asdf/bin/asdf exec carton -v
# get
carton v1.0.35
Sorry for the late reply.
I misunderstood a lot of things, but you want to automatically reshim the executable script scripts that accompany the Perl modules installed by cpanm.
I don't think this is feasible in Perl, as even plenv has the following statement.
# run this command after install cpan module, contains executable script.
plenv rehash
I am not familiar with Ruby, but I think it is possible in Ruby because it has a function called spec.executables, which can override Bundler::Installer.
I'm not sure how it works, but more or less it does for asdf ruby, rbenv and plenv. But with asdf perl i need to run reshim manually.