- Don't use anything that changes the line numbers of your source
- Examples: don't use DZP::Prepender. Use modules like OurPkgVersion to insert VERSION, and make sure your # ABSTRACT and any pod is below the
1;at the end of your module. This will keep the line numbers of errors in your code from being different from the final build. It's still ok to use PodWeaver as it will save you way more time than it'll hurt, so long as you follow the rules about pod being at the bottom
- Use a plugin that commits builds to your source control software
- I personally recommend DZP::Git::CommitBuild
- Make your build branch your default branch
- I'm not sure how to do this with just git, but on github you can go to the admin section of your repository and change the default branch there. This makes it so that when someone clone's your repository the initial checkout is of your build branch. Your build branch shouldn't require dzil, it's the final build.
Now that you have your final build branch as the default branch anyone who wants to contribute can simply clone your repo and start hacking. Their are a couple of mistakes they could make, They could either change or add files that are maintained, or pruned by dzil. This did happen when Schwern sent me patches, one of them was the addition of a .gitignore, which I already had, but is being pruned out of the build branch. I can also see it happening to meta's and makefiles. These patches can simply be rejected as unnecessary, dzil-ified, or if they are truly a bug, then they can be reported and fixed upstream.
So what if someone sends you a pull request from
build/master? well if it's just one or two patches, you add their remote, and do a git remote update and then you can git log remote build/master to find the sha1 of this patch. Now that you have the sha1 all you have to do is git cherry-pick [sha1] and it should apply. If there are any conflicts you may have to resolve them with git mergetool. However, the only conflict with Schwern's patches for me was the .gitignore, all other patches applied without assistance and applied correcly, surprisingly even the pod patch applied without issue.If you have more patches than is comfortable with
git cherry-pick then you need git rebase. The command you want is git rebase -i --onto master [sha1 before first sha1 in series] [tip of remote branch checkout]. So in my case git rebase -i --onto master 3f1e3748 schwern. What this appears to do is ends up rewriting my local schwern/build/master checkout and removes all the build commits, and then applies the patches on top. This means I can now do git merge schwern from the master branch, and all of his patches that I want will be successfully merged. For more on this strategy you may want to read this stackoverflow question.given this is not quite as easy as a
git pull that's a fast forward, but reality is it's not that hard once you know how to do the rebase and how it works. Of course this isn't ideal for constant contributors, those should simply learn to use dzil, but for the random contributor it should be ok.
You can set the default branch on a bare repository in git like this:
ReplyDelete% git symbolic-ref HEAD refs/heads/build/master
I think calling it FUD is inaccurate given this is the first time I've seen anybody explain this layout - and the first time I've seen a project using it, as well.
ReplyDeletePerhaps it would be better to say that "the way people generally seem to use Dist::Zilla makes it harder for contributors to get started" - but if you've never seen it used any other way, the generalisation is still reasonably valid.
I'd love to see the layout you describe featured prominently in the Dist::Zilla docs - were it widely adopted, I'd retract pretty much all of my complaints.
However, for the moment "almost all Dist::Zilla projects are harder to get started to contribute to than non-Dist::Zilla projects" *does* hold, and I think that's a valid statement to make.
-- mst
@mst I have discussed much of this layout in previous dzil blogs Most of it here. Almost a year ago. I think the only thing new here is what to actually do if someone does contribute.
ReplyDeleteNot FUD: contributing to a DZ project that uses buggy plugins or a buggy dist.ini IS painful, even for a DZ user.
ReplyDeleteFor example, to fix your own buggy DZP::Test::EOL distribution I had to fix your buggy build first. See this commit.
Also, your way of doing things is broken as your CPAN distribution does not include anymore the full source that would allow someone else to rebuild it cleanly: it lacks the dist.ini file. This breaks an unsaid contract of CPAN distributions and will disallow your dist to be distributed by Debian.
Example: Dist::Zilla::Test::Version 0.002000.
@Dolmen no still FUD all software has bugs. your dist.ini patch references a feature I was not aware of and probably did not exist at one time. The referenced repo was forked from RAFL who did not use it. I'd never used said plugin before that.
ReplyDeleteI don't care about Debian, they do a good enough job breaking source from upstream (*cough* openssl *cough*), my dist.ini is in my vcs (publicly), it does not need to be on CPAN. If Debian wants to shoot itself in the foot it can go ahead and do that, I suggest getting a distro that attempts to follow upstream (arch) instead of one that attempts to modify upstream (debian) without sharing it's patches back up. Give me a better reason to put my dist.ini on CPAN, because as far as I can tell on CPAN it's just a noise file, and if you try to use the dist.ini in the built dist I suspect you'll end up generating some interesting bugs.