Skip to content

Commit 204f57d

Browse files
committed
Fixup possible crlf in generated files
1 parent 331886e commit 204f57d

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

maint/Makefile.PL.inc/12_authordeps.pl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ END
9494
Meta->write;
9595
}
9696

97+
# strip possible crlf from META
98+
if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
99+
local $ENV{PERLIO} = 'unix';
100+
system( $^X, qw( -MExtUtils::Command -e dos2unix -- META.yml), );
101+
}
102+
97103
# test that we really took things away (just in case, happened twice somehow)
98104
if (! -f 'META.yml') {
99105
warn "No META.yml generated?! aborting...\n";

maint/Makefile.PL.inc/53_autogen_pod.pl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,31 @@
8282
}
8383

8484

85+
# on some OSes generated files may have an incorrect \n - fix it
86+
# so that the xt tests pass on a fresh checkout (also shipping a
87+
# dist with CRLFs is beyond obnoxious)
88+
#
89+
# Ironically EUMM's dos2unix is broken on win32 itself - it does
90+
# not take into account the CRLF layer present on win32
91+
# do the ENV trick again
92+
if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
93+
94+
{
95+
local $ENV{PERLIO} = 'unix';
96+
system( $^X, qw( -MExtUtils::Command -e dos2unix -- ), $pod_dir );
97+
}
98+
99+
postamble <<"EOP";
100+
101+
test_xt : dbic_fixup_generated_pod
102+
103+
dbic_fixup_generated_pod :
104+
\t@{[ $mm_proto->oneliner( qq(\$\$ENV{PERLIO}='unix' and system( \$\$^X, qw( -MExtUtils::Command -e dos2unix -- ), q($pod_dir) ) ) ) ]}
105+
106+
EOP
107+
}
108+
109+
85110
# copy the contents of $pod_dir over to the workdir
86111
# (yes, overwriting is fine, though nothing should reside there)
87112
{

maint/Makefile.PL.inc/61_inject_dbicadmin_pod.pl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
# will not do what one expects, because on unixy systems the
77
# target is symlinked to the original
88

9+
# FIXME also on win32 EU::Command::cat() adds crlf even if the
10+
# source files do not contain any :(
11+
my $crlf_fixup = ($^O eq 'MSWin32' or $^O eq 'cygwin')
12+
? "\t@{[ $mm_proto->oneliner( qq(\$\$ENV{PERLIO}='unix' and system( \$\$^X, qw( -MExtUtils::Command -e dos2unix -- ), q(\$(DISTVNAME)/script/dbicadmin) ) ) ) ]}"
13+
: ''
14+
;
915
postamble <<"EOP";
1016
1117
create_distdir : dbic_distdir_dbicadmin_pod_inject
1218
1319
dbic_distdir_dbicadmin_pod_inject :
14-
1520
\t\$(RM_F) \$(DISTVNAME)/script/dbicadmin
1621
\t@{[ $mm_proto->oneliner('cat', ['-MExtUtils::Command']) ]} script/dbicadmin maint/.Generated_Pod/dbicadmin.pod > \$(DISTVNAME)/script/dbicadmin
17-
22+
$crlf_fixup
1823
EOP
1924

2025
# keep the Makefile.PL eval happy

0 commit comments

Comments
 (0)