choco icon indicating copy to clipboard operation
choco copied to clipboard

Major+Minor Package Version Resolution

Open kbrowns opened this issue 10 years ago • 7 comments

We're making heavy use of chocolatey with Artifactory as the backend package store and it's working swimmingly. We have one scenario that I've yet to figure out to my liking. I suspect this is a nuget protocol limitation, but thought I'd start my search here first. When I do this:

choco install -y foo

I get the latest version (16.2.0.100) pulled down and installed. Wonderful - Build 100 is the last build of our 16.2 release which is our greatest release. When I do this:

choco install -y foo --version 16.1

It fails - as expected (because there is no version 16.1.0.0 of foo). Is there some mechanism I can use to ask for the great version of a package within a major/minor?

kbrowns avatar Apr 11 '16 19:04 kbrowns

@kbrowns right now, this would be a feature request.

ferventcoder avatar Apr 11 '16 21:04 ferventcoder

Related to #800 and #1278

ferventcoder avatar Jun 26 '17 16:06 ferventcoder

related to #1874

ferventcoder avatar Jul 11 '19 19:07 ferventcoder

I know it is not very helpful to add comments to issue trackers when you are annoyed, but ...

OK, so the purpose of Choclately is to make it easy for users to managed the software packages installed on their computer. So far, so awesome.

But, what I want to do right now, which should be easy, is Install the latest PHP 8.1". I have read this, and the related issue, and it is not easy.

I think what I need to do is:

  1. choco search --exact --all php - to find the latest version of PHP.
  2. Then the relevant choco upgrade command.

Point 1: It would be nice if the choco upgrade and choco install documenatation page told you that command to find the available versions. I mean, I can spend 10 minutes search stackoverflow and going round in circles to find that, but it would be better user experience if I did not have to.

Point 2: When I run that, it lissts 210 PHP versions going back to 5.3.6, but not including anything more recent than 8.0.17, so that does not help. In contrast, choco search php lists PHP 8.2.6. What?!

Point 3: `choco search' not helpful at all, nor goole searching for the answer. (Removing the --exact option stops it listing any PHP versions. What?!)

Point 4: Is it really helpful that every page of the chocolatey docs with starts with over a screenful of stuff I don't care about relating to deprectation?

OK, I give up https://community.chocolatey.org/packages/php#versionhistory. At least that exists.

Hopefullly there is some useful feedback burried in there.

timhunt avatar May 10 '23 16:05 timhunt

@timhunt Sorry you're having a tough time.

Point 1: It would be nice if the choco upgrade and choco install documenatation page

Without sounding flippant, that's not the goal of those pages. They are to describe upgrade and install functionality.

Point 2: When I run that, it lissts 210 PHP versions going back to 5.3.6, but not including anything more recent than 8.0.17, so that does not help. In contrast, choco search php lists PHP 8.2.6. What?!

I ran choco search --exact --all php and 254 packages were returned, with the latest being 8.2.6:

image

You may have hit a caching issue if you didn't get that.

Point 3: `choco search' not helpful at all, nor goole searching for the answer. (Removing the --exact option stops it listing any PHP versions. What?!)

choco search php returned 48 packages for me.

Point 4: Is it really helpful that every page of the chocolatey docs with starts with over a screenful of stuff I don't care about relating to deprectation?

Without being flippant (again) we wouldn't add it if we didn't think it is helpful. This potentially breaks things for some people, and while I appreciate it won't for you, it may for others. We want to make sure those people are as informed as they can be about this stuff. That's why we have put it on plenty of pages.

Once the deprecation is old news, we'll remove it.

pauby avatar May 10 '23 16:05 pauby

Thanks for the speedy respnse.

