From e9fec3b1dc32cf9df20fc9774a63065bc14ddad8 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 24 Jun 2013 13:05:00 -0700 Subject: [PATCH 1/2] Remove "clean" task from "make html"; fixes #637 This change removes the "clean" task from the "html" and "regenerate" tasks in the default Makefile generated by pelican-quickstart. The previous behavior ignored whether the DELETE_OUTPUT_DIRECTORY setting was set to True or not and deleted everything in the output directory every time the "make html" or "make regenerate" task was run. In addition to violating the Principle of Least Astonishment, there was also the potential for data loss if the user wasn't careful when defining the output directory location in the Makefile. The new behavior therefore relies primarily on the DELETE_OUTPUT_DIRECTORY setting to control if and when the output directory is cleaned. The default settings and Makefile generated by the pelican-quickstart command, for example, no longer clean the output directory when the "make html" task is run. If the user wants to change this behavior and have the output directory cleaned on every "make html" run, the recommended method would be to set DELETE_OUTPUT_DIRECTORY to True in pelicanconf.py. Alternatively, the user can manually run "make clean", with the caveat that the output directory and its contents will be entirely destroyed, including any otherwise to-be-retained files or folders specified in the OUTPUT_RETENTION setting. It is for that reason that relying on the DELETE_OUTPUT_DIRECTORY setting is instead recommended. As before, DELETE_OUTPUT_DIRECTORY is set to True in the publishconf.py settings file generated by the pelican-quickstart script. This way, any potentially old and irrelevant files will be automatically removed before the latest version of the site is transferred to the production server environment. In summary, this change allows for the sanest possible default settings, while still allowing end users to customize output cleaning to their preferred behavior with a minimum of confusion. --- pelican/tools/templates/Makefile.in | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 221568aa..8890db6f 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -40,15 +40,13 @@ help: @echo ' ' -html: clean $$(OUTPUTDIR)/index.html - -$$(OUTPUTDIR)/%.html: +html: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) clean: [ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete -regenerate: clean +regenerate: $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) serve: From bf0a50880d35f803ec5c929bfe60b026accf9307 Mon Sep 17 00:00:00 2001 From: Justin Mayer Date: Mon, 24 Jun 2013 13:40:32 -0700 Subject: [PATCH 2/2] Revert "make clean" behavior to rm -rf. Fixes #773 The change to the "make clean" task in 764a2cf from "rm -rf" to instead relying on GNU "find" appears to have broken cross-platform portability, likely causing problems on *BSD and other platforms. This commit reverts that change back to the previous "rm -rf" behavior. --- pelican/tools/templates/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican/tools/templates/Makefile.in b/pelican/tools/templates/Makefile.in index 8890db6f..4bc764ca 100644 --- a/pelican/tools/templates/Makefile.in +++ b/pelican/tools/templates/Makefile.in @@ -44,7 +44,7 @@ html: $$(PELICAN) $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS) clean: - [ ! -d $$(OUTPUTDIR) ] || find $$(OUTPUTDIR) -mindepth 1 -delete + [ ! -d $$(OUTPUTDIR) ] || rm -rf $$(OUTPUTDIR) regenerate: $$(PELICAN) -r $$(INPUTDIR) -o $$(OUTPUTDIR) -s $$(CONFFILE) $$(PELICANOPTS)