Making your own CPAN-Mini

| | Kommentare (0)

Mit dem CPAN-Modul CPAN::Mini und dem dazugehörigen Kommandozeilen-Tool minicpan von Ricardo Signes ist sehr einfach, eine CPAN Kopie, die nur die aktuellsten Versionen enthält, lokal auf der Festplatte zu erstellen.

Schritt 1: CPAN::Mini installieren

Entweder mit dem Modul CPAN:

$ sudo perl -MCPAN -e shell
install CPAN::Mini

oder für Ubuntu und andere Debian-basierte Linuxe:

$ sudo apt-get install libcpan-mini-perl 

minicpan wird automatisch installiert.

Schritt 2: minicpan konfigurieren

minicpan sollte die Dateien nach Möglichkeit von einen nahegelegenen CPAN-Mirror holen.

Einen nahegelegenen CPAN-Mirror findet man bei http://mirrors.cpan.org/.

Der gewählte Mirror und das lokale Verzeichnis (hier /opt/CPAN-Mini) werden in die Konfigurationsdatei .minicpanrc im Homeverzeichnis eingetragen.

$ cat ~/.minicpanrc
local:  /opt/CPAN-Mini
remote: http://nahe/gelegener/CPAN/Mirror
exact_mirror: 1

Nun kann es auch schon losgehen.

Schritt 3: minicpan starten

Das mitgelieferte Tool minicpan holt und synchronisiert die Dateien vom CPAN.

$ time minicpan
............... Ausgabe unterdrückt
mkdir /opt/CPAN-Mini/authors/id/M/MA/MADGHOUL
authors/id/M/MA/MADGHOUL/XML-OPML-0.26.tar.gz ... updated
authors/id/M/MA/MADGHOUL/CHECKSUMS ... updated
authors/id/M/MI/MIYAGAWA/XML-OPML-LibXML-0.03.tar.gz ... updated
authors/id/S/ST/STEPHENCA/XML-OPML-SimpleGen-0.04.tar.gz ... updated
authors/id/K/KA/KAWASAKI/XML-OverHTTP-0.08.tar.gz ... updated
authors/id/M/MS/MSTROUT/XML-Overlay-0.01.tar.gz ... updated
authors/id/M/MO/MORNI/XML-ParseDTD-0.1.4.tar.gz ... updated
authors/id/M/MS/MSERGEANT/XML-Parser-2.36.tar.gz ... updated
authors/id/E/EB/EBOHLMAN/XML-Parser-EasyTree-0.01.tar.gz ... updated
authors/id/I/IA/IAMCAL/XML-Parser-Lite-Tree-0.03.tar.gz ... updated
authors/id/I/IA/IAMCAL/XML-Parser-Lite-Tree-XPath-0.02.tar.gz ... updated
authors/id/M/MS/MSERGEANT/XML-PYX-0.07.tar.gz ... updated
authors/id/A/AW/AWIN/XML-Parser-Style-RDF-0.01.tar.gz ... updated
authors/id/D/DO/DOWENS/XML-Parser-Wrapper-0.08.tar.gz ... updated
authors/id/A/AH/AHICOX/XML-Parser-YahooRESTGeocode-0.2.tar.gz ... updated
authors/id/M/MU/MURRAY/PPM-2.1.3.tar.gz ... updated
authors/id/M/MS/MSERGEANT/XML-QL-0.07.tar.gz ... updated
mkdir /opt/CPAN-Mini/authors/id/C/CO/CODEHELP
authors/id/C/CO/CODEHELP/XML-QOFQSF-0.04.tar.gz ... updated
............... Ausgabe unterdrückt

real	77m39.156s
user	2m54.787s
sys	0m22.369s

Also knapp 1,5 h für den ersten vollständigen Durchlauf.

Das neue MINI-CPAN belegt weniger als 1GB Plattenplatz. Das passt sogar auf einen kleinen USB-Stick.

$ du -hs CPAN-Mini/
845M	CPAN-Mini/

Schritt 4: Alle paar Tage CPAN-Mini aktualisieren.

$ minicpan
authors/01mailrc.txt.gz ... up to date
modules/02packages.details.txt.gz ... updated
modules/03modlist.data.gz ... up to date
authors/id/C/CF/CFRANKS/Catalyst-Controller-HTML-FormFu-0.03000.tar.gz ... updated
authors/id/C/CF/CFRANKS/CHECKSUMS ... updated
authors/id/D/DD/DDUMONT/Config-Model-TkUI-0.201.tar.gz ... updated
authors/id/D/DD/DDUMONT/CHECKSUMS ... updated
authors/id/C/CF/CFRANKS/DBIx-Class-HTML-FormFu-0.01005.tar.gz ... updated
authors/id/C/CF/CFRANKS/HTML-FormFu-0.03000.tar.gz ... updated
authors/id/C/CF/CFRANKS/HTML-FormFu-Model-DBIC-0.03000.tar.gz ... updated
authors/id/C/CL/CLIVE/Win32-EnvProcess-0.04.tar.gz ... updated
authors/id/C/CL/CLIVE/CHECKSUMS ... updated
cleaning /opt/CPAN-Mini/authors/id/C/CF/CFRANKS/DBIx-Class-HTML-FormFu-0.01004.tar.gz ...done
cleaning /opt/CPAN-Mini/authors/id/C/CF/CFRANKS/HTML-FormFu-0.02004.tar.gz ...done
cleaning /opt/CPAN-Mini/authors/id/C/CL/CLIVE/Win32-EnvProcess-0.03.tar.gz ...done
cleaning /opt/CPAN-Mini/authors/id/D/DD/DDUMONT/Config-Model-TkUI-0.105.tar.gz ...done

mincpan aktualisiert den lokalen Mirror auf die jeweils neusten Modulversionen (updated) und löscht gleichzeitig (cleaning) alte Versionen.

Schritt 5: CPAN konfigurieren

Zum Schluss muss nur noch der Pfad zu MINI-CPAN im Modul CPAN konfiguriert werden.

$ sudo perl -MCPAN -e shell

cpan[1]> o conf urllist file:///opt/CPAN-Mini
Please use 'o conf commit' to make the config permanent!

cpan[2]> o conf commit
commit: wrote '/home/tf/-cpan/CPAN/MyConfig.pm'

cpan[3]> install Bundle::CPAN
CPAN: Storable loaded ok (v2.18)
CPAN: Time::HiRes loaded ok (v1.9711)
Going to read /opt/CPAN-Mini/authors/01mailrc.txt.gz
...

Enjoy!

Siehe auch:

Jetzt kommentieren

Über diese Seite

Diese Seite enthält einen einen einzelnen Eintrag von Thomas Fahle vom 20.06.08 14:20.

CRC-Prüfsummen von Dateien erstellen ist der vorherige Eintrag in diesem Blog.

Zufallszahlen (Pseudo Random Numbers) mit Bordmitteln erzeugen ist der nächste Eintrag in diesem Blog.

Aktuelle Einträge finden Sie auf der Startseite, alle Einträge in den Archiven.

Blog Roll

Powered by

Powered by Movable Type 5.2.10

Creative Commons-Lizenz

Creative Commons License
Dieses Weblog steht unter einer Creative Commons-Lizenz.