Upgrade to Pro — share decks privately, control downloads, hide ads and more …

cpm at YAPC

cpm at YAPC

YAPC::Fukuoka 2017 HAKATA, 2017/07/01

Shoichi Kaji

July 01, 2017
Tweet

More Decks by Shoichi Kaji

Other Decks in Technology

Transcript

  1. Agenda • What is cpm? • Features • cpm͕Ͱ͖Δ·Ͱ •

    Motivation • ࢼߦࡨޡͱ࢓૊Έͱ࣮૷
  2. Features • 1) Fast • 2) Self-contained, zero-dependency
 works fine

    with Perl 5.8.1 • 3) Flexible resolvers • 4) Support static-install • 5) Support prebuilt
 This is (of course!) inspired by Carmel
  3. Motivation • ๻͸ ೔ʑPerl5Λॻ͍͍ͯΔ • CPAN moduleͷΠϯετʔϧʹ͸cpanmΛ࢖͓ͬͯΓɺͦͷit just works͞ʹ ͍ͭ΋ײ৺ͤ͞ΒΕ͍ͯͨ

    • ҰํͰɺԼهͷཧ༝ʹΑΓmoduleΛΠϯετʔϧ͢Δػձ͸૿͍͑ͯΔ • Project͝ͱʹmoduleΛ؅ཧ͢Δͷ͕ҰൠతʹɻCartonͷొ৔ • CIͷਁಁ • ΠϯϑϥͷΫϥ΢υԽ • moduleͷΠϯετʔϧΛͱʹ͔͘଎͍ͨ͘͠
  4. ·ͣߟ͑ͨ͜ͱ • cpanm͸࢖͍͍ͨɻฒྻԽɾฒߦԽ͢Ε͹଎͘ͳΓͦ͏ • ૉ๿ʹߟ͑Δͱ cat modules | xargs cpanm

    • ແཧ • ཧ༝1: ࣄલʹΠϯετʔϧ͢΂͖moduleҰཡ͸෼͔͍ͬͯͳ ͍ • ཧ༝2: Ծʹ෼͔͍ͬͯͨͱͯ͠΋ɺґଘؔ܎Λຬͨͨ͢Ίʹ workerͷಉظ͕ඞཁ͕ͩɺ·͍ͬͨͯ͘͠ͳ͍
  5. CPAN module install෼ղ • Resolve: Plack -> http://cpan.org/…/Plack-1.0041.tar.gz • Fetch:

    wget http://cpan.org/…/Plack-1.0041.tar.gz • Get conf reqs: File::ShareDir::Install => Go to install of F::SD::I • Configure: perl Makefile.PL • Get reqs: URI, Try::Tiny… => Go to install of URI, Try::Tiny… • Build: make build • Install: make install Block untill configure reqs are installed Block untill reqs are installed
  6. CPAN module install෼ղ • Resolve • Fetch
 (Get conf reqsؚΉ)

    • Configure
 (Get reqsؚΉ) • Install
 (Build΋ؚΉ) ಉظ͕ඞཁ } } } } ಠཱ࣮ͯ͠ߦՄೳ ಉظ͕ඞཁ ಠཱ࣮ͯ͠ߦՄೳ ಠཱ࣮ͯ͠ߦՄೳ ಠཱ࣮ͯ͠ߦՄೳ ಉظ͕ඞཁ
  7. Resolve Fetch Configure Install Plack Resolve Fetch Configure Install Try::Tiny

    Resolve Fetch Configure Install URI Resolve Fetch Configure Install F::SD::I Job Pool Plack, Resolve F::SD::I, Fetch URI, Rsolve, Try::Tiny, Resolve Plack, Fetch F::SD::I, Resolve Plack, Configure … … … … … Installation of Plack
  8. Poolʹཷ·ͬͨjobΛ
 Ͳ͏ฒྻͰ࣮ߦ͢Δ͔ Job Pool Plack, Resolve F::SD::I, Fetch URI, Rsolve,

    Try::Tiny, Resolve Plack, Fetch F::SD::I, Resolve Plack, Configure … … XPSLFS XPSLFS XPSLFS pipe pipe pipe pipe pipe pipe select
  9. ·ͱΊͱࠓޙ • cpm is yet another CPAN client, which is

    fast • It parallelizes cpanm and synchronizes them by fork/pipe/select
  10. ·ͱΊͱࠓޙ • CPAN·ΘΓʹ͸
 * static install
 * central repository introduced

    by Carmel
 ͳͲɺ͍͔ͭ͘৽͍͠γϯϓϧͳΞΠσΞ͕͋Δ • ͥͻͦ͏͍͏ੈքʹม͍͖͍͑ͯͨ • ઌʹɺCPAN͸ґଘؔ܎͕ಈతʹมΘΔ͜ͱΛڐ༰͍ͯ͠Δͱ͍ͬͨɻ
 ҰํͰԾʹґଘؔ܎͕੩తʹऔಘͰ͖Δ͜ͱΛલఏͱͰ͖ΔͳΒ͹ CPAN client͸ ͞ΒʹΦϓςΟϚΠζͰ͖Δɻ͜ͷՄೳੑΛ୳Γ͍ͨɻ
 charsbar͞Μᐌ͘ɺMETA v3ɺPAUSE New Index 07(?)ΛఏҊ͢Δͷ͸͍ͭͰ΋ openͱͷ͜ͱ:) • ·ͩ·ͩ΍Δ͜ͱ͕ͨ͘͞Μ͋Δɻ·ͨԿͰ΋Ͱ͖Δ