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

Building a package on Linux fails if nuspec does not have files element #2379

Closed
TheCakeIsNaOH opened this issue Sep 27, 2021 · 0 comments · Fixed by #2380
Closed

Building a package on Linux fails if nuspec does not have files element #2379

TheCakeIsNaOH opened this issue Sep 27, 2021 · 0 comments · Fixed by #2380

Comments

@TheCakeIsNaOH
Copy link
Member

What You Are Seeing?

When running on Mono on Linux, if the .nuspec does not have a <files> element, building a package with choco pack can fail with the error:
This partUri is already contained in the package

What is Expected?

That choco pack should work even if there is not a <files> element.

How Did You Get This To Happen? (Steps to Reproduce)

Run choco pack to build a package where the .nuspec does not have a <files> element.

Output Log

Full Log Output

/no-files-zfsin$ choco pack --verbose --debug
Chocolatey v0.11.2-22-g19d7dd10
Chocolatey is running on Linux v 5.10.0.0
Attempting to delete file "/opt/chocolatey/chocolatey.dll.old".
Attempting to delete file "/opt/chocolatey/choco.exe.old".
Command line: /opt/chocolatey/choco.exe pack --verbose --debug --allow-unofficial
Received arguments: pack --verbose --debug --allow-unofficial
RemovePendingPackagesTask is now ready and waiting for PreRunMessage.
Sending message 'PreRunMessage' out if there are subscribers...
[Pending] Removing all pending packages that should not be considered installed...
Performing validation checks.
Global Configuration Validation Checks:
 - Package Exit Code / Exit On Reboot = Checked
System State Validation Checks:
The source 'https://chocolatey.org/api/v2/' evaluated to a 'normal' source type

NOTE: Hiding sensitive configuration data! Please double and triple
 check to be sure no sensitive data is shown, especially if copying
 output to a gist for review.
Configuration: CommandName='pack'|CacheLocation='/tmp/chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|WebRequestTimeoutSeconds='30'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Trace='False'|Force='False'|Noop='False'|
HelpRequested='False'|UnsuccessfulParsing='False'|RegularOutput='True'|
QuietOutput='False'|PromptForConfirmation='False'|
AcceptLicense='False'|
AllowUnofficialBuild='True'|AllVersions='False'|
SkipPackageInstallProvider='False'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|
ApplyPackageParametersToDependencies='False'|
ApplyInstallArgumentsToDependencies='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Linux'|
Information.PlatformVersion='5.10.0.0'|
Information.PlatformName='Linux'|
Information.ChocolateyVersion='0.12.0.0'|
Information.ChocolateyProductVersion='0.11.2-22-g19d7dd10'|
Information.FullName='chocolatey, Version=0.12.0.0, Culture=neutral, PublicKeyToken=fd112f53c3ab578c'|

Information.Is64BitOperatingSystem='True'|
Information.Is64BitProcess='True'|Information.IsInteractive='False'|
Information.UserName='REDACTED'|Information.UserDomainName='REDACTED'|
Information.IsUserAdministrator='False'|
Information.IsUserSystemAccount='False'|
Information.IsUserRemoteDesktop='False'|
Information.IsUserRemote='True'|
Information.IsProcessElevated='False'|
Information.IsLicensedVersion='False'|Information.LicenseType='Foss'|
Information.CurrentDirectory='/path/no-files-zfsin'|

Features.AutoUninstaller='True'|Features.ChecksumFiles='True'|
Features.AllowEmptyChecksums='False'|
Features.AllowEmptyChecksumsSecure='True'|
Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.LogWithoutColor='False'|
Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
Features.UsePackageExitCodes='True'|
Features.UseEnhancedExitCodes='False'|
Features.UseFipsCompliantChecksums='False'|
Features.ShowNonElevatedWarnings='True'|
Features.ShowDownloadProgress='True'|
Features.StopOnFirstPackageFailure='False'|
Features.UseRememberedArgumentsForUpgrades='False'|
Features.IgnoreUnfoundPackagesOnUpgradeOutdated='False'|
Features.SkipPackageUpgradesWhenNotInstalled='False'|
Features.RemovePackageInformationOnUninstall='False'|
Features.ExitOnRebootDetected='False'|
Features.LogValidationResultsOnWarnings='True'|
Features.UsePackageRepositoryOptimizations='True'|
Features.ScriptsCheckLastExitCode='False'|
ListCommand.LocalOnly='False'|
ListCommand.IdOnly='False'|ListCommand.IncludeRegistryPrograms='False'|
ListCommand.PageSize='25'|ListCommand.Exact='False'|
ListCommand.ByIdOnly='False'|ListCommand.ByTagOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|
ListCommand.IncludeVersionOverrides='False'|
UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
UpgradeCommand.ExcludePrerelease='False'|
NewCommand.AutomaticPackage='False'|
NewCommand.UseOriginalTemplate='False'|SourceCommand.Command='unknown'|
SourceCommand.Priority='0'|SourceCommand.BypassProxy='False'|
SourceCommand.AllowSelfService='False'|
SourceCommand.VisibleToAdminsOnly='False'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
ApiKeyCommand.Remove='False'|PinCommand.Command='unknown'|
OutdatedCommand.IgnorePinned='False'|
ExportCommand.IncludeVersionNumbers='False'|Proxy.BypassOnLocal='True'|