I agree that it is not the purpose of the upgrade docs to describe choco search. However, it is the purpose of that page to describe the use of the --version option, and telling you how to find the version number you need would be valuable docs (even if it just says "You can find the avilable versions of a package using choco search, for example choco search --exact --all ." I mean, at the moment, there are more verbose about hundreds of other options, like checksumtypex64, and hardly anything about this vital option that is essential to the use of this commant.

Telling me I have "hit a caching issue" without telling me what to do about it is unhelpful. Can you suggestion something actionable? Thanks.

timhunt avatar May 10 '23 17:05 timhunt

@timhunt I know I am a tad late on a response but figured I'd point out the workaround I posted here https://github.com/chocolatey/choco/issues/800#issuecomment-2726947131

choco find -e -r -a php

  • -e exact match of name
  • -r machine readable output
  • -a all versions
php|8.4.4
php|8.4.3
php|8.4.2
php|8.4.1
php|8.3.19
php|8.3.18
php|8.3.17
php|8.3.16
php|8.3.15
php|8.3.14
php|8.3.13
php|8.3.12
php|8.3.11
php|8.3.10
php|8.3.9
php|8.3.8
php|8.3.7
php|8.3.6
php|8.3.4
php|8.3.3
php|8.3.2
php|8.3.1
php|8.3.0
php|8.2.28
php|8.2.27
php|8.2.26
php|8.2.25
php|8.2.24
php|8.2.23
php|8.2.22
php|8.2.21
php|8.2.20
php|8.2.19
php|8.2.18
php|8.2.17
php|8.2.16
php|8.2.15
php|8.2.14
php|8.2.13
php|8.2.12
php|8.2.11
php|8.2.10
php|8.2.9
php|8.2.8
php|8.2.7
php|8.2.6
php|8.2.5
php|8.2.4
php|8.2.3
php|8.2.2
php|8.2.1
php|8.2.0
php|8.1.32
php|8.1.31
php|8.1.30
php|8.1.29
php|8.1.28
php|8.1.27
php|8.1.26
php|8.1.25
php|8.1.24
php|8.1.23
php|8.1.22
php|8.1.21
php|8.1.20
php|8.1.19
php|8.1.18
php|8.1.17
php|8.1.16
php|8.1.15
php|8.1.14
php|8.1.13
php|8.1.12
php|8.1.11
php|8.1.10
php|8.1.9
php|8.1.8
php|8.1.7
php|8.1.6
php|8.1.5
php|8.1.4
php|8.1.3
php|8.1.2
php|8.1.1
php|8.0.30
php|8.0.29
php|8.0.28
php|8.0.27
php|8.0.26
php|8.0.25
php|8.0.24
php|8.0.23
php|8.0.22
php|8.0.21
php|8.0.20
php|8.0.19
php|8.0.18
php|8.0.17
php|8.0.16
php|8.0.15
php|8.0.14
php|8.0.10
php|8.0.9
php|8.0.8
php|8.0.7
php|8.0.6
php|8.0.5
php|8.0.3
php|8.0.2
php|8.0.1
php|8.0.0.20201221
php|8.0.0
php|7.4.33
php|7.4.32
php|7.4.30
php|7.4.29
php|7.4.28
php|7.4.27
php|7.4.23
php|7.4.22
php|7.4.21
php|7.4.20
php|7.4.19
php|7.4.18
php|7.4.16
php|7.4.14
php|7.4.13
php|7.4.11
php|7.4.9
php|7.4.7
php|7.4.6
php|7.4.5
php|7.4.3
php|7.4.2
php|7.4.1
php|7.4.0
php|7.3.30
php|7.3.29
php|7.3.28
php|7.3.26
php|7.3.25
php|7.3.24
php|7.3.23
php|7.3.22
php|7.3.21
php|7.3.20
php|7.3.19
php|7.3.18
php|7.3.17
php|7.3.15
php|7.3.14
php|7.3.13
php|7.3.12
php|7.3.11
php|7.3.10
php|7.3.9
php|7.3.8
php|7.3.7
php|7.3.6
php|7.3.5
php|7.3.4
php|7.3.3
php|7.3.1
php|7.3.0
php|7.2.34
php|7.2.33
php|7.2.32
php|7.2.31
php|7.2.30
php|7.2.29
php|7.2.28
php|7.2.27
php|7.2.26
php|7.2.25
php|7.2.24
php|7.2.23
php|7.2.22
php|7.2.20
php|7.2.19
php|7.2.18
php|7.2.17
php|7.2.15
php|7.2.14
php|7.2.13
php|7.2.12
php|7.2.10
php|7.2.9
php|7.2.8
php|7.2.7
php|7.2.5
php|7.2.4
php|7.2.3
php|7.2.2
php|7.2.1
php|7.2.0
php|7.1.33
php|7.1.32
php|7.1.31
php|7.1.30
php|7.1.29
php|7.1.28
php|7.1.27
php|7.1.26
php|7.1.25
php|7.1.24
php|7.1.22
php|7.1.21
php|7.1.20
php|7.1.19
php|7.1.18
php|7.1.17
php|7.1.16
php|7.1.15
php|7.1.14
php|7.1.13
php|7.1.12
php|7.1.11
php|7.1.10
php|7.1.8
php|7.1.7
php|7.1.6
php|7.1.5
php|7.1.4
php|7.1.3
php|7.1.2
php|7.1.1.20170212
php|7.1.1
php|7.1.0
php|7.0.33
php|7.0.32
php|7.0.31
php|7.0.30
php|7.0.28
php|7.0.27
php|7.0.26
php|7.0.25
php|7.0.24
php|7.0.23
php|7.0.22
php|7.0.21
php|7.0.20
php|7.0.19
php|7.0.18
php|7.0.17
php|7.0.16
php|7.0.15
php|7.0.13
php|7.0.9
php|7.0.8
php|7.0.7
php|7.0.6
php|7.0.5
php|7.0.4
php|7.0.3
php|7.0.2
php|7.0.1
php|5.6.40
php|5.6.39
php|5.6.38
php|5.6.37
php|5.6.36
php|5.6.35
php|5.6.34
php|5.6.33
php|5.6.32
php|5.6.31
php|5.6.30
php|5.6.17
php|5.6.16
php|5.6.15
php|5.6.14
php|5.6.13
php|5.6.12
php|5.6.11
php|5.6.10
php|5.6.9
php|5.6.8
php|5.6.7
php|5.6.6
php|5.6.5
php|5.6.4
php|5.6.3
php|5.6.2
php|5.6.1
php|5.6.0
php|5.5.38
php|5.5.16
php|5.5.15
php|5.5.14
php|5.5.13
php|5.5.12
php|5.5.11
php|5.4.45
php|5.3.29
php|5.3.28
php|5.3.27
php|5.3.26
php|5.3.25
php|5.3.24
php|5.3.23
php|5.3.22
php|5.3.21
php|5.3.20
php|5.3.19
php|5.3.18
php|5.3.17
php|5.3.16
php|5.3.15
php|5.3.14
php|5.3.10
php|5.3.9
php|5.3.6.2
php|5.3.6.1
php|5.3.6
function Get-LatestChocoPackageVersion {
  param (
    [string]$PackageName,
    [int]$MajorVersion,
    [int]$MinorVersion = -1
  )

  $versions = choco find -e -r -a $PackageName | Select-String -Pattern "$PackageName"
  $latestVersion = $null

  foreach ($version in $versions) {
    $versionNumber = [version]($version -split '\|' | Select-Object -Last 1)
    if ($versionNumber.Major -eq $MajorVersion) {
      if ($MinorVersion -ne -1 -and $versionNumber.Minor -ne $MinorVersion) {
        continue
      }
      if ($null -eq $latestVersion -or $versionNumber -gt $latestVersion) {
        $latestVersion = $versionNumber
      }
    }
  }

  return $latestVersion
}

Get-LatestChocoPackageVersion -MajorVersion 8 -MinorVersion 1 -PackageName php

vbjay avatar Mar 15 '25 20:03 vbjay

I am going to close this as a duplicate of #800. If we implement this, it would be in the way asked for in #800 as it covers more use cases. That issue also has more votes (53 currently) than this (17 currently).

pauby avatar Aug 17 '25 14:08 pauby