Choco: `choco new` cannot introduce multistage folder hierarchy template

Created on 23 Apr 2016  路  2Comments  路  Source: chocolatey/choco

What You Are Seeing?

In Chocolatey v0.9.10-beta1-289-g589515c, when I used the template package that contains multistage folder hierarchy, I got the following error message:
untitled

What is Expected?

No error will occur, and all template-based files can be created.

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

The followings are the minimal reproducing sample:
Hoge.zip
hoge.template.0.0.0.nupkg.zip

  1. Extract hoge.template.0.0.0.nupkg.zip.
  2. Go to extracted folder, then install hoge.template with the command cinst hoge.template -s "$pwd".
  3. Create new package using the template with the command choco new Fuga -t Hoge.
    =>The above error will occur.

Output Log

PS Fuga> choco new Fuga -t Hoge --debug --verbose
Chocolatey v0.9.10-beta1-289-g589515c
Chocolatey is running on Windows v 10.0.10586.0
Attempting to delete file "C:/ProgramData/chocolatey/choco.exe.old".
Attempting to delete file "C:\ProgramData\chocolatey\choco.exe.old".
Command line: "C:\ProgramData\chocolatey\choco.exe" new Fuga -t Hoge --debug --verbose
Received arguments: new Fuga -t Hoge --debug --verbose
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='new'|
CacheLocation='C:\Users\urasa\AppData\Local\Temp\chocolatey'|
ContainsLegacyPackageInstalls='True'|
CommandExecutionTimeoutSeconds='2700'|
Sources='https://chocolatey.org/api/v2/'|SourceType='normal'|
Debug='True'|Verbose='True'|Force='False'|Noop='False'|
HelpRequested='False'|RegularOutput='True'|QuietOutput='False'|
PromptForConfirmation='True'|AcceptLicense='False'|
AllowUnofficialBuild='False'|Input='Fuga'|AllVersions='False'|
SkipPackageInstallProvider='False'|Prerelease='False'|ForceX86='False'|
OverrideArguments='False'|NotSilent='False'|IgnoreDependencies='False'|
AllowMultipleVersions='False'|AllowDowngrade='False'|
ForceDependencies='False'|Information.PlatformType='Windows'|
Information.PlatformVersion='10.0.10586.0'|
Information.PlatformName='Windows'|
Information.ChocolateyVersion='0.9.10.0'|
Information.ChocolateyProductVersion='0.9.10-beta1-289-g589515c'|
Information.FullName='choco, Version=0.9.10.0, Culture=neutral, PublicKeyToken=79d02ea9cad655eb'|

