@@ -28,7 +28,7 @@ use build_helper::output;
28
28
29
29
use { Build , Compiler , Mode } ;
30
30
use channel;
31
- use util:: { cp_r, libdir, is_dylib, cp_filtered, copy} ;
31
+ use util:: { cp_r, libdir, is_dylib, cp_filtered, copy, replace_in_file } ;
32
32
use builder:: { Builder , RunConfig , ShouldRun , Step } ;
33
33
use compile;
34
34
use tool:: { self , Tool } ;
@@ -434,7 +434,22 @@ impl Step for Rustc {
434
434
435
435
// Man pages
436
436
t ! ( fs:: create_dir_all( image. join( "share/man/man1" ) ) ) ;
437
- cp_r ( & build. src . join ( "src/doc/man" ) , & image. join ( "share/man/man1" ) ) ;
437
+ let man_src = build. src . join ( "src/doc/man" ) ;
438
+ let man_dst = image. join ( "share/man/man1" ) ;
439
+ let date_output = output ( Command :: new ( "date" ) . arg ( "+%B %Y" ) ) ;
440
+ let month_year = date_output. trim ( ) ;
441
+ // don't use our `bootstrap::util::{copy, cp_r}`, because those try
442
+ // to hardlink, and we don't want to edit the source templates
443
+ for entry_result in t ! ( fs:: read_dir( man_src) ) {
444
+ let file_entry = t ! ( entry_result) ;
445
+ let page_src = file_entry. path ( ) ;
446
+ let page_dst = man_dst. join ( file_entry. file_name ( ) ) ;
447
+ t ! ( fs:: copy( & page_src, & page_dst) ) ;
448
+ // template in month/year and version number
449
+ replace_in_file ( & page_dst,
450
+ & [ ( "<INSERT DATE HERE>" , month_year) ,
451
+ ( "<INSERT VERSION HERE>" , channel:: CFG_RELEASE_NUM ) ] ) ;
452
+ }
438
453
439
454
// Debugger scripts
440
455
builder. ensure ( DebuggerScripts {
0 commit comments