From 3ef600e96ef1eeed4798ebf4ca0f914f30f827ee Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sat, 11 Nov 2023 20:18:08 -0500 Subject: Build all publishers, fallback to $PATH lookups as necessary. --- Makefile.am | 16 ++-------------- configure.ac | 13 +++++-------- haunt/publisher/rsync.scm | 6 +----- haunt/publisher/sourcehut.scm | 8 ++++---- 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7a6583e..15cc34f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -59,6 +59,8 @@ SOURCES = \ haunt/builder/blog.scm \ haunt/builder/rss.scm \ haunt/reader/texinfo.scm \ + haunt/publisher/rsync.scm \ + haunt/publisher/sourcehut.scm \ haunt/watch/fallback.scm \ haunt/ui.scm \ haunt/ui/build.scm \ @@ -91,20 +93,6 @@ SOURCES += \ endif -if HAVE_RSYNC - -SOURCES += haunt/publisher/rsync.scm - -endif - -if HAVE_HUT -if HAVE_TAR - -SOURCES += haunt/publisher/sourcehut.scm - -endif -endif - TESTS = \ tests/helper.scm \ tests/post.scm \ diff --git a/configure.ac b/configure.ac index 02c6c8f..1ccbb7a 100644 --- a/configure.ac +++ b/configure.ac @@ -33,13 +33,10 @@ AM_CONDITIONAL([HAVE_GUILE_COMMONMARK], [test "x$have_guile_commonmark" = "xyes" AC_CHECK_FUNC([inotify_init], [AM_CONDITIONAL(HAVE_INOTIFY, true)], [AM_CONDITIONAL(HAVE_INOTIFY, false)]) -AC_PATH_PROG([RSYNC], [rsync]) -AM_CONDITIONAL([HAVE_RSYNC], [test "x$RSYNC" != "x"]) - -AC_PATH_PROG([HUT], [hut]) -AM_CONDITIONAL([HAVE_HUT], [test "x$HUT" != "x"]) - -AC_PATH_PROG([TAR], [tar]) -AM_CONDITIONAL([HAVE_TAR], [test "x$TAR" != "x"]) +dnl Attempt to find these programs, but if they're not found just +dnl default to searching for them on $PATH at runtime. +AC_PATH_PROG([RSYNC], [rsync], [rsync]) +AC_PATH_PROG([HUT], [hut], [hut]) +AC_PATH_PROG([TAR], [tar], [tar]) AC_OUTPUT diff --git a/haunt/publisher/rsync.scm b/haunt/publisher/rsync.scm index 76461f4..4498012 100644 --- a/haunt/publisher/rsync.scm +++ b/haunt/publisher/rsync.scm @@ -36,11 +36,7 @@ (define* (rsync-publisher #:key destination user host (name %default-publisher-name) (flags %default-rsync-flags) - ;; Attempt to use the rsync found at - ;; configure time, but if something wacky is - ;; going on then try to use whatever rsync - ;; might be on $PATH. - (rsync (if (file-exists? %rsync) %rsync "rsync"))) + (rsync %rsync)) "Return a new publisher named NAME that publishes a site to DESTINATION, either locally or to a remote host if HOST and/or USER arguments are specified. Passing RSYNC overrides the default rsync diff --git a/haunt/publisher/sourcehut.scm b/haunt/publisher/sourcehut.scm index 035d399..55059ca 100644 --- a/haunt/publisher/sourcehut.scm +++ b/haunt/publisher/sourcehut.scm @@ -30,11 +30,11 @@ (define* (sourcehut-publisher #:key (name %default-publisher-name) - ;; TODO: Factor out some helper for this. - (hut (if (file-exists? %hut) %hut "hut")) - (tar (if (file-exists? %tar) %tar "tar"))) + (hut %hut) + (tar %tar)) "Return a new publisher named NAME that publishes a site to -Sourcehut pages." +Sourcehut pages. Passing RSYNC and/or TAR overrides the default +executables used." (define (publish site) (let ((tarball (string-append (or (getenv "TMPDIR") "/tmp") "/haunt-publish-sourcehut-" -- cgit v1.2.3