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

package version checks should allow ranges (Feature request) #435

Closed
sshipway opened this issue Apr 8, 2019 · 10 comments
Closed

package version checks should allow ranges (Feature request) #435

sshipway opened this issue Apr 8, 2019 · 10 comments
Labels
migrate Ticket marked for re-write into new format stale Used by https://probot.github.io/apps/stale/

Comments

@sshipway
Copy link
Contributor

sshipway commented Apr 8, 2019

When specifying a required package version, it should be possible to use ranges (> or < ). This would allow a test for 'at least this version' (to avoid a known bug) or 'no later than this version' (to avoid incompatibilities). Ideally, the syntax could also allow 'or not installed' as an extension to this.

May be related to #355

@aelsabbahy
Copy link
Member

It's somewhat related to #355, semver is a check I would like to add as an advanced macher

However, each package manager uses its own way to compare versions, so that may or may not be helpful depending on the package manager and it's comparison rules.

For example RPM uses the following logic to compare versions:
https://blog.jasonantman.com/2014/07/how-yum-and-rpm-compare-versions/

@thatsk
Copy link

thatsk commented Apr 30, 2019

for Rpm based:-
you should be do
cmd := util.NewCommand("rpm", "-q", "--nosignature", "--nohdrchk", "--nodigest", "--qf", "%{VERSION}-%{RELEASE}.%{ARCH}\n", p.name)

@pedroMMM
Copy link
Contributor

pedroMMM commented Dec 2, 2019

@aelsabbahy #508 should take care of this.

Simple check x > 4.0.0:

package:
  kernel:
    installed: true
    versions:
      version-gt: "4.0.0"

Range check 5.0.0 < x > 4.0.0:

package:
  kernel:
    installed: true
    versions:
      and:
      - version-gt: 4.0.0
      - version-lt: 5.0.0

@aelsabbahy
Copy link
Member

Just to clarify, @pedroMMM PR is a great addition for a semver matcher. I'm looking forward to that PR as it will allow goss with minor changes to support semver matching for command/http/file resources.

However, this does not solve package versioning/ranges, a quick test on the debian test image fails to parse for ~7-8% of the installed packages.

Also, rpm does not adhere to semantic versioning, for example.. but goss currently only checks '%{Version}' and not release, so may be a moot point for now.. Although, they may have to be added back in to do proper version comparisons in the future.

Here's an example where semver and rpm do different things:
https://semver.org/#spec-item-11

Example: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

# rpmdev-vercmp '1.0.0-rc.1' '1.0.0'
1.0.0-rc.1 > 1.0.0

I haven't done a deep enough dive with debian (beyond parsing errors) to see how deb package versions differ from semver.

@aelsabbahy
Copy link
Member

@sshipway yesterdays release contains a semver Matcher.

Which package type where you testing with?

@sshipway
Copy link
Contributor Author

We have Centos/Redhat systems, so RPMs, though I tend to develop on an ubuntu system.

@stale
Copy link

stale bot commented Jul 9, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 9, 2020
@aelsabbahy
Copy link
Member

Tracked in one ticket: #334

@aelsabbahy aelsabbahy added the stale Used by https://probot.github.io/apps/stale/ label Jul 16, 2020
@aelsabbahy
Copy link
Member

I was mistaken, this is different from #334

@aelsabbahy aelsabbahy reopened this Jul 17, 2020
@stale stale bot removed the stale Used by https://probot.github.io/apps/stale/ label Jul 17, 2020
@stale
Copy link

stale bot commented Sep 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Used by https://probot.github.io/apps/stale/ label Sep 15, 2020
@stale stale bot closed this as completed Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migrate Ticket marked for re-write into new format stale Used by https://probot.github.io/apps/stale/
Projects
None yet
Development

No branches or pull requests

4 participants