Chocolatey is not an official build (bypassed with --allow-unofficial).
 If you are seeing this message and it is not expected, your system may
 now be in a bad state. Only official builds are to be trusted.

_ Chocolatey:ChocolateyPackCommand - Normal Run Mode _
Attempting to build package from 'zfsin.nuspec'.
zfsin.nuspec
Attempting to delete file "/path/no-files-zfsin/zfsin.0.24-eljun.nupkg".
Sending message 'PostRunMessage' out if there are subscribers...
Not able to cleanup NuGet temp folders. Failure was Path to combine cannot be empty. Tried to combine null with ''. Method called from 'delete_directory'
Chocolatey had an error occur:
System.InvalidOperationException: This partUri is already contained in the package
  at System.IO.Packaging.Package.CreatePart (System.Uri partUri, System.String contentType, System.IO.Packaging.CompressionOption compressionOption) [0x0001b] in <8f8261ee75c34c9cb0a71d0993973faa>:0
  at NuGet.PackageBuilder.CreatePart (System.IO.Packaging.Package package, System.String path, System.IO.Stream sourceStream) [0x0001e] in <0446c6bfcd824d528312261f49bc47fe>:0
  at NuGet.PackageBuilder.WriteFiles (System.IO.Packaging.Package package) [0x00043] in <0446c6bfcd824d528312261f49bc47fe>:0
  at NuGet.PackageBuilder.Save (System.IO.Stream stream) [0x000ca] in <0446c6bfcd824d528312261f49bc47fe>:0
  at chocolatey.infrastructure.app.nuget.NugetPack.BuildPackage (NuGet.PackageBuilder builder, chocolatey.infrastructure.filesystem.IFileSystem fileSystem, System.String outputPath) [0x00056] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.infrastructure.app.services.NugetService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x001fb] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.infrastructure.app.services.ChocolateyPackageService.pack_run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config) [0x00020] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.infrastructure.app.commands.ChocolateyPackCommand.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration configuration) [0x00000] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.infrastructure.app.runners.GenericRunner.run (chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container, System.Boolean isConsole, System.Action`1[T] parseArgs) [0x000e4] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.infrastructure.app.runners.ConsoleApplication.run (System.String[] args, chocolatey.infrastructure.app.configuration.ChocolateyConfiguration config, SimpleInjector.Container container) [0x000d6] in <845de20ca2654563911ec50dad3fc2b7>:0
  at chocolatey.console.Program.Main (System.String[] args) [0x0036a] in <a6fa8517b92d4fc18e56c6cf1219f2c9>:0
Exiting with 1

@TheCakeIsNaOH TheCakeIsNaOH changed the title Building package on Linux fails if nuspec does not have <files>element. Building package on Linux fails if nuspec does not have files element. Sep 27, 2021
TheCakeIsNaOH added a commit to TheCakeIsNaOH/choco that referenced this issue Sep 27, 2021
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]>
@gep13 gep13 added this to the 0.12.0 milestone Sep 27, 2021
gep13 added a commit that referenced this issue Sep 27, 2021
(#2379) Correct pack files filter for Linux
@gep13 gep13 added 4 - Done and removed 3 - Review labels Sep 27, 2021
@gep13 gep13 changed the title Building package on Linux fails if nuspec does not have files element. Building package on Linux fails if nuspec does not have files element Jan 17, 2022
@pauby pauby changed the title Building package on Linux fails if nuspec does not have files element Building a package on Linux fails if nuspec does not have files element Jan 17, 2022
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