*** empty log message ***

svn path=/trunk/boinc/; revision=11656
This commit is contained in:
David Anderson 2006-12-12 23:32:25 +00:00
parent d06b0043ba
commit 6d48e0e244
8 changed files with 51 additions and 19 deletions

View File

@ -13318,3 +13318,15 @@ David 12 Dec 2006
lib/ lib/
Makefile.am Makefile.am
updater.C (new) updater.C (new)
David 12 Dec 2006
- bug fixes to auto-update
- don't print spurious error message in mfile.C
client/
auto_update.C
client_types.C,h
file_names.C,h
scheduler_op.C
lib/
mfile.C

View File

@ -44,7 +44,7 @@ int AUTO_UPDATE::parse(MIOFILE& in) {
int retval; int retval;
while (in.fgets(buf, 256)) { while (in.fgets(buf, 256)) {
if (match_tag(buf, "</boinc_update>")) { if (match_tag(buf, "</auto_update>")) {
return 0; return 0;
} else if (match_tag(buf, "<version>")) { } else if (match_tag(buf, "<version>")) {
version.parse(in); version.parse(in);
@ -80,6 +80,8 @@ void AUTO_UPDATE::write(MIOFILE& out) {
void AUTO_UPDATE::handle_in_reply(PROJECT* proj) { void AUTO_UPDATE::handle_in_reply(PROJECT* proj) {
char dir[256], buf[256]; char dir[256], buf[256];
int retval; int retval;
unsigned int i;
FILE_INFO* fip;
if (gstate.auto_update.present) { if (gstate.auto_update.present) {
if (!version.greater_than(gstate.auto_update.version)) { if (!version.greater_than(gstate.auto_update.version)) {
@ -96,17 +98,26 @@ void AUTO_UPDATE::handle_in_reply(PROJECT* proj) {
} }
project = proj; project = proj;
// create version directory and prepend to file names for (i=0; i<file_refs.size(); i++) {
//
boinc_version_dir(version, dir);
retval = boinc_mkdir(dir);
if (retval) return;
gstate.auto_update = *this;
for (unsigned int i=0; i<file_refs.size(); i++) {
FILE_REF& fref = file_refs[i]; FILE_REF& fref = file_refs[i];
FILE_INFO* fip = fref.file_info; fip = gstate.lookup_file_info(project, fref.file_name);
sprintf(buf, "%s/%s", dir, fip->name); if (!fip) {
} msg_printf(project, MSG_ERROR, "missing update file %s", fref.file_name);
return;
}
fref.file_info = fip;
fip->is_auto_update_file = true;
}
// create version directory
//
boinc_version_dir(*project, version, dir);
retval = boinc_mkdir(dir);
if (retval) {
msg_printf(project, MSG_ERROR, "Couldn't make version dir %s", dir);
return;
}
gstate.auto_update = *this;
} }
void AUTO_UPDATE::install() { void AUTO_UPDATE::install() {

View File

@ -659,6 +659,7 @@ FILE_INFO::FILE_INFO() {
signature_required = false; signature_required = false;
is_user_file = false; is_user_file = false;
is_project_file = false; is_project_file = false;
is_auto_update_file = false;
pers_file_xfer = NULL; pers_file_xfer = NULL;
result = NULL; result = NULL;
project = NULL; project = NULL;

View File

@ -72,6 +72,7 @@ public:
bool signature_required; // true iff associated with app version bool signature_required; // true iff associated with app version
bool is_user_file; bool is_user_file;
bool is_project_file; bool is_project_file;
bool is_auto_update_file;
bool gzip_when_done; bool gzip_when_done;
// for output files: gzip file when done, and append .gz to its name // for output files: gzip file when done, and append .gz to its name
class PERS_FILE_XFER* pers_file_xfer; class PERS_FILE_XFER* pers_file_xfer;

View File

@ -54,9 +54,13 @@ void get_pathname(FILE_INFO* fip, char* path) {
// an associated PROJECT. // an associated PROJECT.
// //
if (p) { if (p) {
get_project_dir(p, buf); if (fip->is_auto_update_file) {
sprintf(path, "%s/%s", buf, fip->name); boinc_version_dir(*p, gstate.auto_update.version, buf);
} else { } else {
get_project_dir(p, buf);
}
sprintf(path, "%s/%s", buf, fip->name);
} else {
strcpy(path, fip->name); strcpy(path, fip->name);
} }
} }
@ -279,8 +283,10 @@ int set_to_project_group(const char* path) {
return 0; return 0;
} }
void boinc_version_dir(VERSION_INFO& vi, char* buf) { void boinc_version_dir(PROJECT& p, VERSION_INFO& vi, char* buf) {
sprintf(buf, "boinc_version_%d_%d_%d", vi.major, vi.minor, vi.release); char projdir[256];
get_project_dir(&p, projdir);
sprintf(buf, "%s/boinc_version_%d_%d_%d", projdir, vi.major, vi.minor, vi.release);
} }
bool is_version_dir(char* buf, VERSION_INFO& vi) { bool is_version_dir(char* buf, VERSION_INFO& vi) {

View File

@ -49,7 +49,7 @@ extern void get_sched_request_filename(PROJECT&, char*);
extern void get_sched_reply_filename(PROJECT&, char*); extern void get_sched_reply_filename(PROJECT&, char*);
extern void get_master_filename(PROJECT&, char*); extern void get_master_filename(PROJECT&, char*);
extern int set_to_project_group(const char* path); extern int set_to_project_group(const char* path);
extern void boinc_version_dir(VERSION_INFO&, char*); extern void boinc_version_dir(PROJECT&, VERSION_INFO&, char*);
extern bool is_version_dir(char*, VERSION_INFO&); extern bool is_version_dir(char*, VERSION_INFO&);
#define PROJECTS_DIR "projects" #define PROJECTS_DIR "projects"

View File

@ -820,7 +820,8 @@ int SCHEDULER_REPLY::parse(FILE* in, PROJECT* project) {
} else if (match_tag(buf, "<project_files>")) { } else if (match_tag(buf, "<project_files>")) {
retval = project->parse_project_files(mf, true); retval = project->parse_project_files(mf, true);
} else if (match_tag(buf, "<auto_update>")) { } else if (match_tag(buf, "<auto_update>")) {
auto_update.parse(mf); retval = auto_update.parse(mf);
if (!retval) auto_update.present = true;
} else if (strlen(buf)>1){ } else if (strlen(buf)>1){
if (log_flags.unparsed_xml) { if (log_flags.unparsed_xml) {
msg_printf(0, MSG_ERROR, msg_printf(0, MSG_ERROR,

View File

@ -64,7 +64,7 @@ int MFILE::vprintf(const char* format, va_list ap) {
int n, k; int n, k;
k = vsnprintf(buf2, BUFSIZE, format, ap); k = vsnprintf(buf2, BUFSIZE, format, ap);
if (k<1 || k>=BUFSIZE) { if (k<=-1 || k>=BUFSIZE) {
fprintf(stderr, "ERROR: buffer too small in MFILE::vprintf()\n"); fprintf(stderr, "ERROR: buffer too small in MFILE::vprintf()\n");
return -1; return -1;
} }