diff --git a/bin/install.pike b/bin/install.pike index a2099ac7c53eaa53d63d4f60fff05147688c3081..708d8861b689650811e1571363ee5dc68e9f9016 100644 --- a/bin/install.pike +++ b/bin/install.pike @@ -118,21 +118,20 @@ void status(string doing, void|string file, string|void msg) file="..."+file[strlen(file)-47..]; if(msg) file+=" "+msg; - if(doing) file=doing+" "+file; - string s="\r"+file; + if(doing) file=doing+": "+file; + string s="\r "+file; int t=strlen(s); if(t<last_len) s+=" "*(last_len-t); last_len=t; write(s); } -void status_clear() +void status_clear(void|int all) { - if(last_len) - { + if(all) + last_len = 75; status(0,""); status(0,""); - } } @@ -147,7 +146,7 @@ int mkdirhier(string orig_dir) if(dir=="" || (strlen(dir)==2 && dir[-1]==':')) return 1; dir=fakeroot(dir); - status("creating",dir+"/"); + status("Creating",dir+"/"); mixed s=file_stat(dir); if(s) @@ -203,11 +202,11 @@ int low_install_file(string from, to=fakeroot(to); - status("installing",to); + status("Installing",to); if(compare_files(from,to)) { - status("installing",to,"Already installed"); + status("Installing",to,"Already installed"); return 0; } mkdirhier(dirname(to)); @@ -407,7 +406,7 @@ void do_export() #ifdef __NT__ status("Creating",export_base_name+".burk"); Stdio.File p=Stdio.File(export_base_name+".burk","wc"); - string msg="Loading installation script, please wait..."; + string msg=" Loading Pike installation script, please wait..."; p->write("w%4c%s",strlen(msg),msg); #define TRANSLATE(X,Y) combine_path(".",X) : Y @@ -511,7 +510,7 @@ do case \"$1\" in -v|\\ --version) echo \""+version()+ -#" Copyright (C) 1994-2000 Fredrik H�binette and Idonex AB +#" Copyright (C) 1994-2000 Fredrik H�binette and Roxen Internet Software AB Pike comes with ABSOLUTELY NO WARRANTY; This is free software and you are welcome to redistribute it under certain conditions; Read the files COPYING and DISCLAIMER in the Pike distribution for more details. @@ -531,7 +530,7 @@ COPYING and DISCLAIMER in the Pike distribution for more details. shift done " - "echo \"Loading installation script, please wait...\"\n" + "echo \" Loading Pike installation script, please wait...\"\n" "tar xf \"$TARFILE\" "+tmpname+".tar.gz\n" "gzip -dc "+tmpname+".tar.gz | tar xf -\n" "rm -rf "+tmpname+".tar.gz\n" @@ -949,13 +948,14 @@ int pre_install(array(string) argv) }; #endif + status1(""); + // FIXME: // The following introduction is not quite true on NT // and other platforms where Readline falls back on // 'dummy' mode. - write("\n" - " Welcome to the interactive "+version()+ + write(" Welcome to the interactive "+version()+ " installation script.\n" "\n" #ifndef __NT__ @@ -967,7 +967,7 @@ int pre_install(array(string) argv) #else " The script will guide you through the installation process by asking\n" - " a few questions. You will be able to confirm your settings before\n" + " a few questions. You will be able to confirm your settings before\n" " the installation begin.\n" #endif ); @@ -1012,6 +1012,8 @@ int pre_install(array(string) argv) } while(!(confirm == "" || confirm == "y")); + write("\n"); + vars->pike_name = bin_path; destruct(interactive); @@ -1104,7 +1106,7 @@ void do_install() pike=combine_path(exec_prefix,"pike"); if(!export) { - status1("Installing Pike in %s...\n",fakeroot(prefix)); + status1("Please wait, installing Pike in %s...\n", fakeroot(prefix)); } mixed err=catch { @@ -1210,10 +1212,11 @@ void do_install() if(sizeof(to_dump)) { rm("dumpmodule.log"); - status("Dumping modules, please ignore any errors at this point.."); - foreach(to_dump, string mod) rm(mod+".o"); + + foreach(to_dump, string mod) + rm(mod+".o"); + /* Dump 50 modules at a time */ - write("\n"); array cmd=({fakeroot(pike) }); @@ -1242,11 +1245,20 @@ void do_install() // werror("%O\n",cmd); - foreach(to_dump/50.0,to_dump) + int offset = 1; + foreach(to_dump/50.0, array delta_dump) { - write(" "); - Process.create_process(cmd+ to_dump, options)->wait(); + Process.create_process(cmd + + ({ + "--progress-bar", + sprintf("%d,%d", offset, sizeof(to_dump)) + }) + + delta_dump, options)->wait(); + + offset += sizeof(delta_dump); } + + status_clear(1); } // Delete any .pmod files that would shadow the .so @@ -1257,7 +1269,7 @@ void do_install() #if constant(symlink) if(lnk) { - status("creating",lnk); + status("Creating",lnk); mixed s=file_stat(fakeroot(lnk),1); if(s) { @@ -1272,7 +1284,7 @@ void do_install() } mkdirhier(fakeroot(dirname(lnk))); symlink(pike,fakeroot(lnk)); - status("creating",lnk,"done"); + status("Creating",lnk,"done"); } #endif } diff --git a/src/dumpmodule.pike b/src/dumpmodule.pike index 88539fdd1d47ee1c14e97f4d3596c8a232c010a8..c0a812070477d6da7389568dada118a94e659389 100755 --- a/src/dumpmodule.pike +++ b/src/dumpmodule.pike @@ -143,6 +143,12 @@ class Codec int quiet=0; +constant progress_width = 45; + +int progress_bar = 0; +int progress_offset = 0; +int progress_max = 0; + Stdio.File logfile; class Handler @@ -232,6 +238,22 @@ void dumpit(string file) } } +void update_progress(string name, int cur, int max) +{ + float ratio = (float)cur/(float)max; + int bar = (int)(ratio * (float)progress_width); + + int is_full = bar == progress_width; + + werror("\r %s: |%s%c%s%s %4.1f %% ", + name, + "="*bar, + is_full ? '|' : ({ '\\', '|', '/', '-' })[cur & 3], + is_full ? "" : " "*(progress_width-bar-1), + is_full ? "" : "|", + 100.0 * ratio); +} + int main(int argc, string *argv) { foreach( (array)all_constants(), [string name, mixed func]) @@ -242,7 +264,10 @@ int main(int argc, string *argv) function_names[Stdio.stderr]="resolv:Stdio.stderr"; function_names[_static_modules.Builtin]="resolv:_"; - if(argv[1]=="--quiet") + // Remove the name of the program. + argv = argv[1..]; + + if(argv[0]=="--quiet") { quiet=1; argv=argv[1..]; @@ -254,15 +279,31 @@ int main(int argc, string *argv) // werror("Dumping modules "); } - if(argv[1]=="--distquiet") + if(argv[0]=="--distquiet") { quiet=2; argv=argv[1..]; logfile=0; } - foreach(argv[1..],string file) + if(argv[0] == "--progress-bar") + { + quiet = 2; + logfile = Stdio.File("dumpmodule.log","caw"); + + progress_bar = 1; + sscanf(argv[1], "%d,%d", progress_offset, progress_max); + + argv = argv[2..]; + } + + foreach(argv, string file) + { + if(progress_bar) + update_progress("Precompiling", progress_offset++, progress_max); + dumpit(file); + } if(quiet==1) werror("\n");