Changeset 31878 for main/trunk/gli

Show
Ignore:
Timestamp:
11.08.2017 18:22:36 (2 years ago)
Author:
ak19
Message:

1. Previous commit message was incorrect: it wasn't that perl wasn't found that resulted in the open3() failure error message, but that something on the PATH wasn't available to it, possible wget itself. 2. Updating unused DownloadJob?.old_callDownload() to have the recently committed changes in callDownload(). 3. Emacs tabbing for recently committed files.

Location:
main/trunk/gli/src/org/greenstone/gatherer/download
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/gli/src/org/greenstone/gatherer/download/DownloadJob.java

    r31877 r31878  
    310310        Process prcs = null;  
    311311 
    312           
    313         if (Utility.isWindows()) { 
    314                 prcs = rt.exec(cmd);    
     312        if (proxy_url != null && !proxy_url.equals("")) {            
     313        // Specify proxies as environment variables 
     314        // Need to manually specify GSDLHOME and GSDLOS also 
     315         
     316        proxy_url = proxy_url.replaceAll("http://",""); 
     317         
     318        env = new String[7]; 
     319         
     320        env[0] = "http_proxy=http://"+proxy_url; 
     321        env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 
     322        // see also https://wiki.archlinux.org/index.php/proxy_settings 
     323        env[2] = "ftp_proxy=ftp://"+proxy_url; 
     324        env[3] = "GSDLHOME=" + Configuration.gsdl_path; 
     325        env[4] = "GSDLOS=" + Gatherer.client_operating_system; 
     326        // teach it where the wgetrc file lives, in gs2build/bin/<os>: 
     327        env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; 
     328        // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by 
     329        // WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails. 
     330        // So make PATH available to get open3() working: 
     331        env[6] = "PATH="+System.getenv("PATH");      
     332         
     333        prcs = rt.exec(cmd, env); 
     334        }  
     335        else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 
     336        // Not Windows, but running client with download panel 
     337        // Need to manually specify GSDLHOME and GSDLOS 
     338        env = new String[3]; 
     339        env[0] = "GSDLHOME=" + Configuration.gsdl_path; 
     340        env[1] = "GSDLOS=" + Gatherer.client_operating_system; 
     341        env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
     342        prcs = rt.exec(cmd, env); 
    315343        } 
    316344        else { 
    317         if (proxy_url != null && !proxy_url.equals("")) {            
    318             // Specify proxies as environment variables 
    319             // Need to manually specify GSDLHOME and GSDLOS also 
    320             env = new String[6]; 
    321                     proxy_url = proxy_url.replaceAll("http://",""); 
    322             env[0] = "http_proxy=http://"+proxy_url; 
    323             env[1] = "https_proxy=http://"+proxy_url; // HTTP protocol for https:// too 
    324                         // see also https://wiki.archlinux.org/index.php/proxy_settings 
    325             env[2] = "ftp_proxy=ftp://"+proxy_url; 
    326             env[3] = "GSDLHOME=" + Configuration.gsdl_path; 
    327             env[4] = "GSDLOS=" + Gatherer.client_operating_system; 
    328             env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
    329             prcs = rt.exec(cmd, env);  
    330         }  
    331         else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled) { 
    332             // Not Windows, but running client with download panel 
    333             // Need to manually specify GSDLHOME and GSDLOS 
    334             env = new String[3]; 
    335             env[0] = "GSDLHOME=" + Configuration.gsdl_path; 
    336             env[1] = "GSDLOS=" + Gatherer.client_operating_system; 
    337             env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
    338             prcs = rt.exec(cmd, env);  
    339         } 
    340         else { 
    341             // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 
    342             prcs = rt.exec(cmd); 
    343         } 
     345        // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 
     346        prcs = rt.exec(cmd); 
    344347        } 
    345348        //System.out.println(newcmd);        
     
    620623        String [] env = null; 
    621624 
    622         if (proxy_url != null && !proxy_url.equals("")) {            
    623             // Specify proxies as environment variables 
    624             // Need to manually specify GSDLHOME and GSDLOS also 
    625              
    626             proxy_url = proxy_url.replaceAll("http://",""); 
    627                      
    628             env = new String[7]; 
    629              
    630             env[0] = "http_proxy=http://"+proxy_url; 
    631             env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 
    632                            // see also https://wiki.archlinux.org/index.php/proxy_settings 
    633             env[2] = "ftp_proxy=ftp://"+proxy_url; 
    634             env[3] = "GSDLHOME=" + Configuration.gsdl_path; 
    635             env[4] = "GSDLOS=" + Gatherer.client_operating_system; 
    636             env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
    637             // If PATH is not made available, so that Perl is not on the PATH, then WgetDownload.pm's open3() call 
    638             // to run wget fails with cryptic failure message. So make PATH available for open3(): 
    639             env[6] = "PATH="+System.getenv("PATH");      
    640              
    641             prcs = new SafeProcess(cmd, env, null); 
    642         }  
    643         else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 
    644             // Not Windows, but running client with download panel 
    645             // Need to manually specify GSDLHOME and GSDLOS 
    646             env = new String[3]; 
    647             env[0] = "GSDLHOME=" + Configuration.gsdl_path; 
    648             env[1] = "GSDLOS=" + Gatherer.client_operating_system; 
    649             env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
    650             prcs = new SafeProcess(cmd, env, null); 
    651         } 
    652         else { 
    653             // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 
    654             prcs = new SafeProcess(cmd); 
    655         } 
    656  
     625        if (proxy_url != null && !proxy_url.equals("")) {            
     626        // Specify proxies as environment variables 
     627        // Need to manually specify GSDLHOME and GSDLOS also 
     628         
     629        proxy_url = proxy_url.replaceAll("http://",""); 
     630         
     631        env = new String[7]; 
     632         
     633        env[0] = "http_proxy=http://"+proxy_url; 
     634        env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 
     635        // see also https://wiki.archlinux.org/index.php/proxy_settings 
     636        env[2] = "ftp_proxy=ftp://"+proxy_url; 
     637        env[3] = "GSDLHOME=" + Configuration.gsdl_path; 
     638        env[4] = "GSDLOS=" + Gatherer.client_operating_system; 
     639        // teach it where the wgetrc file lives, in gs2build/bin/<os>: 
     640        env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; 
     641        // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by 
     642        // WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails. 
     643        // So make PATH available to get open3() working: 
     644        env[6] = "PATH="+System.getenv("PATH");      
     645         
     646        prcs = new SafeProcess(cmd, env, null); 
     647        }  
     648        else if(Gatherer.isGsdlRemote && Gatherer.isDownloadEnabled && !Utility.isWindows()) { 
     649        // Not Windows, but running client with download panel 
     650        // Need to manually specify GSDLHOME and GSDLOS 
     651        env = new String[3]; 
     652        env[0] = "GSDLHOME=" + Configuration.gsdl_path; 
     653        env[1] = "GSDLOS=" + Gatherer.client_operating_system; 
     654        env[2] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
     655        prcs = new SafeProcess(cmd, env, null); 
     656        } 
     657        else { 
     658        // Will inherit the GLI's environment, with GSDLHOME and GSDLOS set 
     659        prcs = new SafeProcess(cmd); 
     660        } 
     661         
    657662        //System.out.println(newcmd); 
    658663        prcs.setMainHandler(this); // attach handler to clean up before and after process.destroy() 
  • main/trunk/gli/src/org/greenstone/gatherer/download/ServerInfoDialog.java

    r31877 r31878  
    111111            // Need to manually specify GSDLHOME and GSDLOS also 
    112112             
    113             proxy_url = proxy_url.replaceAll("http://",""); 
    114              
    115             String [] env = new String[7]; 
     113            proxy_url = proxy_url.replaceAll("http://",""); 
    116114             
    117             env[0] = "http_proxy=http://"+proxy_url; 
    118             env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 
    119                            // see also https://wiki.archlinux.org/index.php/proxy_settings 
    120             env[2] = "ftp_proxy=ftp://"+proxy_url; 
     115            String [] env = new String[7]; 
     116             
     117            env[0] = "http_proxy=http://"+proxy_url; 
     118            env[1] = "https_proxy=http://"+proxy_url; // yes, HTTP protocol for https:// too 
     119            // see also https://wiki.archlinux.org/index.php/proxy_settings 
     120            env[2] = "ftp_proxy=ftp://"+proxy_url; 
    121121            env[3] = "GSDLHOME=" + Configuration.gsdl_path; 
    122122            env[4] = "GSDLOS=" + Gatherer.client_operating_system; 
    123             env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; // teach it where the wgetrc file lives, in gs2build/bin/<os> 
    124             // If PATH is not made available, so that Perl is not on the PATH, then WgetDownload.pm's open3() call 
    125             // to run wget fails with cryptic failure message. So make PATH available for open3(): 
    126             env[6] = "PATH="+System.getenv("PATH"); 
    127              
     123            // teach it where the wgetrc file lives, in gs2build/bin/<os>: 
     124            env[5] = "WGETRC=" + LocalGreenstone.getBinOSDirectoryPath(Gatherer.client_operating_system)+"wgetrc"; 
     125            // Issue discovered on Windows: If PATH is not made available to perl, so that wget or something else needed by 
     126            // WgetDownload.pm's open3()  call is not on the PATH, then the perl open() call to run wget fails. 
     127            // So make PATH available to get open3() working: 
     128            env[6] = "PATH="+System.getenv("PATH"); 
     129             
    128130            prcs = new SafeProcess(command, env, null); 
    129131        }