File tree 2 files changed +32
-0
lines changed
2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,8 @@ def install
188
188
# Find and link metafiles
189
189
formula . prefix . install_metafiles formula . buildpath
190
190
formula . prefix . install_metafiles formula . libexec if formula . libexec . exist?
191
+
192
+ normalize_pod2man_outputs! ( formula )
191
193
end
192
194
end
193
195
end
@@ -217,6 +219,11 @@ def fixopt(formula)
217
219
rescue
218
220
raise "#{ formula . opt_prefix } not present or broken\n Please reinstall #{ formula . full_name } . Sorry :("
219
221
end
222
+
223
+ def normalize_pod2man_outputs! ( formula )
224
+ keg = Keg . new ( formula . prefix )
225
+ keg . normalize_pod2man_outputs!
226
+ end
220
227
end
221
228
222
229
begin
Original file line number Diff line number Diff line change @@ -555,6 +555,31 @@ def delete_pyc_files!
555
555
path . find { |pn | FileUtils . rm_rf pn if pn . basename . to_s == "__pycache__" }
556
556
end
557
557
558
+ def normalize_pod2man_outputs!
559
+ manpages = Dir [ path /"share/man/*/*" ]
560
+ generated_regex = /^\. \\ "\s *Automatically generated by .*\n /
561
+ manpages . each do |f |
562
+ manpage = Pathname . new ( f )
563
+ next unless manpage . file?
564
+
565
+ content = manpage . read
566
+ content = content . gsub ( generated_regex , "" )
567
+ content = content . lines . map do |line |
568
+ next line unless line . start_with? ( ".TH" )
569
+
570
+ # Split the line by spaces, but preserve quoted strings
571
+ parts = line . split ( /\s (?=(?:[^"]|"[^"]*")*$)/ )
572
+ next line if parts . length != 6
573
+
574
+ # pod2man embeds the perl version used into the 5th field of the footer
575
+ T . must ( parts [ 4 ] ) . gsub! ( /^"perl v.*"$/ , "\" \" " )
576
+ "#{ parts . join ( " " ) } \n "
577
+ end . join
578
+
579
+ manpage . atomic_write ( content )
580
+ end
581
+ end
582
+
558
583
def binary_executable_or_library_files
559
584
[ ]
560
585
end
You can’t perform that action at this time.
0 commit comments