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

(#2379) Correct pack files filter for Linux #2380

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

TheCakeIsNaOH
Copy link
Member

If there is not a element in the .nuspec, then the pack command
will gather up a list of all of files the in the directory which is
used to include them in the package. However, the nuspec should not be
included in this list, because it is auto-regenerated. The .nupkg also
should not be included. Therefore, there is a filter to remove the
.nuspec and .nupkg from the list of files.

However, this filter has the directory separator hardcoded as a
backslash. This does not work correctly on platforms where the
directory separator is a forward slash. Therefore, this fixes
the directory separator to be correct depending on what platform choco
is running on.

This patch was written by @AdmiringWorm, I just created the reproduction and packaged it up into a commit.
https://github.com/AdmiringWorm/chocolatey-arch/blob/master/0003-Use-correct-exclude-filer-on-unix.patch

Fixes #2379

I thought that the partUri issue was fixed by #2276, but it seems like there are actually two different problems that caused it.

If there is not a <files> element in the .nuspec, then the pack command
will gather up a list of all of files the in the directory which is
used to include them in the package. However, the nuspec should not be
included in this list, because it is auto-regenerated. The .nupkg also
should not be included. Therefore, there is a filter to remove the
.nuspec and .nupkg from the list of files.

However, this filter has the directory separator hardcoded as a
backslash. This does not work correctly on platforms where the
directory separator is a forward slash. Therefore, this fixes
the directory separator to be correct depending on what platform choco
is running on.

Co-Authored-By: Kim J. Nordmo <[email protected]>
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@gep13
Copy link
Member

gep13 commented Sep 27, 2021

This was tested on my Twitch stream this evening, we did the following:

  1. Used this folder structure as a test package: https://github.com/Starz0r/ChocolateyPackagingScripts/tree/master/src/templates/dust
  2. NOTE: Had to remove the description element in the nuspec as this caused a different problem
  3. Ran the docker image for Chocolatey, and attmepted choco pack and got the error indicated
  4. Added files element to nuspec and re-ran choco pack everything worked as expected
  5. Checked out PR branch and re-built docker image using new code
  6. Ran choco pack without files element and it worked as expected
  7. Ran choco pack with files element and it also worked as expected

@gep13 gep13 merged commit 461e771 into chocolatey:develop Sep 27, 2021
@gep13
Copy link
Member

gep13 commented Sep 27, 2021

@TheCakeIsNaOH thank you very much for getting to the bottom of this problem, really appreciate it!

@TheCakeIsNaOH TheCakeIsNaOH deleted the nuspec-filter branch September 28, 2021 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Building a package on Linux fails if nuspec does not have files element
2 participants