CPAN-Patches-Plugin-Debian

 view release on metacpan or  search on metacpan

lib/CPAN/Patches/Plugin/Debian.pm  view on Meta::CPAN

use File::Path 'make_path';
use Storable 'dclone';
use Test::Deep::NoTest 'eq_deeply';
use File::Copy 'copy';
use Parse::Deb::Control '0.03';
use File::chdir;
use Debian::Dpkg::Version 'version_compare';
use CPAN::Patches 0.04;
use File::Basename 'basename';

sub update_debian {
    my $self = shift;
    my $path = shift || '.';
    
    $self = $self->new()
        if not blessed $self;
    
    my $debian_path             = File::Spec->catdir($path, 'debian');
    my $debian_patches_path     = File::Spec->catdir($debian_path, 'patches');
    my $debian_control_filename = File::Spec->catdir($debian_path, 'control');
    croak 'debian/ folder not found'

script/cpan-patches-update-from-debian  view on Meta::CPAN

		if not -d $pkg_perl_folder;
	die $cpan_patches_folder.' no such folder'
		if not -d $cpan_patches_folder;
	
	update_patches($pkg_perl_folder, $cpan_patches_folder);
	update_debian($pkg_perl_folder, $cpan_patches_folder);
	
	return 0;
}

sub update_debian {
	my $pkg_perl_folder     = shift or die;
	my $cpan_patches_folder = shift or die;
	
	my $cpanp = CPAN::Patches->new();
	
	my %metas =
		map { %{$_} }
		grep { (%{$_})[1] }    # only with parsable meta
		map {
			{ $_ => eval { $cpanp->read_meta($_) } || 0 }

script/cpan-patches-update-from-debian  view on Meta::CPAN

						if -f $dst_inst;
				}
				else {
					copy($src_inst, $dst_inst) or die $!;
				}
			}
		}
	}
}

sub update_patches {
	my $pkg_perl_folder     = shift or die;
	my $cpan_patches_folder = shift or die;
	
	my %series =
		map { %{$_} }
		grep { (%{$_})[1] }    # only with parsable meta
		map { { $_ => eval { CPAN::Patches->read_meta($_) } || 0 } }    # parse meta
		map { $_->stringify }
		map { $_->parent->parent }
		map { file($_) }



( run in 0.254 second using v1.01-cache-2.11-cpan-4d4bc49f3ae )