Skip to content

Commit 024c562

Browse files
authored
[9.0] Build duplicates of all installer packages for new signing keys (#16050)
1 parent e0fa670 commit 024c562

File tree

1 file changed

+49
-28
lines changed

1 file changed

+49
-28
lines changed

src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.singlerid.targets

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,22 @@
148148
<ExeBundleInstallerFile>$(PackageOutputPath)$(InstallerFileNameWithoutExtension).exe</ExeBundleInstallerFile>
149149
<ExeBundleInstallerEngineFile>$(PackageOutputPath)$(InstallerFileNameWithoutExtension)-engine.exe</ExeBundleInstallerEngineFile>
150150
</PropertyGroup>
151+
</Target>
151152

152-
<PropertyGroup Condition="'$(GenerateRpm)' == 'true'">
153-
<CreateRPMForCblMariner>true</CreateRPMForCblMariner>
154-
<!-- PackageTargetOS is a distro-specific version suffix, used for deps packages, including the one for CBL Mariner.
155-
We do not want to create additional CBL Mariner named RPMs of those packages. -->
156-
<CreateRPMForCblMariner Condition="'$(PackageTargetOS)' != ''">false</CreateRPMForCblMariner>
157-
</PropertyGroup>
158-
159-
<PropertyGroup Condition="'$(CreateRPMForCblMariner)' == 'true'">
153+
154+
<!--
155+
Packages produced for CBL-Mariner must be signed with a special certificate.
156+
Additionally, some distros use old keys (SHA-1 based) so there's a different cert for new packages.
157+
RPM v4 doesn't support multiple signatures, so we must have two separate copies of the RPM for us to sign.
158+
To solve this, we make copies of the packages with special names (which the Arcade SDK will sign with the correct certificate).
159+
PackageTargetOS is a distro-specific version suffix, used for deps packages, including the one for CBL-Mariner.
160+
As a result, we don't need to create a separate copy of the package for CBL-Mariner, but we do need to create a copy with the new key (unless the target is CBL-Mariner).
161+
-->
162+
<Target Name="_BuildMarinerRpm"
163+
AfterTargets="GenerateRpm"
164+
Condition="'$(PackageTargetOS)' != ''">
165+
<!-- CBL-Mariner -->
166+
<PropertyGroup>
160167
<!-- CBL-Mariner 1.0 -->
161168
<_CblMarinerVersionSuffix>cm.1</_CblMarinerVersionSuffix>
162169
<_InstallerBuildPartCblMariner>$(Version)-$(_CblMarinerVersionSuffix)-$(InstallerTargetArchitecture)</_InstallerBuildPartCblMariner>
@@ -168,6 +175,40 @@
168175
<_InstallerFileNameWithoutExtensionCblMariner2>$(InstallerName)-$(_InstallerBuildPartCblMariner2)$(CrossArchContentsBuildPart)</_InstallerFileNameWithoutExtensionCblMariner2>
169176
<_InstallerFileCblMariner2>$(PackageOutputPath)$(_InstallerFileNameWithoutExtensionCblMariner2)$(InstallerExtension)</_InstallerFileCblMariner2>
170177
</PropertyGroup>
178+
<Copy SourceFiles="$(_InstallerFile)"
179+
DestinationFiles="$(_InstallerFileCblMariner)"
180+
OverwriteReadOnlyFiles="True"
181+
SkipUnchangedFiles="False"
182+
UseHardlinksIfPossible="False" />
183+
184+
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileCblMariner)" Importance="high" />
185+
<Copy SourceFiles="$(_InstallerFile)"
186+
DestinationFiles="$(_InstallerFileCblMariner2)"
187+
OverwriteReadOnlyFiles="True"
188+
SkipUnchangedFiles="False"
189+
UseHardlinksIfPossible="False" />
190+
191+
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileCblMariner2)" Importance="high" />
192+
</Target>
193+
194+
<Target Name="_BuildNewKeyLinuxPackage"
195+
AfterTargets="GenerateRpm;GenerateDeb"
196+
Condition="'$(PackageTargetOS)' != 'cm.1' and '$(PackageTargetOS)' != 'cm.2'">
197+
<!-- Packages to be signed with the new key -->
198+
<PropertyGroup>
199+
<_NewKeyVersionSuffix>newkey</_NewKeyVersionSuffix>
200+
<_InstallerBuildPartNewKey>$(Version)-$(_NewKeyVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartNewKey>
201+
<_InstallerBuildPartNewKey Condition="'$(PackageTargetOS)' != ''">$(Version)-$(PackageTargetOS)-$(_NewKeyVersionSuffix)-$(_InstallerArchSuffix)</_InstallerBuildPartNewKey>
202+
<_InstallerFileNameWithoutExtensionNewKey>$(InstallerName)-$(_InstallerBuildPartNewKey)$(CrossArchContentsBuildPart)</_InstallerFileNameWithoutExtensionNewKey>
203+
<_InstallerFileNewKey>$(PackageOutputPath)$(_InstallerFileNameWithoutExtensionNewKey)$(InstallerExtension)</_InstallerFileNewKey>
204+
</PropertyGroup>
205+
<Copy SourceFiles="$(_InstallerFile)"
206+
DestinationFiles="$(_InstallerFileNewKey)"
207+
OverwriteReadOnlyFiles="True"
208+
SkipUnchangedFiles="False"
209+
UseHardlinksIfPossible="False" />
210+
211+
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileNewKey)" Importance="high" />
171212
</Target>
172213

173214
<!--
@@ -330,26 +371,6 @@
330371
UseHardlinksIfPossible="False" />
331372

332373
<Message Text="$(MSBuildProjectName) -> $(_InstallerFile)" Importance="high" />
333-
334-
<!-- CBL-Mariner 1.0 -->
335-
<Copy Condition="'$(CreateRPMForCblMariner)' == 'true'"
336-
SourceFiles="@(GeneratedRpmFiles)"
337-
DestinationFiles="$(_InstallerFileCblMariner)"
338-
OverwriteReadOnlyFiles="True"
339-
SkipUnchangedFiles="False"
340-
UseHardlinksIfPossible="False" />
341-
342-
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileCblMariner)" Importance="high" />
343-
344-
<!-- CBL-Mariner 2.0 -->
345-
<Copy Condition="'$(CreateRPMForCblMariner)' == 'true'"
346-
SourceFiles="@(GeneratedRpmFiles)"
347-
DestinationFiles="$(_InstallerFileCblMariner2)"
348-
OverwriteReadOnlyFiles="True"
349-
SkipUnchangedFiles="False"
350-
UseHardlinksIfPossible="False" />
351-
352-
<Message Text="$(MSBuildProjectName) -> $(_InstallerFileCblMariner2)" Importance="high" />
353374
</Target>
354375

355376
<Target Name="GetRpmInstallerJsonProperties"

0 commit comments

Comments
 (0)