Building your own CPAN with Pinto

30
. . BUILDING YOUR OWN CPAN WITH PINTO [email protected] @about_andrefs PTPW 2013

description

A quick introduction to Pinto, a Perl application to build private CPAN-like Perl modules repositories.

Transcript of Building your own CPAN with Pinto

Page 1: Building your own CPAN with Pinto

.

.

.

BUILDING YOUR OWN CPAN WITH

PINTO

[email protected]@about_andrefs

PTPW 2013

Page 2: Building your own CPAN with Pinto

.

.

.

PRESENTATIONHIGHLIGHTS

.⋆ LIVE ACTION ⋆........slides might be finished as we speak — or never at all

.⋆ THRILLS AND CHILLS ⋆........most of this stuff is stolen anyway — references at the end

.⋆ INTERACTIVE MEDIA ⋆..

......advanced features will be left as an exercisefor the reader

Page 3: Building your own CPAN with Pinto

.

.

.

WHO’S PINTO?

Page 4: Building your own CPAN with Pinto

.

.

.

WHO’S PINTO?

Page 5: Building your own CPAN with Pinto

.

.

.

WHO’S PINTO?

...

......

“an application for creating andmanaging a custom CPAN-likerepository of Perl modules”

Page 6: Building your own CPAN with Pinto

.

.

.

COMMON DEVPROBLEMS

• how to distribute internally in-housedeveloped modules which are not onCPAN? (e.g. confidential, too specific, …)

• how to distribute internally a(temporarily) patched third-partymodule?

Page 7: Building your own CPAN with Pinto

.

.

.

COMMON DEVPROBLEMS

• how to keep track of which versions ofyour app’s dependencies are safe? (andhow to make them available)

• how to keep track of which versionsbreak your app?

Page 8: Building your own CPAN with Pinto

.

.

.

COMMON DEVPROBLEMS

• how to quickly replicate theproduction/testing/developmentenvironment?

• how to efficiently ensure that everybodyis using the same versions of thedependencies?

Page 9: Building your own CPAN with Pinto

.

.

.

SO WHAT?

With Pinto you can:• keep one or more instances of privatesCPAN-like repos

• distribute in-house modules using thestandard tools from the CPAN ecosystem

• simultaneously manage dependenciesfor multiple apps/projects

• pin specific versions of module to fixbroken dependencies

Page 10: Building your own CPAN with Pinto

.

.

.

PINTO ADVANTAGES

• supports multiple indexes• helps manage incompatibilies betweendependencies

• has built-in version control• can pull archives from multiple remoterepositories

• supports team development

Page 11: Building your own CPAN with Pinto

.

.

.

USAGE..

1. create a Pinto repository2. pull CPAN modules, add your own, freeze

versions, …3. point your /cpan(m|p)?/ to your Pinto

repo when installing your app’sdependencies

4. repeat steps 2 and 3 throughout project’slifecycle

Page 12: Building your own CPAN with Pinto

.

.

.

BASIC OPS.create a repo........pinto -r ~/repo init.pull a CPAN module........pinto -r ~/repo pull Dancer.add a module of your own........pinto -r ~/repo add My-Module_01.tgz

Page 13: Building your own CPAN with Pinto

.

.

.

BASIC OPS

.pinto -r repo list..

......

[rf-] Acme::Magic::Pony 0.03 JLAVALLEE/Acme-Magic-Pony-0.03.tar.gz[rf-] Smart::Comments 1.000005 DCONWAY/Smart-Comments-1.000005.tar.gz[rf-] Data::Dump 1.23 GAAS/Data-Dump-1.22.tar.gz[rf-] Data::Dump::Trace 0.02 GAAS/Data-Dump-1.22.tar.gz...

Page 14: Building your own CPAN with Pinto

.

.

.

PINNING VERSIONS

• Control exactly which versions go intoyour repo

• pinto -r ~/repo pin Data::Dump.pinto -r repo list..

......

...[rl!] Data::Dump 1.22 GAAS/Data-Dump-1.22.tar.gz[rl!] Data::Dump::Trace 0.02 GAAS/Data-Dump-1.22.tar.gz...

Page 15: Building your own CPAN with Pinto

