]> Lady’s Gitweb - Shushe/commitdiff
Provide source checksums to parsers and transforms
authorLady <redacted>
Sun, 4 Feb 2024 00:47:40 +0000 (19:47 -0500)
committerLady <redacted>
Sun, 4 Feb 2024 00:49:54 +0000 (19:49 -0500)
GNUmakefile
README.markdown
lib/catalog2parser.xslt
lib/catalog2transform.xslt

index 8306fc14333ddb55a71b1ef5bd8f012dd17f4a78..d760073c609058ac0b76206c1d6cd6f36d25b2e4 100644 (file)
@@ -16,6 +16,7 @@ override define makefileinfo
 ║│                                                            │║
 ║│ • awk                                                      │║
 ║│ • cat                                                      │║
+║│ • cksum                                                    │║
 ║│ • cp                                                       │║
 ║│ • date                                                     │║
 ║│ • echo                                                     │║
@@ -89,6 +90,7 @@ endef
 # If these are not installed on your computer, or you need to use a different implementation, you can override the appropriate variable.
 AWK := awk
 CAT := cat
+CKSUM := cksum
 CP := cp
 DATE := date
 ECHO := echo
@@ -480,7 +482,7 @@ $(BUILDDIR)/parser.xslt: $(BUILDDIR)/parser.catalog $(THISDIR)/lib/catalog2parse
 $(call parsed,$(sourcefiles) $(sourceincludes)) : % : $$(call unparsed,$$@) $(typeupdates)
        @$(PRINTF) '%s\n' $(call quote,Processing `$<´…)
        $(silent)$(call ensuredirectory,$(dir $@))
-       $(silent)$(if $(filter $<,$(assetfiles)),$(PRINTF) '%s\n' $(call quote,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$<)" data="$(call datauri,$<)"/>) > $(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,$(call unparsed,$@)))$(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,<object xmlns="http://www.w3.org/1999/xhtml" type="$(call typeoffile,$<)" data="$(call datauri,$<)"/>) > $(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) -)
 
 # Generate a catalog of all parsed files, for use when processing includes.
 #
@@ -516,7 +518,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,/$*)$(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 $(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,$<)
 $(call compiled,$(filter $(assetfiles),$(sourcefiles))) : $(BUILDDIR)/public/% : $$(call uncompiled,$$@)
        @$(PRINTF) '%s\n' $(call quote,Compiling </$*>…)
        $(silent)$(call ensuredirectory,$(dir $@))
index 573fb86e51fe59b89c2ac7586986d5a23330c71b..e0a143e5f5ea0fa823630038a616edf6496ec97f 100644 (file)
@@ -102,6 +102,7 @@ In every case, you may supply your own implementation by overriding the
 
 - `awk`
 - `cat`
+- `cksum`
 - `cp`
 - `date`
 - `echo`
@@ -431,6 +432,9 @@ The following params are made available globally in parsers and
 - **`BUILDTIME`:**
   The current time.
 
+- **`CKSUM`:**
+  The checksum of the source file (⅌ `cksum`).
+
 - **`GENERATOR`:**
   The value of the `GENERATOR` variable (if present).
 
index 1d8ad5d8d4e925e7ed0f845070820defe0d24a9b..eb35e803d24da0ba21a793f5177facab2713bc9a 100644 (file)
@@ -23,6 +23,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        <template match="/">
                <xslt:transform version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
+                       <xslt:param name="CKSUM" select="false"/>
                        <xslt:param name="GENERATOR" select="false"/>
                        <xslt:param name="SRCREV" select="false"/>
                        <xslt:param name="SRCTIME" select="'1972-12-31T00:00:00Z'"/>
index 40e40722e8556470b17464b5b9b84ff99d566156..5b7183e725418654b034c175be01b19677ebde7e 100644 (file)
@@ -26,6 +26,7 @@ If a copy of the M·P·L was not distributed with this file, You can obtain one
        <template match="/">
                <xslt:transform exclude-result-prefixes="catalog exsl exslstr" version="1.0">
                        <xslt:param name="BUILDTIME" select="'1972-12-31T00:00:00Z'"/>
+                       <xslt:param name="CKSUM" select="false"/>
                        <xslt:param name="CATALOG" select="'catalog'"/>
                        <xslt:param name="GENERATOR" select="false"/>
                        <xslt:param name="PATH" select="'/unknown'"/>
This page took 0.033687 seconds and 4 git commands to generate.