summaryrefslogtreecommitdiffstats
path: root/src/etc/installer/msi/squash-components.xsl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/etc/installer/msi/squash-components.xsl
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/etc/installer/msi/squash-components.xsl')
-rw-r--r--src/etc/installer/msi/squash-components.xsl34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/etc/installer/msi/squash-components.xsl b/src/etc/installer/msi/squash-components.xsl
new file mode 100644
index 000000000..17b4e0388
--- /dev/null
+++ b/src/etc/installer/msi/squash-components.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:wix="http://schemas.microsoft.com/wix/2006/wi">
+ <!-- Copy all attributes and elements to the output. -->
+ <xsl:template match="@*|*">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|*"/>
+ </xsl:copy>
+ </xsl:template>
+ <xsl:output method="xml" indent="yes" />
+
+ <!-- Move all files in directory into first component in that directory. -->
+ <xsl:template match="wix:Component[1]">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|*"/>
+ <xsl:for-each select="../wix:Component[preceding-sibling::*]/wix:File">
+ <xsl:copy>
+ <!-- Component can only have one KeyPath -->
+ <xsl:apply-templates select="@*[not(name()='KeyPath')]|*"/>
+ </xsl:copy>
+ </xsl:for-each>
+ </xsl:copy>
+ </xsl:template>
+
+ <!-- Now the rest of components are empty, find them. -->
+ <xsl:key name="empty-cmp-ids" match="wix:Component[preceding-sibling::*]" use="@Id" />
+
+ <!-- And remove. -->
+ <xsl:template match="wix:Component[preceding-sibling::*]" />
+
+ <!-- Also remove componentsrefs referencing empty components. -->
+ <xsl:template match="wix:ComponentRef[key('empty-cmp-ids', @Id)]" />
+</xsl:stylesheet>