From: Lady Date: Tue, 6 Feb 2024 03:56:03 +0000 (-0500) Subject: Replace GENERATOR and VERSION with THISREV X-Git-Tag: 0.6.0~1 X-Git-Url: https://git.ladys.computer/Shushe/commitdiff_plain/d64d93fe12371f87cc42d72e7e874115b28fb252?ds=inline Replace GENERATOR and VERSION with THISREV Instead of replacing existing ``s, format them into a comma‐separated list with ⛩️📰 书社 as the final entry. Don’t allow overriding of ⛩️📰 书社 generator metadata. Manually specifying `THISREV` is still possible to allow it to be filled by users running Make without Git, but it should not be overridden with the version of the calling generator, as it is used to fill `@书社:version`. --- diff --git a/GNUmakefile b/GNUmakefile index 5f55e1a..f0c9e8a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -168,13 +168,10 @@ TRANSFORMS := $(sort $(patsubst ./%,%,$(wildcard $(THISDIR)/transforms/*.xslt)) # List of types which should be treated as X·M·L. XMLTYPES := application/xml text/xml -# The name of the generator program. -GENERATOR := ⛩️📰 书社 - ifdef GIT ifneq ($(wildcard $(THISDIR)/.git),) # A description of the current git revision of ⛩️📰 书社. -VERSION := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true) +THISREV := $(shell cd $(THISDIR); $(GIT) describe 2> /dev/null || $(GIT) rev-parse HEAD 2> /dev/null || true) endif ifneq ($(wildcard .git),) @@ -500,7 +497,7 @@ $(BUILDDIR)/parser.xslt : $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2pars $(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(BUILDDIR)/parser.xslt $(typeupdates) @$(PRINTF) '%s\n' $(call quote,Processing `$<´…) $(silent)$(call ensuredirectory,$(dir $@)) - $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$<)) --stringparam CKSUM $$($(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//')$(if $(GENERATOR), --stringparam GENERATOR $(call quote,$(GENERATOR)))$(if $(VERSION), --stringparam VERSION $(call quote,$(VERSION)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/parser.xslt) -) + $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,) > $(call quote,$@),$(if $(filter $<,$(plaintextfiles)),$(call wrapplaintext,$<),$(CAT) $(call quote,$<)) | $(XSLTPROC) -o $(call quote,$@) --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$<)) --stringparam CKSUM $$($(CKSUM) $(call quote,$<) | $(SED) 's/[ ].*//')$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/parser.xslt) -) # Generate a catalog of all parsed files, for use when processing includes. # @@ -536,7 +533,7 @@ $(BUILDDIR)/transform.xslt : $(BUILDDIR)/transform.catalog $(THISDIR)/lib/catalo $(call compiled,$(compilablefiles)) : $(BUILDDIR)/public/% : $$(call parsed,$$(call uncompiled,$$@)) $(BUILDDIR)/transform.xslt $$(call parsed,$$(call dependencies,$$(call uncompiled,$$@))) $(silent)$(call ensuredirectory,$(dir $@)) @$(PRINTF) '%s\n' $(call quote,Compiling …) - $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam CATALOG 'catalog' --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$(call uncompiled,$@))) --stringparam PATH $(call quote,/$*) --stringparam CKSUM $$($(CKSUM) $(call quote,$(call uncompiled,$@)) | $(SED) 's/[ ].*//')$(if $(GENERATOR), --stringparam GENERATOR $(call quote,$(GENERATOR)))$(if $(VERSION), --stringparam VERSION $(call quote,$(VERSION)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) + $(silent)$(XSLTPROC) -o $(call quote,$@) --stringparam CATALOG 'catalog' --stringparam BUILDTIME $$(TZ= $(DATE) '+%Y-%m-%dT%H:%M:%SZ') --stringparam SRCTIME $$(TZ= $(STAT) -f '%Sm' -t '%Y-%m-%dT%H:%M:%SZ' $(call quote,$(call uncompiled,$@))) --stringparam PATH $(call quote,/$*) --stringparam CKSUM $$($(CKSUM) $(call quote,$(call uncompiled,$@)) | $(SED) 's/[ ].*//')$(if $(THISREV), --stringparam THISREV $(call quote,$(THISREV)),)$(if $(SRCREV), --stringparam SRCREV $(call quote,$(SRCREV)),) $(call quote,$(BUILDDIR)/transform.xslt) $(call quote,$<) $(call compiled,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call uncompiled,$$@) @$(PRINTF) '%s\n' $(call quote,Compiling …) $(silent)$(call ensuredirectory,$(dir $@)) diff --git a/README.markdown b/README.markdown index 885fe75..6b4f06e 100644 --- a/README.markdown +++ b/README.markdown @@ -214,11 +214,8 @@ The following additional variables can be used to control the behaviour A white·space‐separated list of media types to consider X·M·L (default: `application/xml text/xml`). -- **`GENERATOR`:** - The name of the generator program (default: `⛩️📰 书社`). - -- **`VERSION`:** - The current version of `GENERATOR` (default: derived from the current +- **`THISREV`:** + The current version of ⛩️📰 书社 (default: derived from the current git tag/branch/commit). - **`SRCREV`:** @@ -454,17 +451,14 @@ The following params are made available globally in parsers and - **`CKSUM`:** The checksum of the source file (⅌ `cksum`). -- **`GENERATOR`:** - The value of the `GENERATOR` variable (if present). - - **`SRCREV`:** The value of the `SRCREV` variable (if present). - **`SRCTIME`:** The time at which the source file was last modified. -- **`VERSION`:** - The value of the `VERSION` variable (if present). +- **`THISREV`:** + The value of the `THISREV` variable (if present). The following params are only available in transforms :⁠— diff --git a/lib/catalog2parser.xslt b/lib/catalog2parser.xslt index 7791570..4ea7bda 100644 --- a/lib/catalog2parser.xslt +++ b/lib/catalog2parser.xslt @@ -24,10 +24,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - - + diff --git a/lib/catalog2transform.xslt b/lib/catalog2transform.xslt index 5b7183e..a6c83d6 100644 --- a/lib/catalog2transform.xslt +++ b/lib/catalog2transform.xslt @@ -28,11 +28,10 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - - + @@ -53,9 +52,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - + - + @@ -132,9 +131,9 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - + - + @@ -156,18 +155,20 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one - - - - - - ( - - ) - - - - + + + + + , + + ⛩️📰 书社 + + ( + + ) + + +