mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 08:39:08 +03:00
nix-generate-from-cpan: Hack to handle non-UTF-8 META.yml files
This commit is contained in:
parent
ccda14879e
commit
15c1ca9d21
@ -3,7 +3,7 @@
|
||||
stdenv.mkDerivation {
|
||||
name = "nix-generate-from-cpan-1";
|
||||
|
||||
buildInputs = [ makeWrapper perl perlPackages.YAML perlPackages.JSON ];
|
||||
buildInputs = [ makeWrapper perl perlPackages.YAMLLibYAML perlPackages.JSON ];
|
||||
|
||||
unpackPhase = "true";
|
||||
buildPhase = "true";
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
use strict;
|
||||
use CPANPLUS::Backend;
|
||||
use YAML;
|
||||
use YAML::XS;
|
||||
use JSON;
|
||||
|
||||
my $module_name = $ARGV[0];
|
||||
@ -50,7 +50,13 @@ print STDERR "unpacked to: $pkg_path\n";
|
||||
|
||||
my $meta;
|
||||
if (-e "$pkg_path/META.yml") {
|
||||
$meta = YAML::LoadFile("$pkg_path/META.yml");
|
||||
eval {
|
||||
$meta = YAML::XS::LoadFile("$pkg_path/META.yml");
|
||||
};
|
||||
if ($@) {
|
||||
system("iconv -f windows-1252 -t utf-8 '$pkg_path/META.yml' > '$pkg_path/META.yml.tmp'");
|
||||
$meta = YAML::XS::LoadFile("$pkg_path/META.yml.tmp");
|
||||
}
|
||||
}
|
||||
|
||||
print STDERR "metadata: ", encode_json($meta), "\n";
|
||||
|
Loading…
Reference in New Issue
Block a user