Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should Carton::Snapshot be included in the fatpack? #179

Open
guest20 opened this issue Jul 22, 2020 · 3 comments
Open

Should Carton::Snapshot be included in the fatpack? #179

guest20 opened this issue Jul 22, 2020 · 3 comments

Comments

@guest20
Copy link

guest20 commented Jul 22, 2020

It seems strange that I'd get an error from cpm telling me to install a module so that it can read the list of modules I want it to install:

die "To load $self->{snapshot}, you need to install Carton::Snapshot.\n";

To me it would make some sense to bundle Carton::Snapshot into the fatpacked version of cpm.

@guest20
Copy link
Author

guest20 commented Jul 22, 2020

For reference i've got a cpm in vendor/ in my repo, so my Dockerfile is just

COPY vendor/cpm /bin/cpm
COPY cpanfile* /app/
RUN cd /app && cpm install

personally I'd expect cpm to either completely ignore the cpanfile.snapshot or automatically support it.

@jjatria
Copy link

jjatria commented Aug 30, 2022

I agree with the sentiment here. The only reason I can come up with is that Carton requires 5.8.5 and App::cpm targets 5.8.1, but surely this is a bump we can make? 5.8.5 was released in 2004.

If that's not an option, perhaps we can have an easier way to build that ourselves? I'm thinking something like this:

index 6153f05..4a2a58c 100644
--- a/author/fatpack.pl
+++ b/author/fatpack.pl
@@ -20,14 +20,17 @@ Show new dependencies
 
 =cut
 
+my %cli_options;
+
 Getopt::Long::GetOptions
     "f|force" => \my $force,
     "t|test" => \my $test,
     "u|update-only" => \my $update_only,
+    "with-recommends" => \( $cli_options{with_recommends} ),
 or exit 1;
 
 sub cpm {
-    App::cpm::CLI->new->run(@_) == 0 or die
+    App::cpm::CLI->new(%cli_options)->run(@_) == 0 or die
 }
 
 sub fatpack {
@@ -97,7 +100,7 @@ my $exclude = join ",", qw(
     URI
 );
 
-my $target = '5.8.1';
+my $target = $cli_options{with_recommends} ? '5.8.5' : '5.8.1';
 
 my ($git_describe, $git_url);
 if (my $version = $ENV{CPAN_RELEASE_VERSION}) {

which would mean we can run author/fatpack.pl --with-recommends --force to generate a version that includes Carton::Snapshot (and whatever else gets recommended in the future). @skaji, would you accept something like that as a PR?

@fgimian
Copy link

fgimian commented Aug 17, 2023

This would be really handy for us too. Or at least the option of downloading a fatpack cpm without Carton::Snapshot and one with it included (if file size is a factor). As it stands today for example, the official perl Docker images which include the fatpack can't install dependencies when a snapshot is present out of the box.

Huge love and thanks
Fotis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants