From c0376e3337bbf1539d6a3a5f513aedc3cce28728 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 1 Jan 2005 21:03:55 +0000 Subject: [PATCH] - Implement Python in the SD (no events yet though). - Fix some typos in the previous commit. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1784 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/autoconf/Make.common.in | 2 ++ bacula/examples/python/EndJob.py | 2 +- bacula/src/dird/python.c | 4 +--- bacula/src/filed/job.c | 4 ++-- bacula/src/stored/Makefile.in | 12 ++++++++---- bacula/src/version.h | 4 ++-- 6 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bacula/autoconf/Make.common.in b/bacula/autoconf/Make.common.in index c073cc3b47..d8444df146 100644 --- a/bacula/autoconf/Make.common.in +++ b/bacula/autoconf/Make.common.in @@ -58,6 +58,8 @@ LIBS = @LIBS@ DINCLUDE = @DINCLUDE@ DLIB = @DLIB@ DB_LIBS = @DB_LIBS@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_INC = @PYTHON_INCDIR@ # Windows (cygwin) flags WCFLAGS = @WCFLAGS@ diff --git a/bacula/examples/python/EndJob.py b/bacula/examples/python/EndJob.py index 00a9247a79..7624766f31 100644 --- a/bacula/examples/python/EndJob.py +++ b/bacula/examples/python/EndJob.py @@ -3,7 +3,7 @@ import bacula def EndJob(j): jobid = bacula.get(j, "JobId") client = bacula.get(j, "Client") - bacula.set(jcr=j, JobReport="Python JndJob output: JobId=%d Client=%s.\n" % (jobid, client)) + bacula.set(jcr=j, JobReport="Python JodJob output: JobId=%d Client=%s.\n" % (jobid, client)) if (jobid < 5) : startid = bacula.run(j, "run kernsave") print "Python started jobid=", startid diff --git a/bacula/src/dird/python.c b/bacula/src/dird/python.c index ba1562c148..882e1ae236 100644 --- a/bacula/src/dird/python.c +++ b/bacula/src/dird/python.c @@ -36,8 +36,6 @@ #undef _POSIX_C_SOURCE #include -bool run_module(const char *module); - PyObject *bacula_get(PyObject *self, PyObject *args); PyObject *bacula_set(PyObject *self, PyObject *args, PyObject *keyw); PyObject *bacula_run(PyObject *self, PyObject *args); @@ -46,7 +44,7 @@ PyObject *bacula_run(PyObject *self, PyObject *args); PyMethodDef BaculaMethods[] = { {"get", bacula_get, METH_VARARGS, "Get Bacula variables."}, {"set", (PyCFunction)bacula_set, METH_VARARGS|METH_KEYWORDS, - "Set Bacula variables."}, + "Set Bacula variables."}, {"run", (PyCFunction)bacula_run, METH_VARARGS, "Run a Bacula command."}, {NULL, NULL, 0, NULL} /* last item */ }; diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index 506f4517d5..3b516bef6b 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -471,8 +471,8 @@ static int run_cmd(JCR *jcr, char *cmd, const char *name) } while (fgets(line, sizeof(line), bpipe->rfd)) { int len = strlen(line); - if (len > 0 && line[len-1] ! = '\n') { - bstrncat(line, sizeof(line), "\n"); + if (len > 0 && line[len-1] != '\n') { + bstrncat(line, "\n", sizeof(line)); } Jmsg(jcr, M_INFO, 0, _("%s: %s"), name, line); } diff --git a/bacula/src/stored/Makefile.in b/bacula/src/stored/Makefile.in index cccbc58ce9..cbdfa2292f 100644 --- a/bacula/src/stored/Makefile.in +++ b/bacula/src/stored/Makefile.in @@ -23,6 +23,7 @@ SVRSRCS = stored.c autochanger.c acquire.c append.c \ block.c butil.c dev.c \ device.c dircmd.c fd_cmds.c job.c \ label.c match_bsr.c mount.c parse_bsr.c \ + python.c \ read.c read_record.c record.c \ spool.c status.c stored_conf.c SVROBJS = stored.o autochanger.o acquire.o append.o \ @@ -30,6 +31,7 @@ SVROBJS = stored.o autochanger.o acquire.o append.o \ block.o butil.o dev.o \ device.o dircmd.o fd_cmds.o job.o \ label.o match_bsr.o mount.o parse_bsr.o \ + python.o \ read.o read_record.o record.o \ spool.o status.o stored_conf.o @@ -75,7 +77,7 @@ FDLIBS=@FDLIBS@ # inference rules .c.o: - $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< + $(CXX) $(DEFS) $(DEBUG) -c $(WCFLAGS) $(CPPFLAGS) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(DINCLUDE) $(CFLAGS) $< #------------------------------------------------------------------------- all: Makefile bacula-sd @STATIC_SD@ bls bextract bscan btape bcopy @@ -83,10 +85,12 @@ all: Makefile bacula-sd @STATIC_SD@ bls bextract bscan btape bcopy @echo " " bacula-sd: $(SVROBJS) ../lib/libbac.a - $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -o $@ $(SVROBJS) $(FDLIBS) -lbac -lm $(DLIB) $(LIBS) + $(CXX) $(WLDFLAGS) $(LDFLAGS) -L../lib -o $@ $(SVROBJS) $(FDLIBS) \ + -lbac -lm $(PYTHON_LIBS) $(DLIB) $(LIBS) static-bacula-sd: $(SVROBJS) ../lib/libbac.a - $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -o $@ $(SVROBJS) $(FDLIBS) -lbac -lm $(DLIB) $(LIBS) + $(CXX) $(WLDFLAGS) $(LDFLAGS) -static -L../lib -o $@ $(SVROBJS) $(FDLIBS) \ + -lbac -lm $(PYTHON_LIBS) $(DLIB) $(LIBS) strip $@ btape.o: btape.c @@ -178,7 +182,7 @@ depend: @$(MV) Makefile Makefile.bak @$(SED) "/^# DO NOT DELETE:/,$$ d" Makefile.bak > Makefile @$(ECHO) "# DO NOT DELETE: nice dependency list follows" >> Makefile - @$(CXX) -S -M $(CPPFLAGS) $(XINC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile + @$(CXX) -S -M $(CPPFLAGS) $(XINC) $(PYTHON_INC) -I$(srcdir) -I$(basedir) $(SQL_INC) *.c >> Makefile @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ diff --git a/bacula/src/version.h b/bacula/src/version.h index 2479a40624..28bed4bc23 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -1,8 +1,8 @@ /* */ #undef VERSION #define VERSION "1.37.1" -#define BDATE "30 December 2004" -#define LSMDATE "30Dec04" +#define BDATE "01 January 2005" +#define LSMDATE "01Jan05" /* Debug flags */ #undef DEBUG -- 2.39.5