From: Lady Date: Sun, 19 May 2024 22:09:06 +0000 (-0400) Subject: Force removal of existing directories X-Git-Tag: 0.8.3^0 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/d76a5f3dbbc1f19ef2033a9b9d3bf2c5c0218d34?ds=inline Force removal of existing directories …prior to processing results or installing. Mostly, this prevents a failure when an expanded archive is changed to no longer be expanded. This also simplifies the installation code a bit. --- diff --git a/GNUmakefile b/GNUmakefile index 495b8a4..0156970 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -640,17 +640,20 @@ $(call compiled,$(compilablefiles)) : $(BUILDDIR)/results/% : $$(call parsed,$$( $(call built,$(compilablefiles)) : $(BUILDDIR)/public/% : $(BUILDDIR)/results/% @$(PRINTF) '%s\n' $(call quote,Building …) $(silent)$(call ensuredirectory,$(dir $@)) + $(silent)$(RM) -f -R $(call quote,$@) $(silent)$(call processresultto,$<,$@,$*) $(call built,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call unbuilt,$$@) @$(PRINTF) '%s\n' $(call quote,Building …) $(silent)$(call ensuredirectory,$(dir $@)) + $(silent)$(RM) -f -R $(call quote,$@) $(silent)$(CP) $(call quote,$<) $(call quote,$@) # Install compiled files (or error in the case of recursive ones). $(call installed,$(recursivefiles) $(installablefiles)) : $(DESTDIR)/% : $(BUILDDIR)/public/% @$(PRINTF) '%s\n' $(call quote,Installing …) $(silent)$(call ensuredirectory,$(dir $@)) - $(silent)if $(TEST) -d $(call quote,$<); then $(RM) -f -R $(call quote,$@); $(CP) -R $(call quote,$<) $(call quote,$@); else $(CP) $(call quote,$<) $(call quote,$@); fi + $(silent)$(RM) -f -R $(call quote,$@) + $(silent)$(CP) -R $(call quote,$<) $(call quote,$@) $(silent)for associated in $$($(call associatedfiles,$(dir $<),$(notdir $<))); do $(PRINTF) '%s\n' "$$associated" | $(SED) 's/^\(.*\)"{\(.*\)}"\(.*\)$$/\1\2\3/' | $(xargsquote) | $(XARGS) -E '' $(PRINTF) '%s%s\n' $(call quote,$(dir $@)) | $(xargsquote) | $(XARGS) -E '' $(CP) $(call quote,$(dir $<))"$$associated"; done # ━ § BEGIN ARCHIVE MAKE·FILE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ @@ -697,6 +700,7 @@ $(foreach file,$(archivefiles),$(BUILDDIR)/extracted/$(file)) : $(BUILDDIR)/inde $(foreach file,$(archivefiles),$(BUILDDIR)/files/$(file)) : $(BUILDDIR)/files/% : $(BUILDDIR)/extracted/% @$(PRINTF) '%s\n' $(call quote,Building …) $(silent)$(call ensuredirectory,$(dir $@)) + $(silent)$(RM) -f -R $(call quote,$@) $(silent)$(call processresultto,$<,$@,$*) # Archive all components in the file to the destination. @@ -705,7 +709,8 @@ $(foreach file,$(archivefiles),$(BUILDDIR)/files/$(file)) : $(BUILDDIR)/files/% $(DESTDIR)/% : $(SRC) $(foreach file,$(archivefiles),$(BUILDDIR)/files/$(file)) @$(PRINTF) '%s\n' $(call quote,Archiving …) $(silent)$(call ensuredirectory,$(dir $@)) - $(silent)cd $(call quote,$(BUILDDIR)/files); if $(call xpath,/*/@*[local-name()="expanded" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$(abspath $<)); then $(RM) -f -R $(call quote,$(abspath $@)); $(MKDIR) -p $(call quote,$(abspath $@)); $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -r -w $(call quote,$(abspath $@)); else $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -w -x ustar > $(call quote,$(abspath $@)); fi + $(silent)$(RM) -f -R $(call quote,$@) + $(silent)cd $(call quote,$(BUILDDIR)/files); if $(call xpath,/*/@*[local-name()="expanded" and namespace-uri()="urn:fdc:ladys.computer:20231231:Shu1She4"],$(abspath $<)); then $(MKDIR) -p $(call quote,$(abspath $@)); $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -r -w $(call quote,$(abspath $@)); else $(PRINTF) '%s\n' $(foreach file,$(archivefiles),$(call quote,$(file))) | $(PAX) -w -x ustar > $(call quote,$(abspath $@)); fi # ━ § BEGIN PAGED MAKE·FILE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━