nix-generate-from-cpan: large refactor

This commit includes a substantial refactoring of
`nix-generate-from-cpan`. This somewhat simplifies the code through the
use of the CPAN::Meta module while adding the following features:

 - The program now takes an optional maintainer on the command line that
   is subsequently added into the generated package.

 - An attempt is made to convert the license specified inside the
   META.json or META.yaml file to a license in `stdenv.lib.licenses`.

 - An attempt is made to disambiguate attribute names of packages whose
   name is a reserved word in Nix.

 - Write logging output using Log::Log4perl.

 - Print module RSS feed URL. The RSS feed, hosted by MetaCPAN, can be
   used to track updates to the module.
This commit is contained in:
Robert Helgesson 2015-10-30 01:04:31 +01:00
parent 8f9aea9ccc
commit c90c30dd1e
2 changed files with 390 additions and 99 deletions

View file

@ -1,22 +1,24 @@
{ stdenv, makeWrapper, perl, perlPackages }:
stdenv.mkDerivation {
name = "nix-generate-from-cpan-1";
name = "nix-generate-from-cpan-2";
buildInputs = [ makeWrapper perl perlPackages.YAMLLibYAML perlPackages.JSON perlPackages.CPANPLUS ];
buildInputs = with perlPackages; [
makeWrapper perl CPANMeta GetoptLongDescriptive CPANPLUS Readonly Log4Perl
];
unpackPhase = "true";
buildPhase = "true";
phases = [ "installPhase" ];
installPhase =
''
mkdir -p $out/bin
cp ${./nix-generate-from-cpan.pl} $out/bin/nix-generate-from-cpan
patchShebangs $out/bin/nix-generate-from-cpan
wrapProgram $out/bin/nix-generate-from-cpan --set PERL5LIB $PERL5LIB
'';
meta = {
maintainers = [ stdenv.lib.maintainers.eelco ];
maintainers = with stdenv.lib.maintainers; [ eelco rycee ];
description = "Utility to generate a Nix expression for a Perl package from CPAN";
};
}