Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$env:ChocolateyPackageName: for consistency, it should better be named $env:ChocolateyPackageId #2781

Open
schittli opened this issue Jul 31, 2022 · 1 comment · May be fixed by #2900
Open

Comments

@schittli
Copy link

Is Your Feature Request Related To A Problem? Please describe.

Yes, it is a problem because it creates confusion.
The Docs: Environment Variables explains:

  • ChocolateyPackageTitle: … equivalent to the <title /> field in the nuspec
  • ChocolateyPackageVersion: … equivalent to the <version /> field in the nuspec

This rule is great: The $Env-Variable is named according to the field in nuspec 😃, therefore we must not ask google for the $env variable name for the nuspec Title / Version field. It is intuitive.

But now, Choco breaks the rule, the Docs explains:

  • ChocolateyPackageName: … equivalent to the <id /> field in the nuspec

Describe The Solution. Why is it needed?

It would be very helpful if in the next version of Chocolatey:

  • $env:ChocolateyPackageName will be renamed to $env:ChocolateyPackageId
  • Then, $env:ChocolateyPackageName gets an Alias for $env:ChocolateyPackageId which will disappear in a later version

I hope that I have not to explain why this is useful 😃

Additional Context.

N/A

Related Issues

N/A

@TheCakeIsNaOH
Copy link
Member

$env:ChocolateyPackageName will be renamed to $env:ChocolateyPackageId

Adding $env:ChocolateyPackageId as an alternative to $env:ChocolateyPackageName sounds fine to me. It is intuitive (as you mentioned) to have the name of the environment variable match the name of the .nuspec element.

Then, $env:ChocolateyPackageName gets an Alias for $env:ChocolateyPackageId which will disappear in a later version

However, I think $env:ChocolateyPackageName should not be removed, and should stay around indefinitely.

It's probably one of the more commonly used environment variables, with perhaps one in ten packages utilizing it (could be more, could be less) on the CCR (Chocolatey Community Repository). Removing it would mean that there would be many thousands of broken package versions on CCR alone, and an unknown number of broken package versions on internal repositories. I'm not seeing any problems with keeping it around that would

steviecoaster added a commit to steviecoaster/choco that referenced this issue Nov 11, 2022
Previously the only env variable to reference a Chocolatey package id
was $env:ChocolateyPackageName. This is inconsistent with the nusepec
file where it is referenced as id.

This commit adds chocolateyPackageId and packageId to the available
environment variables available inside the PowerShell host allowing a
package maintainer to reference the id of a package with the more
idiomatic $env:ChocolateyPackageId.
@steviecoaster steviecoaster linked a pull request Nov 11, 2022 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants