豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 0433cdc

Browse files
committed
Re-enable support for deterministic pack
When deterministic mode is enabled, it tries to make nuget packages more deterministic/reproducible. This results in more using predicable names for psmdcp files. The contents of nuget packagse (after extraction) should be fully deterministic and reproducible after this change. Unless packages are signed. For more details, see: https://github.com/NuGet/Home/main/accepted/2026/deterministic-pack-revisited.md Fixes: NuGet/Home#8601
1 parent 8b3572f commit 0433cdc

File tree

32 files changed

+189
-15
lines changed

32 files changed

+189
-15
lines changed

src/NuGet.Clients/NuGet.CommandLine/Commands/PackCommand.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ public Dictionary<string, string> Properties
103103
[Option(typeof(NuGetCommand), "PackageCommandConfigFile")]
104104
public new string ConfigFile { get; set; }
105105

106+
[Option(typeof(NuGetCommand), "PackageCommandDeterministic")]
107+
public bool Deterministic { get; set; }
108+
109+
[Option(typeof(NuGetCommand), "PackageCommandDeterministicTimestamp")]
110+
public string DeterministicTimestamp { get; set; }
111+
106112
public override void ExecuteCommand()
107113
{
108114
var packArgs = new PackArgs();
@@ -111,6 +117,8 @@ public override void ExecuteCommand()
111117
packArgs.OutputDirectory = OutputDirectory;
112118
packArgs.BasePath = BasePath;
113119
packArgs.MsBuildDirectory = new Lazy<string>(() => MsBuildUtility.GetMsBuildDirectoryFromMsBuildPath(MSBuildPath, MSBuildVersion, Console).Value.Path);
120+
packArgs.Deterministic = Deterministic;
121+
packArgs.DeterministicTimestamp = DeterministicTimestamp;
114122

115123
if (!string.IsNullOrEmpty(PackagesDirectory))
116124
{

src/NuGet.Clients/NuGet.CommandLine/Commands/ProjectFactory.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ public PackageBuilder CreateBuilder(string basePath, NuGetVersion version, strin
236236
}
237237
}
238238

239+
// TODO is deterministic-ness tied in here?
239240
builder = new PackageBuilder(false, Logger);
240241

241242
try

src/NuGet.Clients/NuGet.CommandLine/NuGetCommand.Designer.cs

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/NuGet.Clients/NuGet.CommandLine/NuGetCommand.resx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -841,6 +841,9 @@ nuget trusted-signers Remove -Name TrustedRepo</value>
841841
<data name="PackageCommandDeterministic" xml:space="preserve">
842842
<value>Specify if the command should create a deterministic package. Multiple invocations of the pack command will create the exact same package.</value>
843843
</data>
844+
<data name="PackageCommandDeterministicTimestamp" xml:space="preserve">
845+
<value>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</value>
846+
</data>
844847
<data name="ClientCertificatesCommandFilePathDescription" xml:space="preserve">
845848
<value>Path to certificate file.</value>
846849
</data>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.cs.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Určete, jestli má příkaz vytvořit deterministický balíček. Vícenásobné vyvolání příkazu pack vytvoří úplně stejný balíček.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Určuje nejméně jeden vzor zástupných znaků, který se má vyloučit při vytváření balíčku.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.de.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Geben Sie an, ob der Befehl ein deterministisches Paket erstellen soll. Durch mehrere Aufrufe des Paketbefehls wird genau dasselbe Paket erstellt.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Gibt mindestens ein Platzhaltermuster an, das beim Erstellen eines Pakets ausgeschlossen werden soll.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.es.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Especifique si el comando debe crear un paquete determinista. Varias invocaciones del comando pack crearán exactamente el mismo paquete.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Especifica uno o varios patrones de comodines que se excluirán al crear un paquete.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.fr.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Spécifiez si la commande doit créer un package déterministe. Plusieurs appels de la commande pack créent exactement le même package.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Spécifie un ou plusieurs modèles à caractère générique à exclure durant la création d'un package.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.it.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">Specificare se il comando deve creare un pacchetto deterministico. Le chiamate multiple del comando pack creeranno lo stesso pacchetto.</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">Specifica uno o più caratteri jolly da escludere durante la creazione di un pacchetto.</target>

src/NuGet.Clients/NuGet.CommandLine/xlf/NuGetCommand.ja.xlf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,11 @@ nuget pack foo.nuspec -Version 2.1.0</target>
601601
<target state="translated">コマンドで決定論的パッケージを作成する必要があるかどうかを指定します。パック コマンドを複数回呼び出すと、まったく同じパッケージが作成されます。</target>
602602
<note />
603603
</trans-unit>
604+
<trans-unit id="PackageCommandDeterministicTimestamp">
605+
<source>Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</source>
606+
<target state="new">Specify the timestamp this command should use when creating a deterministic package. Multiple invocations of the pack command will create the exact same package.</target>
607+
<note />
608+
</trans-unit>
604609
<trans-unit id="PackageCommandExcludeDescription">
605610
<source>Specifies one or more wildcard patterns to exclude when creating a package.</source>
606611
<target state="translated">パッケージの作成時に除外する 1 つまたは複数のワイルドカード パターンを指定します。</target>

0 commit comments

Comments
 (0)