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