Merge branch 'master' of boinc.berkeley.edu:boinc-v2

This commit is contained in:
David Anderson 2013-12-04 20:01:14 +00:00
commit 82df71b71e
10 changed files with 682 additions and 579 deletions

View File

@ -214,7 +214,9 @@ wxInt32 CBOINCTaskCtrl::UpdateControls() {
// Force update layout and scrollbars, since nothing we do here
// necessarily generates a size event which would do it for us.
FitInside();
if (layoutChanged) {
Fit ();
}
return layoutChanged;
}

View File

@ -342,11 +342,9 @@ void CProjectInfoPage::CreateControls()
itemFlexGridSizer33->Add(m_pProjectURLStaticCtrl, 0, wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_pProjectURLCtrl = new wxTextCtrl( itemWizardPage23, ID_PROJECTURLCTRL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
itemFlexGridSizer33->Add(m_pProjectURLCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
itemFlexGridSizer33->Add(m_pProjectURLCtrl, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5);
#ifdef __WXMAC__
itemFlexGridSizer33->Add(0, 20, 0);
#endif
itemFlexGridSizer33->Add(0, 10, 0);
// Set validators
m_pProjectURLCtrl->SetValidator( CValidateURL( & m_strProjectURL ) );

View File

@ -56,7 +56,7 @@ $language_names = array(
function language_select() {
global $language_names;
$supported_languages = getSupportedLanguages();
$supported_languages = get_supported_languages();
$supported_languages[] = "en";
$bd = tra("Browser default");
echo "

View File

@ -25,7 +25,7 @@ $lang_log_level = 1;
// Get a list of compiled languages by scanning the compiled/ dir
// @returns A list of languages that have been compiled
//
function getSupportedLanguages(){
function get_supported_languages() {
global $lang_language_dir, $lang_compiled_dir;
$list = array();
if (!is_dir($lang_language_dir.$lang_compiled_dir)) {
@ -43,15 +43,21 @@ function getSupportedLanguages(){
return $list;
}
// Builds the lookup arrays from the
// language files found in the given directory tree.
// generate PHP files defining translation arrays.
// For example, the file "ca.po.inc" would contain entries of the form
// $language_lookup_array["ca"]["Default"] = "Defecte";
//
// Append to these files if they already exist
// (this may get done for both generic and project-specific translations)
//
// @param langdir The language base directory
// @param transdir The location of the .po files to compile relative to langdir
// @param compdir The output location relative to langdir
//
function buildLanguages($langdir, $transdir, $compdir){
function build_translation_array_files($langdir, $transdir, $compdir) {
// Run through each language and compile their lookup arrays.
//
if (!is_dir($langdir.$transdir)) {
//debug("$info_dir not found or is not a directory");
}
@ -61,7 +67,7 @@ function buildLanguages($langdir, $transdir, $compdir){
if ($file==".." || $file==".") {
continue;
}
// and only do files ending in .po
// only do files ending in .po
if (substr($file,-3) != ".po"){
//debug("File $file with unknown extension found in $info_dir");
continue;
@ -69,7 +75,7 @@ function buildLanguages($langdir, $transdir, $compdir){
language_log(
"-------------Compiling $transdir$file------------", 0
);
$language = parseLanguage($langdir.$transdir.$file);
$language = parse_po_file($langdir.$transdir.$file);
if (!$language){
language_log(
"WARNING: Could not parse language ".$file
@ -106,7 +112,7 @@ function buildLanguages($langdir, $transdir, $compdir){
// @param file The file to parse
// checking for inconsistencies if needed.
//
function parseLanguage($file){
function parse_po_file($file) {
$translation_file = file($file);
$first_entry = true;
$current_token_text="";
@ -124,25 +130,26 @@ function parseLanguage($file){
//If this is not the first, save the previous entry
$output[$current_token]=$current_token_text;
}
$current_token = getPOLineContent($entry, $file);
$current_token = get_po_line($entry, $file);
$current_token_text="";
$parsing_token = true;
$parsing_text = false;
$first_entry=false;
} elseif (strpos($entry, "msgstr") !== false) {
$current_token_text = getPOLineContent($entry, $file);
$current_token_text = get_po_line($entry, $file);
$parsing_token = false;
$parsing_text = true;
} elseif ($parsing_token) {
$current_token .= getPOLineContent($entry, $file);
$current_token .= get_po_line($entry, $file);
} elseif ($parsing_text) {
$current_token_text.=getPOLineContent($entry, $file);
$current_token_text .= get_po_line($entry, $file);
}
}
// Get the last token
//
if ($current_token && $current_token_text){
$output[$current_token]=$current_token_text;
$output[$current_token] = $current_token_text;
}
return $output;
}
@ -150,7 +157,7 @@ function parseLanguage($file){
// Returns the contents of a line (ie removes "" from start and end)
//
function getPOLineContent($line, $file){
function get_po_line($line, $file) {
$start = strpos($line, '"')+1;
$stop = strrpos($line, '"');
$x = substr($line, $start, $stop-$start);
@ -162,9 +169,12 @@ function getPOLineContent($line, $file){
return $x;
}
////////// EVERYTHING BEFORE HERE IS FOR ops/update_translations.php,
////////// AND SHOULD BE MOVED TO A SEPARATE FILE
// Translate string
//
function tra($text /* ...arglist... */){
function tra($text /* ...arglist... */) {
global $language_lookup_array, $languages_in_use;
// Find the string in the user's language
@ -190,7 +200,7 @@ function tra($text /* ...arglist... */){
return $text;
}
function tr_specific($text, $language){
function tr_specific($text, $language) {
global $lang_language_dir, $lang_compiled_dir, $language_lookup_array;
$file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
if (file_exists($file_name)) {
@ -200,7 +210,7 @@ function tr_specific($text, $language){
return $text;
}
function language_log($message, $loglevel=0){
function language_log($message, $loglevel=0) {
global $lang_log_level;
if ($loglevel==0) $msg = "[ Debug ]";
if ($loglevel==1) $msg = "[ Warning ]";
@ -232,7 +242,7 @@ if (isset($_SERVER["HTTP_ACCEPT_LANGUAGE"])) {
// [2] => en;q=0.3
// )
$client_languages=explode(",",$language_string);
$client_languages = explode(",", $language_string);
// A language is either defined as primary-secondary or primary.
// It can also have a quality attribute set,
@ -247,21 +257,21 @@ $languages_in_use = array();
//
for ($i=0; $i<sizeof($client_languages); $i++) {
if ((strlen($client_languages[$i])>2)
&& (substr($client_languages[$i],2,1)=="_" || substr($client_languages[$i],2,1)=="-"))
{
&& (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-")
){
// If this is defined as primary-secondary, represent it as xx_YY
//
$language = substr(
$client_languages[$i],0,2)."_".strtoupper(substr($client_languages[$i],3,2)
$client_languages[$i], 0, 2)."_".strtoupper(substr($client_languages[$i], 3, 2)
);
// And also check for the primary language
//
$language2 = substr($client_languages[$i],0,2);
$language2 = substr($client_languages[$i], 0, 2);
} else {
// else just use xx
//
$language = substr($client_languages[$i],0,2);
$language = substr($client_languages[$i], 0, 2);
$language2 = null;
}
@ -272,6 +282,7 @@ for ($i=0; $i<sizeof($client_languages); $i++) {
}
// If we have a translation for the language, include it
//
$file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc";
if (file_exists($file_name)) {
if (!in_array($language, $languages_in_use)){

View File

@ -34,11 +34,15 @@ if ($argc >= 3 && $argv[1] == '-d') {
// process the generic BOINC web site strings
//
buildLanguages($lang_language_dir, $lang_translations_dir, $lang_compiled_dir);
build_translation_array_files(
$lang_language_dir, $lang_translations_dir, $lang_compiled_dir
);
// process the project-specific strings
//
buildLanguages($lang_language_dir, $lang_prj_translations_dir, $lang_compiled_dir);
build_translation_array_files(
$lang_language_dir, $lang_prj_translations_dir, $lang_compiled_dir
);
echo "update_translations finished\n";

View File

@ -22,7 +22,7 @@ require_once("../inc/translation.inc");
check_get_args(array("set_lang"));
$languages = getSupportedLanguages();
$languages = get_supported_languages();
if (!is_array($languages)) {
error_page("Language selection not enabled. Project admins must run the update_translations.php script.");
}

File diff suppressed because it is too large Load Diff

View File

@ -96,6 +96,7 @@ struct VBOX_VM {
int rd_host_port;
// dynamically assigned
bool headless;
#ifdef _WIN32
// the handle to the process for the VM
// NOTE: we get a handle to the pid right after we parse it from the
@ -106,14 +107,22 @@ struct VBOX_VM {
HANDLE vm_pid_handle;
// the handle to the vboxsvc process created by us in the sandbox'ed environment
HANDLE vboxsvc_handle;
HANDLE vboxsvc_pid_handle;
#else
// the pid to the VM process
int vm_pid;
#endif
int initialize();
void poll(bool log_state = true);
int register_vm();
int deregister_vm(bool delete_media);
int deregister_stale_vm();
int run(double elapsed_time);
void cleanup();
int start();
int stop();
int poweroff();
@ -122,8 +131,6 @@ struct VBOX_VM {
int createsnapshot(double elapsed_time);
int cleanupsnapshots(bool delete_active);
int restoresnapshot();
void cleanup();
void poll(bool log_state = true);
void dumphypervisorlogs();
bool is_system_ready(std::string& message);
@ -138,17 +145,13 @@ struct VBOX_VM {
bool is_virtualbox_version_newer(int maj, int min, int rel);
bool is_virtualbox_error_recoverable(int retval);
int register_vm();
int deregister_vm(bool delete_media);
int deregister_stale_vm();
int get_install_directory(std::string& dir);
int get_slot_directory(std::string& dir);
int get_network_bytes_sent(double& sent);
int get_network_bytes_received(double& received);
int get_system_log(std::string& log);
int get_vm_exit_code(unsigned long& exit_code);
int get_vm_process_id(int& process_id);
int get_vm_exit_code(unsigned long& exit_code);
int get_port_forwarding_port();
int get_remote_desktop_port();

View File

@ -656,10 +656,6 @@ int main(int argc, char** argv) {
char* temp_reason = (char*)"";
int temp_delay = 300;
// Attempt to cleanup the VM
vm.cleanup();
write_checkpoint(elapsed_time, vm);
fprintf(
stderr,
"%s VM failed to start.\n",
@ -704,13 +700,55 @@ int main(int argc, char** argv) {
);
unrecoverable_error = false;
temp_reason = (char*)"VM Hypervisor was unable to allocate enough memory to start VM.";
} else if (ERR_NOT_EXITED == retval) {
fprintf(
stderr,
"%s NOTE: VM was already running.\n"
" BOINC will be notified that it needs to clean up the environment.\n"
" This might be a temporary problem and so this job will be rescheduled for another time.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
unrecoverable_error = false;
temp_reason = (char*)"VM environment needed to be cleaned up.";
} else if (vm.is_virtualbox_error_recoverable(retval)) {
fprintf(
stderr,
"%s NOTE: VM session lock error encountered.\n"
" BOINC will be notified that it needs to clean up the environment.\n"
" This might be a temporary problem and so this job will be rescheduled for another time.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf))
);
unrecoverable_error = false;
temp_reason = (char*)"VM environment needed to be cleaned up.";
} else {
vm.dumphypervisorlogs();
}
if (unrecoverable_error) {
// Attempt to cleanup the VM and exit.
vm.cleanup();
write_checkpoint(elapsed_time, vm);
boinc_finish(retval);
} else {
// if the VM is already running notify BOINC about the process ID so it can
// clean up the environment. We should be safe to run after that.
//
vm.get_vm_process_id(vm_pid);
if (vm_pid) {
retval = boinc_report_app_status_aux(
elapsed_time,
checkpoint_cpu_time,
fraction_done,
vm_pid,
bytes_sent,
bytes_received
);
}
// Give the BOINC API time to report the pid to BOINC.
boinc_sleep(5.0);
// Exit and let BOINC clean up the rest.
boinc_temporary_exit(temp_delay, temp_reason);
}
}

View File

@ -128,12 +128,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;wsock32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26045_windows_intelx86.exe</OutputFile>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26050_windows_intelx86.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26045_windows_intelx86.pdb</ProgramDatabaseFile>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26050_windows_intelx86.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
@ -177,12 +177,12 @@
</ResourceCompile>
<Link>
<AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;gdi32.lib;ole32.lib;wsock32.lib;psapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26045_windows_x86_64.exe</OutputFile>
<OutputFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26050_windows_x86_64.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26045_windows_x86_64.pdb</ProgramDatabaseFile>
<ProgramDatabaseFile>.\Build\$(Platform)\$(Configuration)\vboxwrapper_26050_windows_x86_64.pdb</ProgramDatabaseFile>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX64</TargetMachine>
</Link>