Empty files are not uploaded by BOINC; this makes higher level applications to fail. Modified DC-API-boinc to create missing files.

git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@2573 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
a.visegradi 2012-09-26 14:04:32 +00:00 committed by Adam Visegradi
parent b84c2db6ff
commit 0baca047b1
2 changed files with 46 additions and 40 deletions

View File

@ -158,6 +158,7 @@ char *DC_getResultOutput(const DC_Result *result, const char *logicalFileName)
{
char *path, *wuname;
struct stat st;
int fd;
GList *l;
int ret;
@ -181,13 +182,41 @@ char *DC_getResultOutput(const DC_Result *result, const char *logicalFileName)
path = _DC_workDirPath(result->wu, file->label, FILE_OUT);
/* Treat empty files as non-existent */
/*
BOINC will not upload an output file if it's empty.
Higher level applications might report an error because of the
missing file, while the result is actually successful.
Create an empty output file if it's missing.
*/
ret = stat(path, &st);
if (ret || !st.st_size)
if (ret)
{
if (ENOENT == errno)
/* does not exist */
{
DC_log(LOG_WARNING,
"File '%s' does not exists; it was probably empty. Creating it",
path);
if (0 > (fd = creat(path, 0660)))
{
DC_log(LOG_ERR, "Could not create empty file '%s': open: %s",
path, strerror(errno));
g_free(path);
return NULL;
}
else
close(fd);
}
else
{
DC_log(LOG_ERR, "Error opening output file '%s': stat: %s",
path, strerror(errno));
g_free(path);
return NULL;
}
}
if (!g_mem_is_system_malloc())
{
@ -201,7 +230,7 @@ char *DC_getResultOutput(const DC_Result *result, const char *logicalFileName)
}
wuname = _DC_getWUName(result->wu);
DC_log(LOG_WARNING, "WU %s does not have an output file named %s",
DC_log(LOG_WARNING, "WU %s does not have an output file named '%s'",
wuname, logicalFileName);
g_free(wuname);
return NULL;

View File

@ -7,11 +7,9 @@
if GTK_DOC_USE_LIBTOOL
GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN = $(LIBTOOL) --mode=execute
else
GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
GTKDOC_RUN = sh -c
endif
# We set GPATH here; this gives us semantics for GNU make
@ -55,8 +53,6 @@ endif
docs: html-build.stamp
$(REPORT_FILES): sgml-build.stamp
#### scan ####
scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
@ -65,7 +61,7 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB)
cd $(srcdir) && \
gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES)
if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
else \
cd $(srcdir) ; \
for i in $(SCANOBJ_FILES) ; do \
@ -111,12 +107,7 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files)
@-chmod -R u+w $(srcdir)
rm -rf $(srcdir)/html
mkdir $(srcdir)/html
mkhtml_options=""; \
gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \
if test "$(?)" = "0"; then \
mkhtml_options=--path="$(srcdir)"; \
fi
cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
cd $(srcdir)/html && gtkdoc-mkhtml $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE)
test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html )
@echo 'gtk-doc: Fixing cross-references'
cd $(srcdir) && gtkdoc-fixxref --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS)
@ -137,37 +128,24 @@ maintainer-clean-local: clean
cd $(srcdir) && rm -rf xml html
install-data-local:
installfiles=`echo $(srcdir)/html/*`; \
-installfiles=`echo $(srcdir)/html/*`; \
if test "$$installfiles" = '$(srcdir)/html/*'; \
then echo '-- Nothing to install' ; \
else \
if test -n "$(DOC_MODULE_VERSION)"; then \
installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
else \
installdir="$(DESTDIR)$(TARGET_DIR)"; \
fi; \
$(mkinstalldirs) $${installdir} ; \
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
for i in $$installfiles; do \
echo '-- Installing '$$i ; \
$(INSTALL_DATA) $$i $${installdir}; \
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
done; \
if test -n "$(DOC_MODULE_VERSION)"; then \
mv -f $${installdir}/$(DOC_MODULE).devhelp2 \
$${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp2; \
mv -f $${installdir}/$(DOC_MODULE).devhelp \
$${installdir}/$(DOC_MODULE)-$(DOC_MODULE_VERSION).devhelp; \
fi; \
! which gtkdoc-rebase >/dev/null 2>&1 || \
gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$${installdir} ; \
echo '-- Installing $(srcdir)/html/index.sgml' ; \
$(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
which gtkdoc-rebase >/dev/null && \
gtkdoc-rebase --relative --dest-dir=$(DESTDIR) --html-dir=$(DESTDIR)$(TARGET_DIR) ; \
fi
uninstall-local:
if test -n "$(DOC_MODULE_VERSION)"; then \
installdir="$(DESTDIR)$(TARGET_DIR)-$(DOC_MODULE_VERSION)"; \
else \
installdir="$(DESTDIR)$(TARGET_DIR)"; \
fi; \
rm -rf $${installdir}
rm -f $(DESTDIR)$(TARGET_DIR)/*
#
# Require gtk-doc when making dist
@ -190,7 +168,6 @@ dist-hook: dist-check-gtkdoc dist-hook-local
-cp $(srcdir)/$(DOC_MODULE).types $(distdir)/
-cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/
cd $(distdir) && rm -f $(DISTCLEANFILES)
! which gtkdoc-rebase >/dev/null 2>&1 || \
gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
-gtkdoc-rebase --online --relative --html-dir=$(distdir)/html
.PHONY : dist-hook-local docs