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

choco new cannot introduce multistage folder hierarchy template #706

Closed
urasandesu opened this issue Apr 23, 2016 · 2 comments
Closed

choco new cannot introduce multistage folder hierarchy template #706

urasandesu opened this issue Apr 23, 2016 · 2 comments
Assignees
Milestone

Comments

@urasandesu
Copy link

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>
@ferventcoder ferventcoder added this to the 0.9.10 milestone Apr 24, 2016
@ferventcoder ferventcoder self-assigned this Apr 24, 2016
@ferventcoder
Copy link
Member

Thanks for logging that!

@ferventcoder
Copy link
Member

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

ferventcoder added a commit that referenced this issue May 28, 2016
Previously, if there were nesting depth of folders, choco new would
have issues with it. This was due to not creating the folder structure
prior to attempting write the files. Instead, ensure the the folder
structure exists prior to attempting to create the files.
ferventcoder added a commit that referenced this issue May 28, 2016
* stable:
  (GH-198) Remove existing pending packages
  (GH-198) Send pre/post run messages
  (GH-198) Manage tasks
  (GH-198) Set and remove a pending file
  (GH-198) Add ITask - rename existing messages
  (GH-515) runtime switches for autouninstaller
  (GH-706) New handles folder depth appropriately
  (GH-737) Use built-in template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants