Skip Menu |

This queue is for tickets about the Dist-Zilla-Plugin-CopyFilesFromBuild CPAN distribution.

Report information
The Basics
Id: 92828
Status: open
Priority: 0/
Queue: Dist-Zilla-Plugin-CopyFilesFromBuild

People
Owner: Nobody in particular
Requestors: NGLENN [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: dzil dies when files are added multiple times
I happily used this module to copy a README, LICENSE, and cpanfile into my project root. However, the next time I ran dzil build, dzil died because it grabbed the files from the project root and then tried to add them again through this plugin. Here are the messages I got: [DZ] attempt to add cpanfile multiple times; added by: GatherDir (Dist::Zilla::Plugin::GatherDir line 100); CPANFile (Dist::Zilla::Plugin::CPANFile line 65) [DZ] attempt to add LICENSE multiple times; added by: GatherDir (Dist::Zilla::Plugin::GatherDir line 100); License (Dist::Zilla::Plugin::License line 22) [DZ] attempt to add Makefile.PL multiple times; added by: GatherDir (Dist::Zilla::Plugin::GatherDir line 100); MakeMaker (Dist::Zilla::Plugin::MakeMaker line 25 2)
On Fri Feb 07 18:59:56 2014, NGLENN wrote: Show quoted text
> I happily used this module to copy a README, LICENSE, and cpanfile > into my project root. However, the next time I ran dzil build, dzil > died because it grabbed the files from the project root and then tried > to add them again through this plugin. Here are the messages I got: > > [DZ] attempt to add cpanfile multiple times; added by: GatherDir > (Dist::Zilla::Plugin::GatherDir line 100); CPANFile > (Dist::Zilla::Plugin::CPANFile line 65) > [DZ] attempt to add LICENSE multiple times; added by: GatherDir > (Dist::Zilla::Plugin::GatherDir line 100); License > (Dist::Zilla::Plugin::License line 22) > [DZ] attempt to add Makefile.PL multiple times; added by: GatherDir > (Dist::Zilla::Plugin::GatherDir line 100); MakeMaker > (Dist::Zilla::Plugin::MakeMaker line 25 > 2)
Maybe dzil was modified to disallow adding the same file twice? The only solution I can think of is to add these files to the "exclude_filename" option of GatherDir.
On 2014-02-07 16:08:44, RTHOMPSON wrote: Show quoted text
> Maybe dzil was modified to disallow adding the same file twice? The > only solution I can think of is to add these files to the > "exclude_filename" option of GatherDir.
You're right on both counts - you can't add a file twice, by any mechanism, and you're both gathering the existing file in the repo (by [GatherDir] or [Git::GatherDir]) as well as [ReadmeAnyFromPod] attempting to create a new one. The answer indeed is to tell GatherDir to skip this file. e.g. see what I'm doing here: https://metacpan.org/source/ETHER/Dist-Zilla-PluginBundle-Author-ETHER-0.049/lib/Dist/Zilla/PluginBundle/Author/ETHER.pm#L332
On Fri Feb 07 19:33:49 2014, ETHER wrote: Show quoted text
> On 2014-02-07 16:08:44, RTHOMPSON wrote: >
> > Maybe dzil was modified to disallow adding the same file twice? The > > only solution I can think of is to add these files to the > > "exclude_filename" option of GatherDir.
> > > You're right on both counts - you can't add a file twice, by any > mechanism, and you're both gathering the existing file in the repo (by > [GatherDir] or [Git::GatherDir]) as well as [ReadmeAnyFromPod] > attempting to create a new one. The answer indeed is to tell > GatherDir to skip this file. > > e.g. see what I'm doing here: > > https://metacpan.org/source/ETHER/Dist-Zilla-PluginBundle-Author- > ETHER-0.049/lib/Dist/Zilla/PluginBundle/Author/ETHER.pm#L332
Semi-unrelated question: what's the difference between CopyFileFromBuild and CopyFilesFromRelease? I guess the latter only triggers when you actually make a release instead of on every build?
CC: NGLENN [...] cpan.org
Subject: Re: [rt.cpan.org #92828] dzil dies when files are added multiple times
Date: Fri, 7 Feb 2014 16:42:35 -0800
To: bug-Dist-Zilla-Plugin-CopyFilesFromBuild [...] rt.cpan.org
From: Nathan Glenn <garfieldnate [...] gmail.com>
Thanks Karen. That does fix the problem but it violates DRY. Now if I change the settings for one plugin I also have to change them for the other. I'm not sure what the diff is between this and that other plugin... I think a simple "clobber" or "write_over" or "replace" = 1 option would be very helpful for this plugin. On Fri, Feb 7, 2014 at 4:36 PM, Ryan C. Thompson via RT < bug-Dist-Zilla-Plugin-CopyFilesFromBuild@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=92828 > > > On Fri Feb 07 19:33:49 2014, ETHER wrote:
> > On 2014-02-07 16:08:44, RTHOMPSON wrote: > >
> > > Maybe dzil was modified to disallow adding the same file twice? The > > > only solution I can think of is to add these files to the > > > "exclude_filename" option of GatherDir.
> > > > > > You're right on both counts - you can't add a file twice, by any > > mechanism, and you're both gathering the existing file in the repo (by > > [GatherDir] or [Git::GatherDir]) as well as [ReadmeAnyFromPod] > > attempting to create a new one. The answer indeed is to tell > > GatherDir to skip this file. > > > > e.g. see what I'm doing here: > > > > https://metacpan.org/source/ETHER/Dist-Zilla-PluginBundle-Author- > > ETHER-0.049/lib/Dist/Zilla/PluginBundle/Author/ETHER.pm#L332
> > > Semi-unrelated question: what's the difference between CopyFileFromBuild > and CopyFilesFromRelease? I guess the latter only triggers when you > actually make a release instead of on every build? >
On Fri Feb 07 19:42:48 2014, garfieldnate@gmail.com wrote: Show quoted text
> Thanks Karen. That does fix the problem but it violates DRY. Now if I > change the settings for one plugin I also have to change them for the other. > I'm not sure what the diff is between this and that other plugin... > > I think a simple "clobber" or "write_over" or "replace" = 1 option would be > very helpful for this plugin. > > > On Fri, Feb 7, 2014 at 4:36 PM, Ryan C. Thompson via RT < > bug-Dist-Zilla-Plugin-CopyFilesFromBuild@rt.cpan.org> wrote: >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=92828 > > > > > On Fri Feb 07 19:33:49 2014, ETHER wrote:
> > > On 2014-02-07 16:08:44, RTHOMPSON wrote: > > >
> > > > Maybe dzil was modified to disallow adding the same file twice? The > > > > only solution I can think of is to add these files to the > > > > "exclude_filename" option of GatherDir.
> > > > > > > > > You're right on both counts - you can't add a file twice, by any > > > mechanism, and you're both gathering the existing file in the repo (by > > > [GatherDir] or [Git::GatherDir]) as well as [ReadmeAnyFromPod] > > > attempting to create a new one. The answer indeed is to tell > > > GatherDir to skip this file. > > > > > > e.g. see what I'm doing here: > > > > > > https://metacpan.org/source/ETHER/Dist-Zilla-PluginBundle-Author- > > > ETHER-0.049/lib/Dist/Zilla/PluginBundle/Author/ETHER.pm#L332
> > > > > > Semi-unrelated question: what's the difference between CopyFileFromBuild > > and CopyFilesFromRelease? I guess the latter only triggers when you > > actually make a release instead of on every build? > >
The problem is that the CopyFilesFromBuild plugin is not directly involved with the problem, so there is nothing that it can do directly to fix it. This is why you have to violate DRY and manually tell the GatherDir plugin to exclude the files. The only other solution I can think of is rather messy: The CopyFilesFromBuild plugin would have to arrange for itself to run before the GatherDir plugin, and it would have to modify the GatherDir plugin's options to add the appropriate file exclusions. And then the solution only works for the GatherDir plugin and not any alternative plugin that one might use that would accidentally add the files.
CC: NGLENN [...] cpan.org
Subject: Re: [rt.cpan.org #92828] dzil dies when files are added multiple times
Date: Fri, 7 Feb 2014 17:09:22 -0800
To: bug-Dist-Zilla-Plugin-CopyFilesFromBuild [...] rt.cpan.org
From: Nathan Glenn <garfieldnate [...] gmail.com>
Darn. There's probably not a phase between "gather existing files" and "generate some more files", because the role for this would have to be run in between those two, deleting files from the first before they could be added in the second. On Fri, Feb 7, 2014 at 4:48 PM, Ryan C. Thompson via RT < bug-Dist-Zilla-Plugin-CopyFilesFromBuild@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=92828 > > > On Fri Feb 07 19:42:48 2014, garfieldnate@gmail.com wrote:
> > Thanks Karen. That does fix the problem but it violates DRY. Now if I > > change the settings for one plugin I also have to change them for the
> other.
> > I'm not sure what the diff is between this and that other plugin... > > > > I think a simple "clobber" or "write_over" or "replace" = 1 option would
> be
> > very helpful for this plugin. > > > > > > On Fri, Feb 7, 2014 at 4:36 PM, Ryan C. Thompson via RT < > > bug-Dist-Zilla-Plugin-CopyFilesFromBuild@rt.cpan.org> wrote: > >
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=92828 > > > > > > > On Fri Feb 07 19:33:49 2014, ETHER wrote:
> > > > On 2014-02-07 16:08:44, RTHOMPSON wrote: > > > >
> > > > > Maybe dzil was modified to disallow adding the same file twice? The > > > > > only solution I can think of is to add these files to the > > > > > "exclude_filename" option of GatherDir.
> > > > > > > > > > > > You're right on both counts - you can't add a file twice, by any > > > > mechanism, and you're both gathering the existing file in the repo
> (by
> > > > [GatherDir] or [Git::GatherDir]) as well as [ReadmeAnyFromPod] > > > > attempting to create a new one. The answer indeed is to tell > > > > GatherDir to skip this file. > > > > > > > > e.g. see what I'm doing here: > > > > > > > > https://metacpan.org/source/ETHER/Dist-Zilla-PluginBundle-Author- > > > > ETHER-0.049/lib/Dist/Zilla/PluginBundle/Author/ETHER.pm#L332
> > > > > > > > > Semi-unrelated question: what's the difference between
> CopyFileFromBuild
> > > and CopyFilesFromRelease? I guess the latter only triggers when you > > > actually make a release instead of on every build? > > >
> > The problem is that the CopyFilesFromBuild plugin is not directly involved > with the problem, so there is nothing that it can do directly to fix it. > This is why you have to violate DRY and manually tell the GatherDir plugin > to exclude the files. The only other solution I can think of is rather > messy: The CopyFilesFromBuild plugin would have to arrange for itself to > run before the GatherDir plugin, and it would have to modify the GatherDir > plugin's options to add the appropriate file exclusions. And then the > solution only works for the GatherDir plugin and not any alternative plugin > that one might use that would accidentally add the files. >