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

Offer to remove actual package (*.install/*.portable) when removing meta/virtual package #735

Closed
ferventcoder opened this issue May 14, 2016 · 4 comments
Assignees
Milestone

Comments

@ferventcoder
Copy link
Member

ferventcoder commented May 14, 2016

This is nearly the same as @dtgm does in his packages:

# powershell v2 compatibility
$psVer = $PSVersionTable.PSVersion.Major
if ($psver -ge 3) {
  function Get-ChildItemDir {Get-ChildItem -Directory $args}
} else {
  function Get-ChildItemDir {Get-ChildItem $args}
}
# MetaPackage
$warningPreference = "Continue"
$chocoLib = Join-Path $env:ChocolateyInstall "lib"
if (Test-Path -PathType Container (Join-Path $chocoLib 'systemninja.*')) {
  Write-Warning "Uninstall NOT complete."
  Write-Host
@"
  This package is a metapackage; a chocolatey feature not yet fully implemented.
  To retain future compatibility this package does not uninstall the dependent
  package it points to as designated with *.install or *.portable.`n
"@
  Write-Warning "To finish removing the program installed by package systemninja, please also run the command:"
  $text += " `n`tchoco uninstall "
  $list = (Get-ChildItemDir $chocoLib\systemninja.*).Name
  foreach ($i in $list) {
    $text += "$i "
  }
  $text += "-y`n"
  Write-Host $text
}

The message we would add is the following:

WARNING: Uninstall NOT complete. You have removed a metapackage that 
 has a *.install/*.portable that it installed (this package represents 
 discoverability).

Would you like to uninstall ____ package as well? ([Y]es/[N]o) 

The prompt would timeout after 30 seconds with a default value of no. If no, provide the following text:

WARNING: To finish removing ___, please also run the command: `choco uninstall _____`
@ferventcoder
Copy link
Member Author

@dtgm - by the way, meta packages are fully implemented and have been since day 1 of NuGet. It's virtual packages that are not fully implemented.

@dtgm
Copy link
Contributor

dtgm commented May 14, 2016

You're right, when I stated This package is a metapackage; a chocolatey feature not yet fully implemented. I was thinking in my head the unique use case of metapackages that are to designate install type by install/portable which is why I like your message better because it highlights that differentiation, You have removed a metapackage that has a *.install/*.portable that it installed

It is also important to have this message since trying to uninstall the foo.install first says you actually, you have to uninstall foo and I don't think it is clear to the user they have to uninstall both packages separately, and in the correct order.

cinst rufus -y
which installs rufus.install as a dependency

cuninst rufus.install -y
Uninstalling the following packages:
rufus.install
rufus.install not uninstalled. An error occurred during uninstall:
 Unable to uninstall 'rufus.install 2.8' because 'rufus 2.8' depends on it.

Chocolatey uninstalled 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures
 - rufus.install

and then cuninst rufus -y is silent about the status of the actual package that uninstalls the program which brings us to the problem being addressed in this issue.

@ferventcoder
Copy link
Member Author

Looks pretty good. Also puts out the first warning message with ANY install, upgrade or uninstall for packages that are in warning.

@ferventcoder
Copy link
Member Author

ferventcoder commented May 30, 2016

This is related to #455.

@ferventcoder ferventcoder changed the title When removing meta/virtual, if a .install or .portable is also found, report how to remove When removing meta/virtual offer to remove the .install / .portable May 30, 2016
@ferventcoder ferventcoder changed the title When removing meta/virtual offer to remove the .install / .portable Offer to remove actual package (*.install/*.portable) when removing meta/virtual package May 30, 2016
ferventcoder added a commit that referenced this issue May 30, 2016
Split getting the package list from setting "all" items, such as
upgrade all. This allows querying the list in other operations.
ferventcoder added a commit that referenced this issue May 30, 2016
When uninstalling a meta package, a user may not realize they need to
uninstall the actual package as well, such as a *.portable or *.intall.
For instance, if a user uninstalls git package, they may not realize
they have only removed the meta package and git.install and
subsequently, Git for Windows are still installed. Provide a warning
with a timeout offering to add the actual package to the list. If there
is no response or the answer is no, add the actual package to the list
of warnings for the package summary with an explanation on how to
uninstall that package.
ferventcoder added a commit that referenced this issue May 30, 2016
* stable:
  (doc) update CHANGELOG/nuspec
  (maint) formatting
  (GH-735) Remove actual when uninstalling meta
  (GH-455) Summary - log reason for warnings/errors
  (GH-735) split package list from all operation
  (GH-710) If timeout, inform user
  (maint) add review note
  (GH-689) Report install location
  (GH-755) Track more MSI information
  (maint) Template specs - restrict to Windows only
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