.

.

.

PATCHES

• Build your own custom versions of CPANmodules

• Add them to your repo• pinto -r ~/repo add Data-Dump-1.22_PATCHED.tar.gz

.pinto -r repo list..

......

...[rl!] Data::Dump 1.23 ANDREFS/Data-Dump-1.22_PATCHED.tar.gz[rl!] Data::Dump::Trace 0.02 ANDREFS/Data-Dump-1.22_PATCHED.tar.gz...

Page 16: Building your own CPAN with Pinto

.

.

.

STACKS

• Pinto seems nice, but what about:• projects with distinct dependencies?• projects with conflicting dependenciesversions?

• dependencies for distinct environments?

• Each stack is an isolated repository

Page 17: Building your own CPAN with Pinto

.

.

.

STACKS

.pinto -r repo stacks..

......

• sapo_noticias• sapo_desporto

Page 18: Building your own CPAN with Pinto

.

.

.

STACKS

.pinto -r repo stacks..

......

• sapo_noticias_dev• sapo_noticias_prod• sapo_desporto_dev• sapo_desporto_prod

Page 19: Building your own CPAN with Pinto

.

.

.

LOG.pinto -r repo log..

......

revision eaddeea0-cdc3-46c1-996f-43d6bbddb03cDate: Oct 24, 2013 10:30:40 AMUser: andrefs

Pin ANDREFS/Data-Dump-1.23_PATCHED.tar.gz

revision bb3e6631-d087-4904-9cfd-475bde3b14f3Date: Oct 22, 2013 10:23:28 PMUser: andrefs

Add ANDREFS/Data-Dump-1.23_PATCHED.tar.gz

revision 1b7456ed-f3b1-43f8-8e08-830322272ca7Date: Oct 22, 2013 10:22:50 PMUser: andrefs

Pull GAAS/Data-Dump-1.22.tar.gz

Page 20: Building your own CPAN with Pinto

.

.

.

DOC

.App::Pinto::Command::doc........pinto -r ~/repo doc --out=docs

Page 21: Building your own CPAN with Pinto

.

.

.

DOC

Page 22: Building your own CPAN with Pinto

.

.

.

PINTOD

• web API to a Pinto repository• manage and inspect the repository• use it with CPAN clients• basic HTTP authentication, or otherauthentication schemes

• PSGI compatible, by default runs underPlack::Runner using Starman

Page 23: Building your own CPAN with Pinto

.

.

.

PINTO VS PAUSE

• Pinto does not promise to index exactlylike PAUSE does

• Pinto does not understand authorpermissions

• Pinto does not enforce security

Page 24: Building your own CPAN with Pinto

.

.

.

USEFULL STUFF

• Bash::Completion::Plugins::pinto• Dist::Zilla::Plugin::Pinto::Add• Pinto::Remote• Pinto::Action::Statistics• Pinto::Action::Clean

Page 25: Building your own CPAN with Pinto

.

.

.

MORE STUFF

• MyCPAN::App::DPAN• Stratopan•

Page 26: Building your own CPAN with Pinto

.

.

.

WHAT’S LEFT?.........Authentication and authorization

• Who can create, modify or delete existingstacks?

• Who can pin or unpin modules in a givenstack?

• Who can make new releases to a stack?• people↔ stacks↔modules

Page 27: Building your own CPAN with Pinto

.

.

.

WHAT’S LEFT?.........Authentication and authorization

• Who can create, modify or delete existingstacks?

• Who can pin or unpin modules in a givenstack?

• Who can make new releases to a stack?• people↔ stacks↔modules

Page 28: Building your own CPAN with Pinto

.

.

.

REFERENCES

• Pinto::Manual::Tutorial• Pinto::Manual::QuickStart• MyCPAN::App::DPAN• Pinto+Stratopan+Love (presentation by Jeffrey Thalhammer)

• Saved by Pinto (blog post by Jeffrey Thalhammer)

• Santa Has Dependencies Too (Perl Advent Calendar 2012)

• i-might-have-missed-one.com

Page 29: Building your own CPAN with Pinto

.

.

.

QUESTIONS?

Page 30: Building your own CPAN with Pinto

.

.

.

THANK YOU