Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Implement -old flag for dep status #1383

Closed
darkowlzz opened this issue Nov 16, 2017 · 8 comments · Fixed by #1553
Closed

Implement -old flag for dep status #1383

darkowlzz opened this issue Nov 16, 2017 · 8 comments · Fixed by #1553

Comments

@darkowlzz
Copy link
Collaborator

darkowlzz commented Nov 16, 2017

dep status -old should list the dependencies that are out-of-date.

Refer: command spec

Example code: #613

@al3rez
Copy link

al3rez commented Nov 17, 2017

Would you add more detail? @darkowlzz

@darkowlzz
Copy link
Collaborator Author

@azbshiri yes, so dep status shows status of all the project dependencies (direct and transitive) and it also shows the latest revision of those dependencies allowed by their constraints. When REVISION and LATEST are not the same, it means there's a newer version available for the dependency project. But that's kinda information overload.

With -old flag, we would like to filter out only the projects that have a newer version available allowed by the set constraints, if any. For a branch constraint, it would mean a new revision on the same branch. For a semver constraint, it would mean a new semver release within the constrained semver.

The result should be in table format as well as in json format, compatible with -json flag.

There are some examples of how the output should look like at the bottom of the command spec doc. Have a look.

Also, you can refer to runUpdate() in ensure, which updates a project by performing a gps solve and writes to file. In this case, we just need the update info. So you can skip the writing part.

And ignore the algorithm in #613 for checking update. That's an old implementation and I see it tries to fetch update without a gps solve, that could lead to incorrect/incompatible suggestions. Use the runUpdate() approach in ensure.go.

Hope this helps 😊

@al3rez
Copy link

al3rez commented Nov 24, 2017

@darkowlzz Hey, I'm working on this. But I have problem with the solver after preparation how can I identify which dependency is out of sync? is this has something to do with Lock.InputsDigest or solver.HashInputs?

@darkowlzz
Copy link
Collaborator Author

@azbshiri great! you can submit a WIP PR and show us your progress :)

But I have problem with the solver after preparation how can I identify which dependency is out of sync? is this has something to do with Lock.InputsDigest or solver.HashInputs?

So, once you have prepared a solver, solve it (solver.Solve()) and obtain a solution. From solution, you can obtain all the projects using solution.Projects(). And from the array of projects, you compare them with the existing locked set of projects we already have. Since a solve sorts and picks the latest version of the projects under the set constraint, just checking if the underlying revisions of project version are different should be enough. Use gps.VersionComponentStrings(project.Version()) to obtain the underlying revision of a project.

@al3rez
Copy link

al3rez commented Nov 25, 2017

For sure. But it was not in a state that could be a PR. Thank you so much for the info.

@al3rez
Copy link

al3rez commented Nov 28, 2017

What should prepare for output? I mean ctx.Out.Println("print some text to stdout")
@darkowlzz

@darkowlzz
Copy link
Collaborator Author

According to the spec doc it should look like this:

$ dep status -old
PROJECT                CONSTRAINT        REVISION    LATEST
github.com/golang/lint branch master     cd8b52f     3084677
github.com/foo/bar     ^0.8.0            836a144     645ef00

@darkowlzz
Copy link
Collaborator Author

And that would require creating a new struct OldStatus similar to MissingStatus and BasicStatus and then some outputter methods for printing header, line and footer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants