Hello community, here is the log from the commit of package blogc for openSUSE:Factory checked in at 2018-05-15 10:15:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/blogc (Old) and /work/SRC/openSUSE:Factory/.blogc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "blogc" Tue May 15 10:15:22 2018 rev:5 rq:606968 version:0.13.5 Changes: -------- --- /work/SRC/openSUSE:Factory/blogc/blogc.changes 2018-03-22 12:11:30.503928466 +0100 +++ /work/SRC/openSUSE:Factory/.blogc.new/blogc.changes 2018-05-15 10:34:11.330454210 +0200 @@ -1,0 +2,9 @@ +Mon May 14 09:02:46 UTC 2018 - mvet...@suse.com + +- Update to 0.13.5: + * Added a watch rule to blogc-make(1). This rule allows the usage + of the automatic website reloader/rebuilder without using + blogc-runserver(1). + * Changed the architecture of the blogc-make(1)runserver rule. + +------------------------------------------------------------------- Old: ---- blogc-0.13.4.tar.xz New: ---- blogc-0.13.5.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ blogc.spec ++++++ --- /var/tmp/diff_new_pack.cJcv77/_old 2018-05-15 10:34:11.866434525 +0200 +++ /var/tmp/diff_new_pack.cJcv77/_new 2018-05-15 10:34:11.866434525 +0200 @@ -17,7 +17,7 @@ Name: blogc -Version: 0.13.4 +Version: 0.13.5 Release: 0 Summary: Blog compiler License: BSD-3-Clause ++++++ blogc-0.13.4.tar.xz -> blogc-0.13.5.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/.tarball-version new/blogc-0.13.5/.tarball-version --- old/blogc-0.13.4/.tarball-version 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/.tarball-version 2018-05-14 01:45:09.000000000 +0200 @@ -1 +1 @@ -0.13.4 +0.13.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/.version new/blogc-0.13.5/.version --- old/blogc-0.13.4/.version 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/.version 2018-05-14 01:45:08.000000000 +0200 @@ -1 +1 @@ -0.13.4 +0.13.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/Makefile.am new/blogc-0.13.5/Makefile.am --- old/blogc-0.13.4/Makefile.am 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/Makefile.am 2018-05-14 01:44:34.000000000 +0200 @@ -55,12 +55,14 @@ src/blogc-make/ctx.h \ src/blogc-make/exec.h \ src/blogc-make/exec-native.h \ + src/blogc-make/httpd.h \ src/blogc-make/reloader.h \ src/blogc-make/rules.h \ src/blogc-make/settings.h \ src/blogc-runserver/httpd.h \ src/blogc-runserver/httpd-utils.h \ src/blogc-runserver/mime.h \ + src/common/compat.h \ src/common/config-parser.h \ src/common/error.h \ src/common/file.h \ @@ -139,6 +141,7 @@ libblogc_common_la_SOURCES = \ + src/common/compat.c \ src/common/config-parser.c \ src/common/error.c \ src/common/file.c \ @@ -231,6 +234,7 @@ src/blogc-make/ctx.c \ src/blogc-make/exec.c \ src/blogc-make/exec-native.c \ + src/blogc-make/httpd.c \ src/blogc-make/reloader.c \ src/blogc-make/rules.c \ src/blogc-make/settings.c \ @@ -285,6 +289,9 @@ ## Build rules: man pages +# README: all the prebuilt manpages that are hidden behind --enable-* +# options should be added here, otherwise they may be not included +# in the distfiles. EXTRA_DIST += \ man/blogc.1.ronn \ man/blogc-git-receiver.1.ronn \ @@ -298,6 +305,7 @@ blogc-git-receiver.1 \ blogc-make.1 \ blogc-runserver.1 \ + blogcfile.5 \ $(NULL) dist_man_MANS = \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/Makefile.in new/blogc-0.13.5/Makefile.in --- old/blogc-0.13.4/Makefile.in 2018-03-20 23:34:10.000000000 +0100 +++ new/blogc-0.13.5/Makefile.in 2018-05-14 01:45:04.000000000 +0200 @@ -246,6 +246,7 @@ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ libblogc_common_la_LIBADD = am_libblogc_common_la_OBJECTS = \ + src/common/libblogc_common_la-compat.lo \ src/common/libblogc_common_la-config-parser.lo \ src/common/libblogc_common_la-error.lo \ src/common/libblogc_common_la-file.lo \ @@ -282,13 +283,15 @@ @BUILD_MAKE_LIB_TRUE@ $(am__DEPENDENCIES_1) libblogc_common.la am__libblogc_make_la_SOURCES_DIST = src/blogc-make/atom.c \ src/blogc-make/ctx.c src/blogc-make/exec.c \ - src/blogc-make/exec-native.c src/blogc-make/reloader.c \ - src/blogc-make/rules.c src/blogc-make/settings.c + src/blogc-make/exec-native.c src/blogc-make/httpd.c \ + src/blogc-make/reloader.c src/blogc-make/rules.c \ + src/blogc-make/settings.c @BUILD_MAKE_LIB_TRUE@am_libblogc_make_la_OBJECTS = \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-atom.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-ctx.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-exec.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-exec-native.lo \ +@BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-httpd.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-reloader.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-rules.lo \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/libblogc_make_la-settings.lo @@ -973,6 +976,10 @@ --disable-valgrind \ $(NULL) + +# README: all the prebuilt manpages that are hidden behind --enable-* +# options should be added here, otherwise they may be not included +# in the distfiles. EXTRA_DIST = build-aux/git-version-gen build-aux/valgrind.sh \ $(top_srcdir)/.version autogen.sh blogc.spec LICENSE README.md \ $(NULL) man/blogc.1.ronn man/blogc-git-receiver.1.ronn \ @@ -980,7 +987,7 @@ man/blogcfile.5.ronn man/blogc-source.7.ronn \ man/blogc-template.7.ronn man/blogc-pagination.7.ronn \ man/index.txt blogc-git-receiver.1 blogc-make.1 \ - blogc-runserver.1 $(NULL) + blogc-runserver.1 blogcfile.5 $(NULL) CLEANFILES = src/blogc-github-lambda/LICENSE \ src/blogc-github-lambda/blogc $(NULL) $(check_SCRIPTS) $(NULL) MAINTAINERCLEANFILES = $(NULL) $(dist_man_MANS) $(NULL) @@ -1005,12 +1012,14 @@ src/blogc-make/ctx.h \ src/blogc-make/exec.h \ src/blogc-make/exec-native.h \ + src/blogc-make/httpd.h \ src/blogc-make/reloader.h \ src/blogc-make/rules.h \ src/blogc-make/settings.h \ src/blogc-runserver/httpd.h \ src/blogc-runserver/httpd-utils.h \ src/blogc-runserver/mime.h \ + src/common/compat.h \ src/common/config-parser.h \ src/common/error.h \ src/common/file.h \ @@ -1043,6 +1052,7 @@ $(NULL) libblogc_common_la_SOURCES = \ + src/common/compat.c \ src/common/config-parser.c \ src/common/error.c \ src/common/file.c \ @@ -1110,6 +1120,7 @@ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/ctx.c \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/exec.c \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/exec-native.c \ +@BUILD_MAKE_LIB_TRUE@ src/blogc-make/httpd.c \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/reloader.c \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/rules.c \ @BUILD_MAKE_LIB_TRUE@ src/blogc-make/settings.c \ @@ -1629,6 +1640,8 @@ src/common/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/common/$(DEPDIR) @: > src/common/$(DEPDIR)/$(am__dirstamp) +src/common/libblogc_common_la-compat.lo: src/common/$(am__dirstamp) \ + src/common/$(DEPDIR)/$(am__dirstamp) src/common/libblogc_common_la-config-parser.lo: \ src/common/$(am__dirstamp) \ src/common/$(DEPDIR)/$(am__dirstamp) @@ -1687,6 +1700,9 @@ src/blogc-make/libblogc_make_la-exec-native.lo: \ src/blogc-make/$(am__dirstamp) \ src/blogc-make/$(DEPDIR)/$(am__dirstamp) +src/blogc-make/libblogc_make_la-httpd.lo: \ + src/blogc-make/$(am__dirstamp) \ + src/blogc-make/$(DEPDIR)/$(am__dirstamp) src/blogc-make/libblogc_make_la-reloader.lo: \ src/blogc-make/$(am__dirstamp) \ src/blogc-make/$(DEPDIR)/$(am__dirstamp) @@ -2017,6 +2033,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-ctx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-exec-native.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-exec.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-httpd.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-reloader.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-rules.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc-make/$(DEPDIR)/libblogc_make_la-settings.Plo@am__quote@ @@ -2032,6 +2049,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc/$(DEPDIR)/libblogc_la-renderer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc/$(DEPDIR)/libblogc_la-source-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/blogc/$(DEPDIR)/libblogc_la-template-parser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/common/$(DEPDIR)/libblogc_common_la-compat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/common/$(DEPDIR)/libblogc_common_la-config-parser.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/common/$(DEPDIR)/libblogc_common_la-error.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/common/$(DEPDIR)/libblogc_common_la-file.Plo@am__quote@ @@ -2132,6 +2150,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_la_CFLAGS) $(CFLAGS) -c -o src/blogc/libblogc_la-template-parser.lo `test -f 'src/blogc/template-parser.c' || echo '$(srcdir)/'`src/blogc/template-parser.c +src/common/libblogc_common_la-compat.lo: src/common/compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_common_la_CFLAGS) $(CFLAGS) -MT src/common/libblogc_common_la-compat.lo -MD -MP -MF src/common/$(DEPDIR)/libblogc_common_la-compat.Tpo -c -o src/common/libblogc_common_la-compat.lo `test -f 'src/common/compat.c' || echo '$(srcdir)/'`src/common/compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/common/$(DEPDIR)/libblogc_common_la-compat.Tpo src/common/$(DEPDIR)/libblogc_common_la-compat.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/common/compat.c' object='src/common/libblogc_common_la-compat.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_common_la_CFLAGS) $(CFLAGS) -c -o src/common/libblogc_common_la-compat.lo `test -f 'src/common/compat.c' || echo '$(srcdir)/'`src/common/compat.c + src/common/libblogc_common_la-config-parser.lo: src/common/config-parser.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_common_la_CFLAGS) $(CFLAGS) -MT src/common/libblogc_common_la-config-parser.lo -MD -MP -MF src/common/$(DEPDIR)/libblogc_common_la-config-parser.Tpo -c -o src/common/libblogc_common_la-config-parser.lo `test -f 'src/common/config-parser.c' || echo '$(srcdir)/'`src/common/config-parser.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/common/$(DEPDIR)/libblogc_common_la-config-parser.Tpo src/common/$(DEPDIR)/libblogc_common_la-config-parser.Plo @@ -2237,6 +2262,13 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_make_la_CFLAGS) $(CFLAGS) -c -o src/blogc-make/libblogc_make_la-exec-native.lo `test -f 'src/blogc-make/exec-native.c' || echo '$(srcdir)/'`src/blogc-make/exec-native.c +src/blogc-make/libblogc_make_la-httpd.lo: src/blogc-make/httpd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_make_la_CFLAGS) $(CFLAGS) -MT src/blogc-make/libblogc_make_la-httpd.lo -MD -MP -MF src/blogc-make/$(DEPDIR)/libblogc_make_la-httpd.Tpo -c -o src/blogc-make/libblogc_make_la-httpd.lo `test -f 'src/blogc-make/httpd.c' || echo '$(srcdir)/'`src/blogc-make/httpd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/blogc-make/$(DEPDIR)/libblogc_make_la-httpd.Tpo src/blogc-make/$(DEPDIR)/libblogc_make_la-httpd.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/blogc-make/httpd.c' object='src/blogc-make/libblogc_make_la-httpd.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_make_la_CFLAGS) $(CFLAGS) -c -o src/blogc-make/libblogc_make_la-httpd.lo `test -f 'src/blogc-make/httpd.c' || echo '$(srcdir)/'`src/blogc-make/httpd.c + src/blogc-make/libblogc_make_la-reloader.lo: src/blogc-make/reloader.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libblogc_make_la_CFLAGS) $(CFLAGS) -MT src/blogc-make/libblogc_make_la-reloader.lo -MD -MP -MF src/blogc-make/$(DEPDIR)/libblogc_make_la-reloader.Tpo -c -o src/blogc-make/libblogc_make_la-reloader.lo `test -f 'src/blogc-make/reloader.c' || echo '$(srcdir)/'`src/blogc-make/reloader.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/blogc-make/$(DEPDIR)/libblogc_make_la-reloader.Tpo src/blogc-make/$(DEPDIR)/libblogc_make_la-reloader.Plo diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-git-receiver.1 new/blogc-0.13.5/blogc-git-receiver.1 --- old/blogc-0.13.4/blogc-git-receiver.1 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/blogc-git-receiver.1 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-GIT\-RECEIVER" "1" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-GIT\-RECEIVER" "1" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-git\-receiver\fR \- a simple login shell/git hook to deploy blogc websites diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-make.1 new/blogc-0.13.5/blogc-make.1 --- old/blogc-0.13.4/blogc-make.1 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/blogc-make.1 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-MAKE" "1" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-MAKE" "1" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-make\fR \- a simple build tool for blogc @@ -49,7 +49,7 @@ Clean built files and empty directories in output directory\. . .SS "runserver" -Run \fBblogc\-runserver(1)\fR pointing to output directory, if available\. This rule accepts some arguments, in the following format: +Run \fBblogc\-runserver(1)\fR (if available) pointing to output directory, watching for changes in the source files and rebuilding as needed\. This rule accepts some arguments, in the following format: . .IP "" 4 . @@ -62,7 +62,13 @@ .IP "" 0 . .P -The values in the example are the default values\. +The values in the example are the default values\. Rebuilds are done by running \fBblogc\-make all\fR internally\. +. +.SS "watch" +Watch for changes in the source files, rebuilding as needed\. +. +.P +Rebuilds are done by running \fBblogc\-make all\fR internally\. . .SH "BUILD RULES" . diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-pagination.7 new/blogc-0.13.5/blogc-pagination.7 --- old/blogc-0.13.4/blogc-pagination.7 2018-03-20 23:34:14.000000000 +0100 +++ new/blogc-0.13.5/blogc-pagination.7 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-PAGINATION" "7" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-PAGINATION" "7" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-pagination\fR \- blogc\'s pagination support diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-runserver.1 new/blogc-0.13.5/blogc-runserver.1 --- old/blogc-0.13.4/blogc-runserver.1 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/blogc-runserver.1 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-RUNSERVER" "1" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-RUNSERVER" "1" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-runserver\fR \- a simple HTTP server to test blogc websites diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-source.7 new/blogc-0.13.5/blogc-source.7 --- old/blogc-0.13.4/blogc-source.7 2018-03-20 23:34:14.000000000 +0100 +++ new/blogc-0.13.5/blogc-source.7 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-SOURCE" "7" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-SOURCE" "7" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-source\fR \- blogc\'s source file format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc-template.7 new/blogc-0.13.5/blogc-template.7 --- old/blogc-0.13.4/blogc-template.7 2018-03-20 23:34:14.000000000 +0100 +++ new/blogc-0.13.5/blogc-template.7 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC\-TEMPLATE" "7" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC\-TEMPLATE" "7" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\-template\fR \- blogc\'s template format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc.1 new/blogc-0.13.5/blogc.1 --- old/blogc-0.13.4/blogc.1 2018-03-20 23:34:14.000000000 +0100 +++ new/blogc-0.13.5/blogc.1 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGC" "1" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGC" "1" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogc\fR \- a blog compiler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc.spec new/blogc-0.13.5/blogc.spec --- old/blogc-0.13.4/blogc.spec 2018-03-20 23:34:13.000000000 +0100 +++ new/blogc-0.13.5/blogc.spec 2018-05-14 01:45:07.000000000 +0200 @@ -1,11 +1,11 @@ Name: blogc -Version: 0.13.4 +Version: 0.13.5 Release: 1%{?dist} License: BSD Group: Applications/Text Summary: A blog compiler URL: https://blogc.rgm.io/ -Source0: https://github.com/blogc/blogc/releases/download/v0.13.4/blogc-0.13.4.tar.xz +Source0: https://github.com/blogc/blogc/releases/download/v0.13.5/blogc-0.13.5.tar.xz BuildRequires: libcmocka-devel, bash, coreutils, diffutils %if ! 0%{?el6} BuildRequires: git, tar, make @@ -43,7 +43,7 @@ blogc-runserver is a simple HTTP server to test blogc websites. %prep -%setup -q -n blogc-0.13.4 +%setup -q -n blogc-0.13.5 %build %if 0%{?el6} @@ -88,6 +88,9 @@ %license LICENSE %changelog +* Sun May 13 2018 Rafael G. Martins <raf...@rafaelmartins.eng.br> 0.13.5-1 +- New release. + * Tue Mar 20 2018 Rafael G. Martins <raf...@rafaelmartins.eng.br> 0.13.4-1 - New release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogc.spec.in new/blogc-0.13.5/blogc.spec.in --- old/blogc-0.13.4/blogc.spec.in 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/blogc.spec.in 2018-05-14 01:44:34.000000000 +0200 @@ -88,6 +88,9 @@ %license LICENSE %changelog +* Sun May 13 2018 Rafael G. Martins <raf...@rafaelmartins.eng.br> 0.13.5-1 +- New release. + * Tue Mar 20 2018 Rafael G. Martins <raf...@rafaelmartins.eng.br> 0.13.4-1 - New release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/blogcfile.5 new/blogc-0.13.5/blogcfile.5 --- old/blogc-0.13.4/blogcfile.5 2018-03-20 23:34:15.000000000 +0100 +++ new/blogc-0.13.5/blogcfile.5 2018-05-14 01:45:08.000000000 +0200 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BLOGCFILE" "5" "March 2018" "Rafael G. Martins" "blogc Manual" +.TH "BLOGCFILE" "5" "May 2018" "Rafael G. Martins" "blogc Manual" . .SH "NAME" \fBblogcfile\fR \- blogc\-make\'s configuration file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/configure new/blogc-0.13.5/configure --- old/blogc-0.13.4/configure 2018-03-20 23:34:09.000000000 +0100 +++ new/blogc-0.13.5/configure 2018-05-14 01:45:03.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for blogc 0.13.4. +# Generated by GNU Autoconf 2.69 for blogc 0.13.5. # # Report bugs to <https://github.com/blogc/blogc>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='blogc' PACKAGE_TARNAME='blogc' -PACKAGE_VERSION='0.13.4' -PACKAGE_STRING='blogc 0.13.4' +PACKAGE_VERSION='0.13.5' +PACKAGE_STRING='blogc 0.13.5' PACKAGE_BUGREPORT='https://github.com/blogc/blogc' PACKAGE_URL='https://blogc.rgm.io/' @@ -1375,7 +1375,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures blogc 0.13.4 to adapt to many kinds of systems. +\`configure' configures blogc 0.13.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1445,7 +1445,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of blogc 0.13.4:";; + short | recursive ) echo "Configuration of blogc 0.13.5:";; esac cat <<\_ACEOF @@ -1572,7 +1572,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -blogc configure 0.13.4 +blogc configure 0.13.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1941,7 +1941,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by blogc $as_me 0.13.4, which was +It was created by blogc $as_me 0.13.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2806,7 +2806,7 @@ # Define the identity of the package. PACKAGE='blogc' - VERSION='0.13.4' + VERSION='0.13.5' cat >>confdefs.h <<_ACEOF @@ -12287,7 +12287,7 @@ if test "x$enable_git_receiver" = "xyes"; then : - for ac_header in sys/types.h sys/stat.h sys/wait.h time.h libgen.h unistd.h errno.h dirent.h + for ac_header in sys/types.h sys/stat.h time.h libgen.h unistd.h errno.h dirent.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14193,7 +14193,7 @@ BASH="$ac_cv_path_bash" -for ac_header in sys/stat.h time.h +for ac_header in sys/stat.h sys/wait.h time.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -14934,7 +14934,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by blogc $as_me 0.13.4, which was +This file was extended by blogc $as_me 0.13.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15001,7 +15001,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -blogc config.status 0.13.4 +blogc config.status 0.13.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/configure.ac new/blogc-0.13.5/configure.ac --- old/blogc-0.13.4/configure.ac 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/configure.ac 2018-05-14 01:44:34.000000000 +0200 @@ -88,7 +88,7 @@ AC_ARG_ENABLE([git-receiver], AS_HELP_STRING([--enable-git-receiver], [build blogc-git-receiver tool])) AS_IF([test "x$enable_git_receiver" = "xyes"], [ - AC_CHECK_HEADERS([sys/types.h sys/stat.h sys/wait.h time.h libgen.h unistd.h errno.h dirent.h], [ + AC_CHECK_HEADERS([sys/types.h sys/stat.h time.h libgen.h unistd.h errno.h dirent.h], [ GIT_RECEIVER="enabled" have_git_receiver=yes ], [ @@ -220,7 +220,7 @@ BASH="$ac_cv_path_bash" AC_SUBST(BASH) -AC_CHECK_HEADERS([sys/stat.h time.h]) +AC_CHECK_HEADERS([sys/stat.h sys/wait.h time.h]) LT_LIB_M diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/man/blogc-make.1.ronn new/blogc-0.13.5/man/blogc-make.1.ronn --- old/blogc-0.13.4/man/blogc-make.1.ronn 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/man/blogc-make.1.ronn 2018-05-14 01:44:34.000000000 +0200 @@ -45,12 +45,20 @@ ### runserver -Run `blogc-runserver(1)` pointing to output directory, if available. This -rule accepts some arguments, in the following format: +Run `blogc-runserver(1)` (if available) pointing to output directory, watching +for changes in the source files and rebuilding as needed. This rule accepts +some arguments, in the following format: runserver:host=127.0.0.1,port=8080,threads=20 -The values in the example are the default values. +The values in the example are the default values. Rebuilds are done by running +`blogc-make all` internally. + +### watch + +Watch for changes in the source files, rebuilding as needed. + +Rebuilds are done by running `blogc-make all` internally. ## BUILD RULES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-git-receiver/pre-receive.c new/blogc-0.13.5/src/blogc-git-receiver/pre-receive.c --- old/blogc-0.13.4/src/blogc-git-receiver/pre-receive.c 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-git-receiver/pre-receive.c 2018-05-14 01:44:34.000000000 +0200 @@ -15,6 +15,7 @@ #include <dirent.h> #include <time.h> #include <libgen.h> +#include "../common/compat.h" #include "../common/utils.h" #include "../common/stdin.h" #include "pre-receive-parser.h" @@ -197,7 +198,7 @@ char *build_cmd = NULL; if (0 == access("blogcfile", F_OK)) { int status_bmake = system("blogc-make -v 2> /dev/null > /dev/null"); - if (127 == WEXITSTATUS(status_bmake)) { + if (127 == bc_compat_status_code(status_bmake)) { fprintf(stderr, "error: failed to find blogc-make binary\n"); rv = 3; goto cleanup; @@ -209,12 +210,12 @@ const char *make_impl = NULL; int status_gmake = system("gmake -f /dev/null 2> /dev/null > /dev/null"); - if (127 != WEXITSTATUS(status_gmake)) { + if (127 != bc_compat_status_code(status_gmake)) { make_impl = "gmake"; } else { int status_make = system("make -f /dev/null 2> /dev/null > /dev/null"); - if (127 != WEXITSTATUS(status_make)) { + if (127 != bc_compat_status_code(status_make)) { make_impl = "make"; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/exec.c new/blogc-0.13.5/src/blogc-make/exec.c --- old/blogc-0.13.4/src/blogc-make/exec.c 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/exec.c 2018-05-14 01:44:34.000000000 +0200 @@ -18,6 +18,7 @@ #include <sys/wait.h> #include <errno.h> #include <libgen.h> +#include "../common/compat.h" #include "../common/error.h" #include "../common/file.h" #include "../common/utils.h" @@ -202,7 +203,7 @@ int status; waitpid(pid, &status, 0); - return WEXITSTATUS(status); + return bc_compat_status_code(status); } @@ -402,7 +403,7 @@ // we don't need pipes to run blogc-runserver, because it is "interactive" int status = system(cmd->str); - int rv = WEXITSTATUS(status); + int rv = bc_compat_status_code(status); bc_string_free(cmd, true); if (rv != 0 && rv != 130) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/httpd.c new/blogc-0.13.5/src/blogc-make/httpd.c --- old/blogc-0.13.4/src/blogc-make/httpd.c 1970-01-01 01:00:00.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/httpd.c 2018-05-14 01:44:34.000000000 +0200 @@ -0,0 +1,81 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2014-2017 Rafael G. Martins <raf...@rafaelmartins.eng.br> + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <pthread.h> +#include "../common/utils.h" +#include "ctx.h" +#include "exec.h" +#include "reloader.h" +#include "httpd.h" + +// we are not going to unit-test these functions, then printing errors +// directly is not a big issue + + +typedef struct { + bm_ctx_t *ctx; + bc_trie_t *args; +} bm_httpd_t; + + +static void* +httpd_thread(void *arg) +{ + bm_httpd_t *httpd = arg; + + int rv = bm_exec_blogc_runserver(httpd->ctx, bc_trie_lookup(httpd->args, "host"), + bc_trie_lookup(httpd->args, "port"), bc_trie_lookup(httpd->args, "threads")); + + free(httpd); + + // stop the reloader + bm_reloader_stop(rv); + + return NULL; +} + + +int +bm_httpd_run(bm_ctx_t **ctx, bm_rule_exec_func_t rule_exec, bc_slist_t *outputs, + bc_trie_t *args) +{ + int err; + + pthread_attr_t attr; + if (0 != (err = pthread_attr_init(&attr))) { + fprintf(stderr, "blogc-make: error: failed to initialize httpd " + "thread attributes: %s\n", strerror(err)); + return 3; + } + + // we run the thread detached, because we don't want to wait it to join + // before exiting. the OS can clean it properly + if (0 != (err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))) { + fprintf(stderr, "blogc-make: error: failed to mark httpd thread as " + "detached: %s\n", strerror(err)); + return 3; + } + + bm_httpd_t *rv = bc_malloc(sizeof(bm_httpd_t)); + rv->ctx = *ctx; + rv->args = args; + + pthread_t thread; + if (0 != (err = pthread_create(&thread, &attr, httpd_thread, rv))) { + fprintf(stderr, "blogc-make: error: failed to create httpd " + "thread: %s\n", strerror(err)); + free(rv); + return 3; + } + + // run the reloader + return bm_reloader_run(ctx, rule_exec, outputs, args); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/httpd.h new/blogc-0.13.5/src/blogc-make/httpd.h --- old/blogc-0.13.4/src/blogc-make/httpd.h 1970-01-01 01:00:00.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/httpd.h 2018-05-14 01:44:34.000000000 +0200 @@ -0,0 +1,19 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2014-2017 Rafael G. Martins <raf...@rafaelmartins.eng.br> + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#ifndef _MAKE_HTTPD_H +#define _MAKE_HTTPD_H + +#include "../common/utils.h" +#include "ctx.h" +#include "rules.h" + +int bm_httpd_run(bm_ctx_t **ctx, bm_rule_exec_func_t rule_exec, bc_slist_t *outputs, + bc_trie_t *args); + +#endif /* _MAKE_HTTPD_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/reloader.c new/blogc-0.13.5/src/blogc-make/reloader.c --- old/blogc-0.13.4/src/blogc-make/reloader.c 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/reloader.c 2018-05-14 01:44:34.000000000 +0200 @@ -6,11 +6,14 @@ * See the file LICENSE. */ +#include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <signal.h> #include <string.h> #include <unistd.h> #include <pthread.h> +#include <errno.h> #include "../common/utils.h" #include "ctx.h" #include "rules.h" @@ -19,19 +22,58 @@ // we are not going to unit-test these functions, then printing errors // directly is not a big issue +static pthread_mutex_t mutex_running = PTHREAD_MUTEX_INITIALIZER; +static bool running = false; +static int reloader_status_code = 0; +static void (*handler_func)(int) = NULL; -static void* -bm_reloader_thread(void *arg) +static void +sig_handler(int signum) { - bm_reloader_t *reloader = arg; - while (reloader->running) { - if (!bm_ctx_reload(&(reloader->ctx))) { + bm_reloader_stop(signum + 128); +} + + +int +bm_reloader_run(bm_ctx_t **ctx, bm_rule_exec_func_t rule_exec, + bc_slist_t *outputs, bc_trie_t *args) +{ + // install ^C handler + struct sigaction current_action; + if (sigaction(SIGINT, NULL, ¤t_action) < 0) { + fprintf(stderr, "blogc-make: failed to run reloader: %s\n", strerror(errno)); + return 3; + } + if (current_action.sa_handler != sig_handler) { // not installed yet + // backup current handler + pthread_mutex_lock(&mutex_running); + handler_func = current_action.sa_handler; + pthread_mutex_unlock(&mutex_running); + + // set new handler + struct sigaction new_action; + new_action.sa_handler = sig_handler; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + if (sigaction(SIGINT, &new_action, NULL) < 0) { + fprintf(stderr, "blogc-make: failed to run reloader: %s\n", + strerror(errno)); + return 3; + } + } + + pthread_mutex_lock(&mutex_running); + running = true; + pthread_mutex_unlock(&mutex_running); + + while (running) { + if (!bm_ctx_reload(ctx)) { fprintf(stderr, "blogc-make: warning: failed to reload context. " "retrying in 5 seconds ...\n\n"); sleep(5); continue; } - if (0 != reloader->rule_exec(reloader->ctx, reloader->outputs, reloader->args)) { + if (0 != rule_exec(*ctx, outputs, args)) { fprintf(stderr, "blogc-make: warning: failed to rebuild website. " "retrying in 5 seconds ...\n\n"); sleep(5); @@ -40,59 +82,35 @@ sleep(1); } - free(reloader); - return NULL; + return reloader_status_code; } -bm_reloader_t* -bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec, - bc_slist_t *outputs, bc_trie_t *args) +void +bm_reloader_stop(int status_code) { - // first rule_exec call is syncronous, to do a 'sanity check' - if (0 != rule_exec(ctx, outputs, args)) - return NULL; - - int err; - - pthread_attr_t attr; - if (0 != (err = pthread_attr_init(&attr))) { - fprintf(stderr, "blogc-make: error: failed to initialize reloader " - "thread attributes: %s\n", strerror(err)); - return NULL; - } - - // we run the thread detached, because we don't want to wait it to join - // before exiting. the OS can clean it properly - if (0 != (err = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED))) { - fprintf(stderr, "blogc-make: error: failed to mark reloader thread as " - "detached: %s\n", strerror(err)); - return NULL; - } + pthread_mutex_lock(&mutex_running); - bm_reloader_t *rv = bc_malloc(sizeof(bm_reloader_t)); - rv->ctx = ctx; - rv->rule_exec = rule_exec; - rv->outputs = outputs; - rv->args = args; - rv->running = true; - - pthread_t thread; - if (0 != (err = pthread_create(&thread, &attr, bm_reloader_thread, rv))) { - fprintf(stderr, "blogc-make: error: failed to create reloader " - "thread: %s\n", strerror(err)); - free(rv); - return NULL; - } + running = false; + reloader_status_code = status_code; - return rv; -} + // reraise if SIGINT + if (status_code == SIGINT + 128) { + // reinstall old ^C handler + struct sigaction new_action; + new_action.sa_handler = handler_func; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGINT, &new_action, NULL); + + // run it + raise(SIGINT); + + // SIGINT will usually kill the process, but in the case that the + // `handler_func` prevents it, our custom handler will be reinstalled + // by `bm_reloader_run`. + } -void -bm_reloader_stop(bm_reloader_t *reloader) -{ - if (reloader == NULL) - return; - reloader->running = false; + pthread_mutex_unlock(&mutex_running); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/reloader.h new/blogc-0.13.5/src/blogc-make/reloader.h --- old/blogc-0.13.4/src/blogc-make/reloader.h 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/reloader.h 2018-05-14 01:44:34.000000000 +0200 @@ -9,21 +9,12 @@ #ifndef _MAKE_RELOADER_H #define _MAKE_RELOADER_H -#include <stdbool.h> #include "../common/utils.h" #include "ctx.h" #include "rules.h" -typedef struct { - bm_ctx_t *ctx; - bm_rule_exec_func_t rule_exec; - bc_slist_t *outputs; - bc_trie_t *args; - bool running; -} bm_reloader_t; - -bm_reloader_t* bm_reloader_new(bm_ctx_t *ctx, bm_rule_exec_func_t rule_exec, +int bm_reloader_run(bm_ctx_t **ctx, bm_rule_exec_func_t rule_exec, bc_slist_t *outputs, bc_trie_t *args); -void bm_reloader_stop(bm_reloader_t *reloader); +void bm_reloader_stop(int status_code); #endif /* _MAKE_RELOADER_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-make/rules.c new/blogc-0.13.5/src/blogc-make/rules.c --- old/blogc-0.13.4/src/blogc-make/rules.c 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-make/rules.c 2018-05-14 01:44:34.000000000 +0200 @@ -16,6 +16,7 @@ #include "ctx.h" #include "exec.h" #include "exec-native.h" +#include "httpd.h" #include "reloader.h" #include "settings.h" #include "rules.h" @@ -581,16 +582,16 @@ static int runserver_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) { - bm_reloader_t *reloader = bm_reloader_new(ctx, all_exec, outputs, args); - if (reloader == NULL) { - return 3; - } + return bm_httpd_run(&ctx, all_exec, outputs, args); +} - int rv = bm_exec_blogc_runserver(ctx, bc_trie_lookup(args, "host"), - bc_trie_lookup(args, "port"), bc_trie_lookup(args, "threads")); - bm_reloader_stop(reloader); - return rv; +// WATCH RULE + +static int +watch_exec(bm_ctx_t *ctx, bc_slist_t *outputs, bc_trie_t *args) +{ + return bm_reloader_run(&ctx, all_exec, outputs, args); } @@ -667,12 +668,20 @@ }, { .name = "runserver", - .help = "run blogc-runserver pointing to output directory, if available\n" + .help = "run blogc-runserver pointing to output directory, if available,\n" + " rebuilding as needed\n" " arguments: host (127.0.0.1), port (8080) and threads (20)", .outputlist_func = NULL, .exec_func = runserver_exec, .generate_files = false, }, + { + .name = "watch", + .help = "watch for changes in the source files, rebuilding as needed", + .outputlist_func = NULL, + .exec_func = watch_exec, + .generate_files = false, + }, {NULL, NULL, NULL, NULL, false}, }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/blogc-runserver/main.c new/blogc-0.13.5/src/blogc-runserver/main.c --- old/blogc-0.13.4/src/blogc-runserver/main.c 2018-03-20 23:33:40.000000000 +0100 +++ new/blogc-0.13.5/src/blogc-runserver/main.c 2018-05-14 01:44:34.000000000 +0200 @@ -45,17 +45,14 @@ } -void sigint_handler(int sig) { - printf("\n"); - exit(0); -} - - int main(int argc, char **argv) { - signal(SIGPIPE, SIG_IGN); - signal(SIGINT, sigint_handler); + struct sigaction new_action; + new_action.sa_handler = SIG_IGN; + sigemptyset(&new_action.sa_mask); + new_action.sa_flags = 0; + sigaction(SIGPIPE, &new_action, NULL); int rv = 0; char *host = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/common/compat.c new/blogc-0.13.5/src/common/compat.c --- old/blogc-0.13.4/src/common/compat.c 1970-01-01 01:00:00.000000000 +0100 +++ new/blogc-0.13.5/src/common/compat.c 2018-05-14 01:44:34.000000000 +0200 @@ -0,0 +1,39 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2014-2019 Rafael G. Martins <raf...@rafaelmartins.eng.br> + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif /* HAVE_CONFIG_H */ + +#ifdef HAVE_SYS_WAIT_H +#include <sys/wait.h> +#endif /* HAVE_SYS_WAIT_H */ + +#include <signal.h> +#include "compat.h" + + +int +bc_compat_status_code(int waitstatus) +{ + int rv = waitstatus; +#if defined(WIFEXITED) && defined(WEXITSTATUS) && defined(WIFSIGNALED) && defined(WTERMSIG) + if (WIFEXITED(waitstatus)) { + rv = WEXITSTATUS(waitstatus); + } + else if (WIFSIGNALED(waitstatus)) { + rv = WTERMSIG(waitstatus); + rv += 128; + } +#elif defined(WIN32) || defined(_WIN32) + if (waitstatus == 3) { + rv = SIGTERM + 128; // can't get signal on windows. + } +#endif + return rv; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/blogc-0.13.4/src/common/compat.h new/blogc-0.13.5/src/common/compat.h --- old/blogc-0.13.4/src/common/compat.h 1970-01-01 01:00:00.000000000 +0100 +++ new/blogc-0.13.5/src/common/compat.h 2018-05-14 01:44:34.000000000 +0200 @@ -0,0 +1,14 @@ +/* + * blogc: A blog compiler. + * Copyright (C) 2014-2017 Rafael G. Martins <raf...@rafaelmartins.eng.br> + * + * This program can be distributed under the terms of the BSD License. + * See the file LICENSE. + */ + +#ifndef _COMPAT_H +#define _COMPAT_H + +int bc_compat_status_code(int waitstatus); + +#endif /* _COMPAT_H */