Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 6 commits
  • 6 files changed
  • 0 commit comments
  • 1 contributor
Showing with 71 additions and 21 deletions.
  1. +1 −4 Makefile.PL
  2. +3 −2 lib/OrePAN/Archive.pm
  3. +1 −3 lib/OrePAN/Package/Index.pm
  4. +32 −9 orepan.pl
  5. +33 −3 orepan_index.pl
  6. +1 −0 t/02_make_whois.t
View
5 Makefile.PL
@@ -3,11 +3,9 @@ use Module::Install::AuthorTests;
name 'OrePAN';
all_from 'orepan.pl';
-abstract 'my own Perl Archive Network.';
+abstract 'yet another CPAN mirror aka DarkPAN repository manager';
license 'perl';
-# OrePAN should not depend to any XS modules, since this is a utility for operating CPAN modules.
-# It should works with FatPacker.
requires 'JSON' => 2.27;
requires 'YAML::Tiny';
requires 'List::MoreUtils';
@@ -21,7 +19,6 @@ requires 'Cwd';
requires 'File::Basename';
requires 'File::Find';
requires 'CPAN::DistnameInfo';
-requires 'File::Sync';
requires 'File::Temp';
requires_external_bin('tar');
View
5 lib/OrePAN/Archive.pm
@@ -123,7 +123,8 @@ sub _parse_version($) {
# Copy from ExtUtils::MM_Unix
my $eval = qq{
- package ExtUtils::MakeMaker::_version;
+ package
+ ExtUtils::MakeMaker::_version;
no strict;
BEGIN { eval {
# Ensure any version() routine which might have leaked
@@ -143,7 +144,7 @@ sub _parse_version($) {
};
local $^W = 0;
my $version = eval($eval); ## no critic
- warn "Could not eval '$eval' in $parsefile: $@" if $@;
+ warnf("Could not eval '$eval' in $parsefile: $@") if $@;
if ( ! ref($version) ) {
$version = eval { version->new($version) };
}
View
4 lib/OrePAN/Package/Index.pm
@@ -9,7 +9,6 @@ use CPAN::DistnameInfo;
use version;
use Log::Minimal;
use File::Temp qw(:mktemp);
-use File::Sync ();
use Carp ();
has filename => (
@@ -99,8 +98,7 @@ sub save {
for my $key ( sort keys %modules ) {
print {$fh} sprintf("%s\t%s\t%s\n", $key, $modules{$key}->[0] || 'undef', $modules{$key}->[1]);
}
- File::Sync::fsync($fh);
- close $fh;
+ $fh->close();
rename( $tmp, $self->filename )
or Carp::croak("Cannot rename temporary file '$tmp' to @{[ $self->filename ]}: $!");
View
41 orepan.pl
@@ -23,12 +23,13 @@
my $pauseid = 'DUMMY';
GetOptions(
'p|pauseid=s' => sub { $pauseid = uc $_[1] },
- 'd|destination=s' => \my $destination
+ 'd|destination=s' => \my $destination,
+ 'h|help' => \my $help,
);
-pod2usage() unless $destination;
+pod2usage(-verbose=>1) unless $destination;
my ($pkg) = @ARGV;
-$pkg or pod2usage();
+$pkg or pod2usage(-verbose=>1);
my $tmp;
if ($pkg =~ m{^https?://}) {
@@ -74,23 +75,45 @@
=head1 NAME
-orepan.pl - my own Perl Archive Network.
+orepan.pl - yet another CPAN mirror aka DarkPAN repository manager
=head1 SYNOPSIS
- % orepan.pl --destination=/path/to/repository Foo-0.01.tar.gz
- --pause=FOO
- % orepan.pl --destination=/path/to/repository https://example.com/MyModule-0.96.tar.gz
+ % mkdir -p /path/to/repository
- # and so...
+ # add new module to repository directory
+ % orepan.pl --destination=/path/to/repository --pause=FOO \
+ Foo-0.01.tar.gz
+ # retrieve from network
+ % orepan.pl --destination=/path/to/repository --pause=FOO \
+ https://example.com/MyModule-0.96.tar.gz
+
+ # and use it
% cpanm --mirror-only --mirror=file:///path/to/repository Foo
=head1 DESCRIPTION
-OrePAN is yet another DarkPAN repository manager.
+OrePAN is yet another CPAN mirror aka DarkPAN repository manager.
+
+orepan.pl can add a new module to DarkPAN repository. If you want remove modules, add
+many modules at once, you can use L<orepan_index.pl>
OrePAN is highly simple and B<limited>. OrePAN supports only L<App::cpanminus>. Because I'm using cpanm for daily jobs.
+=head1 OPTIONS
+
+=over 4
+
+=item B<--destination>
+
+Set a directory that use as DarkPAN repository
+
+=item B<--pause>
+
+PAUSEID, the module is copied to destination/authors/id/{substr(0,1,id)}/{substr(0,2,id)}/{id}/module
+
+=back
+
=head1 AUTHOR
Tokuhiro Matsuno E<lt>tokuhirom AAJKLFJEF GMAIL COME<gt>
View
36 orepan_index.pl
@@ -22,8 +22,10 @@
GetOptions(
'r|repository=s' => \my $repository,
+ 'h|help' => \my $help,
);
-$repository or pod2usage();
+pod2usage(-verbose=>1) if $help;
+$repository or pod2usage(-verbose=>1);
$repository = dir($repository);
my $authordir = $repository->subdir('authors');
@@ -68,17 +70,45 @@ sub build_index {
=head1 NAME
-orepan_index.pl - index builder
+orepan_index.pl - yet another CPAN mirror aka DarkPAN index builder
=head1 SYNOPSIS
+ # make directory
+ % mkdir -p /path/to/repository/{modules,authors}
+ # copy CPAN mouldes to the directory
+ % cp MyModule-0.03.tar.gz /path/to/repository/authors/id/A/AB/ABC/
+
+ # make index file
+ % orepan_index.pl --repository=/path/to/repository
+
+ # remove module and recreate index
+ % rm /path/to/repository/authors/id/A/AB/ABC/MyModule-0.04.tar.gz
% orepan_index.pl --repository=/path/to/repository
- # and so...
+ # and use it
% cpanm --mirror-only --mirror=file:///path/to/repository Foo
=head1 DESCRIPTION
+OrePAN is yet another CPAN mirror aka DarkPAN repository manager.
+
+orepan_index.pl is CPAN mirror aka DarkPAN index builder.
+orepan_index.pl parses all tarballs in specified repository directory, and makes 02packages.txt.gz file.
+
+You can use the directory aka DarkPAN with `cpanm --mirror`.
+
+If you want to add other mouldes to repository in one command, you can use L<orepan.pl>
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<--repository>
+
+Set a directory that use as DarkPAN repository
+
+=back
=head1 AUTHOR
View
1 t/02_make_whois.t
@@ -4,6 +4,7 @@ use utf8;
use Test::More;
use OrePAN::Package::Whois;
use File::Temp;
+use IO::File;
my $tmp = File::Temp->new();

No commit comments for this range

Something went wrong with that request. Please try again.