0

i have been pouring over Chocolatey documentation and have not yet found an example of the use of package-parameter argument that addresses my need. Note, i am relativey new to Chocolatey.

I am attempting to create a NuGet package, using Chocolately, from within a DOS batch file. The NuGet package is getting created, however, the attempt to pass in a checksum value as a package parameter is failing. The following two line excerpt shows gathering of a checksum value (i've confirmed this works), and my calling of the Chocolatey pack command. My reading of the Chocolatey documentation suggests this should work, but it does not.

FOR /F "usebackq delims=" %%v IN (powershell -noprofile "& {(get-filehash -path "foo.zip" -Algorithm MD5).hash} ") DO set "CHECKSUM=%%v"

cpack --package-parameters=""checksum:%CHECKSUM%""

speKc
  • 21
  • 3

2 Answers2

0

Can I ask where you read that Package Parameters are used when executing the choco pack command?

Package Parameters are passed into Chocolatey when using the choco install command. They are intended to contain functionality to allow the installing user to alter how the package is installed. They are not intended for passing parameters into the package at the point of creation.

You can find more information about Package Parameters here:

https://chocolatey.org/docs/how-to-parse-package-parameters-argument

For what it seems like you are doing, I think the recommendation would be to use something like AU for automatically gathering the checksum for a package, and creating the nupkg file:

https://github.com/majkinetor/au

Gary Ewan Park
  • 17,610
  • 5
  • 42
  • 60
0

I addressed the issue by scripting the update of chocolateyinstall.ps1 to include checksum attribute/value pair; I am no longer attempting to pass checksum as a parameter. I did not find documentation showing Package Parameter use with choco pack command ... i'm certain i misread some documentation or post. I appreciate the help and clarification.

speKc
  • 21
  • 3