Information.Is64Bit='True'|Information.IsInteractive='True'|
Information.IsUserAdministrator='True'|
Information.IsProcessElevated='True'|
Information.IsLicensedVersion='False'|Features.AutoUninstaller='True'|
Features.CheckSumFiles='True'|Features.FailOnAutoUninstaller='False'|
Features.FailOnStandardError='False'|Features.UsePowerShellHost='True'|
Features.LogEnvironmentValues='False'|Features.VirusCheck='False'|
Features.FailOnInvalidOrMissingLicense='False'|
Features.IgnoreInvalidOptionsSwitches='True'|
ListCommand.LocalOnly='False'|
ListCommand.IncludeRegistryPrograms='False'|ListCommand.PageSize='25'|
ListCommand.Exact='False'|ListCommand.ByIdOnly='False'|
ListCommand.IdStartsWith='False'|ListCommand.OrderByPopularity='False'|
ListCommand.ApprovedOnly='False'|
ListCommand.DownloadCacheAvailable='False'|
ListCommand.NotBroken='False'|UpgradeCommand.FailOnUnfound='False'|
UpgradeCommand.FailOnNotInstalled='False'|
UpgradeCommand.NotifyOnlyAvailableUpgrades='False'|
NewCommand.TemplateName='Hoge'|NewCommand.Name='Fuga'|
NewCommand.AutomaticPackage='False'|
NewCommand.TemplateProperties.PackageName='Fuga'|
SourceCommand.Command='unknown'|SourceCommand.Priority='0'|
FeatureCommand.Command='unknown'|ConfigCommand.Command='unknown'|
PushCommand.TimeoutInSeconds='0'|PinCommand.Command='unknown'|
_ Chocolatey:ChocolateyNewCommand - Normal Run Mode _
Creating a new package specification at C:\Users\urasa\Fuga\Fuga
Attempting to create directory "C:\Users\urasa\Fuga\Fuga".
Attempting to create directory "C:\Users\urasa\Fuga\Fuga\tools".
Set token for 'PackageName' to 'Fuga'
Token Values after merge:
 PackageName=Fuga
 PackageNameLower=fuga
 PackageVersion=__REPLACE__
 MaintainerName=__REPLACE_YOUR_NAME__
 MaintainerRepo=__REPLACE_YOUR_REPO__
 AutomaticPackageNotesInstaller=
 AutomaticPackageNotesNuspec=
 InstallerType=EXE_MSI_OR_MSU
 Url=
 Url64=
 SilentArgs=/qn /norestart /l*v `"$env:TEMP\chocolatey\$($packageName)\$($packageName).MsiInstall.log`"
 Checksum=
 ChecksumType=md5
 Checksum64=
 ChecksumType64=md5
 AdditionalProperties=System.Collections.Generic.Dictionary`2[System.String,System.String]
Generating package from custom template at 'C:\ProgramData\chocolatey\templates\Hoge'.
Generating template to a file
 at 'C:\Users\urasa\Fuga\Fuga\a\b\SampleScript.ps1'
'This is a sample script.'

This is try 1/3. Retrying after 300 milliseconds.
 Error converted to warning:
 System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\urasa\Fuga\Fuga\a\b\SampleScript.ps1'
.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShar
e share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass25.<write_file>b__24()
   at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0()
   at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurati
onMilliseconds, Int32 increaseRetryByMilliseconds)
This is try 2/3. Retrying after 400 milliseconds.
 Error converted to warning:
 System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\urasa\Fuga\Fuga\a\b\SampleScript.ps1'
.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShar
e share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass25.<write_file>b__24()
   at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0()
   at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurati
onMilliseconds, Int32 increaseRetryByMilliseconds)
Maximum tries of 3 reached. Throwing error.
Chocolatey had an error occur:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\urasa\Fuga\Fuga\a\b\SampleScript.ps1'.

   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShar
e share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolea
n useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.<>c__DisplayClass25.<write_file>b__24()
   at chocolatey.infrastructure.tolerance.FaultTolerance.<>c__DisplayClass1.<retry>b__0()
   at chocolatey.infrastructure.tolerance.FaultTolerance.retry[T](Int32 numberOfTries, Func`1 function, Int32 waitDurati
onMilliseconds, Int32 increaseRetryByMilliseconds)
   at chocolatey.infrastructure.filesystem.DotNetFileSystem.write_file(String filePath, String fileText, Encoding encodi
ng)
   at chocolatey.infrastructure.app.services.TemplateService.generate(ChocolateyConfiguration configuration)
   at chocolatey.infrastructure.app.runners.GenericRunner.run(ChocolateyConfiguration config, Container container, Boole
an isConsole, Action`1 parseArgs)
   at chocolatey.infrastructure.app.runners.ConsoleApplication.run(String[] args, ChocolateyConfiguration config, Contai
ner container)
   at chocolatey.console.Program.Main(String[] args)
Exiting with 1
PS Fuga>
3 - Done Bug

Most helpful comment

Thanks for logging that!

All 2 comments

Thanks for logging that!

This will be in the next beta after 0.9.10-beta-20160528 and then in 0.9.10.

Was this page helpful?
0 / 5 - 0 ratings