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

New 'cabal-install' command: 'outdated' #4207

Merged
merged 16 commits into from Jan 20, 2017

Conversation

Projects
None yet
5 participants
@23Skidoo
Copy link
Member

23Skidoo commented Jan 5, 2017

Fixes #2139.

WIP (so don't merge), items still left to implement:

  • docs
  • tests
  • changelog note
@mention-bot

This comment has been minimized.

Copy link

mention-bot commented Jan 5, 2017

@23Skidoo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @benarmston, @dcoutts and @edsko to be potential reviewers.

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch from 7f27632 to f2296b2 Jan 5, 2017

@ezyang

This comment has been minimized.

Copy link
Contributor

ezyang commented Jan 6, 2017

Does this work with new-build freeze files?


-- | Find all outdated dependencies.
listOutdated :: [Dependency] -> PackageIndex UnresolvedSourcePackage
-> S.Set PackageName -> S.Set PackageName

This comment has been minimized.

@ezyang

ezyang Jan 6, 2017

Contributor

What do these two sets do.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 6, 2017

Member

A set of packages to ignore and a set of packages for which major version bumps should be ignored.

path <- tryFindPackageDesc cwd
gpd <- readPackageDescription verbosity path
let cinfo = compilerInfo comp
epd = finalizePD [] defaultComponentRequestedSpec

This comment has been minimized.

@ezyang

ezyang Jan 6, 2017

Contributor

Use of defaultComponentRequestedSpec means that you will never check bounds on tests and benchmarks.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 13, 2017

Member

Changed to ComponentRequestedSpec True True.

then exitFailure
else return ()

-- | Read the list of dependencies from the freeze file.

This comment has been minimized.

@ezyang

ezyang Jan 6, 2017

Contributor

So, I'm wondering, what if a hard-coded dep in the freeze file is out of date, but actually it's the latest version of the package which actually has a consistent build plan. Will we report outdated in this case?

This comment has been minimized.

@23Skidoo

23Skidoo Jan 6, 2017

Member

Yes, as you can see this code doesn't run the solver so it has no way of seeing that. This is a potential future improvement.

userConfig <- loadUserConfig verbosity cwd Nothing
let ucnstrs = map fst . configExConstraints . savedConfigureExFlags $ userConfig
deps = mapMaybe (packageConstraintToDependency . userToPackageConstraint)
ucnstrs

This comment has been minimized.

@ezyang

ezyang Jan 6, 2017

Contributor

I can't tell if I should expect these deps to look like foo == 0.3.1.0, bar == 0.2.1.0 or something more relaxed. Comment would help.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 6, 2017

Member

This code is simply converting the list of UserConstraints from the freeze file to [Dependency] so that we can look them up in the package index. So it doesn't rely on them being in any special form.

latest = lookupLatest dep
in (\v -> (dep, v)) `fmap` isOutdated' this latest

isOutdated' :: [Version] -> [Version] -> Maybe Version

This comment has been minimized.

@ezyang

ezyang Jan 6, 2017

Contributor

OK, I hope sortedness of lookupDependency output is actually an invariant we can rely on.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 13, 2017

Member

Changed last to maximum just in case.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 6, 2017

Does this work with new-build freeze files?

Nope, but wouldn't be hard to add.

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch from f2296b2 to 92818b5 Jan 11, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 11, 2017

Rebased, added a changelog note.

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch 2 times, most recently from cc27be3 to 5bb8a70 Jan 13, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 13, 2017

Added tests, docs, new-style freeze file support, fixed a bug in --minor mode. This is now ready to go in.

@phadej
Copy link
Collaborator

phadej left a comment

Some small UI improvement ideas. I'm not requesting changes, but they would be good to have.

.. code-block:: console

$ cabal outdated
Outdated dependencies: HTTP ==4000.3.3 (latest: 4000.3.4), HUnit ==1.3.1.1

This comment has been minimized.

@phadej

phadej Jan 13, 2017

Collaborator

Can this be on each line separately, now the word wrapping is unfortunate: (latests: 1.5.0.0) drops to the next line

This comment has been minimized.

@phadej

phadej Jan 13, 2017

Collaborator

Also an example of "nothing to update" output would be great.


The following flags are supported by the ``outdated`` command:

``--freeze-file``

This comment has been minimized.

@phadej

phadej Jan 13, 2017

Collaborator

Could we add --exit-code, from git diff --help:

--exit-code
    Make the program exit with codes similar to diff(1). That is, it exits with 1 if there were differences and 0 means no differences.

--quiet
    Disable all output of the program. Implies --exit-code.

Also --simple-output (to be machine parseable), e.g. outputting just HUnit-1.5.0.0 ListLike-4.5 QuickCheck-2.9.2 etc.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 13, 2017

Member

It already supports --exit-code, I just forgot to document it. Thanks for the reminder. Will add --simple-output.

This comment has been minimized.

@23Skidoo

23Skidoo Jan 13, 2017

Member

Oh, actually I didn't, --exit-code is documented. --quiet is a good idea.

This comment has been minimized.

@phadej

phadej Jan 13, 2017

Collaborator

Sorry for not spotting it

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch 2 times, most recently from 539d648 to 2749cb6 Jan 13, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 13, 2017

Rebased, implemented --quiet and --simple-output, expanded documentation.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 13, 2017

And now a test suite failure that I cannot reproduce locally...

@ezyang

This comment has been minimized.

Copy link
Contributor

ezyang commented Jan 16, 2017

outdated_freeze.sh? What if you ported the test to cabal-testsuite? It's where everything should go eventually, and that might smooth over some difference and make it reproducible.

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch from 2749cb6 to bab355b Jan 16, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 16, 2017

Moved the test case to cabal-testsuite, hopefully it works now.

@ezyang Amazing job on the new test suite, BTW.

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch 2 times, most recently from 0837c55 to 192a5ae Jan 16, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 16, 2017

Test suite passes locally.

23Skidoo added some commits Jan 5, 2017

Update changelog.
[ci skip]

23Skidoo added some commits Jan 13, 2017

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch from 192a5ae to 3ec596a Jan 18, 2017

23Skidoo added some commits Jan 16, 2017

@23Skidoo 23Skidoo force-pushed the 23Skidoo:outdated-command branch from 3ec596a to 729ac03 Jan 19, 2017

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 19, 2017

Should be good to merge now, just blocked on the OS X build bot.

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 20, 2017

OS X build bots keep timing out, that's quite annoying. One of them finally passed now, waiting on the last one...

@23Skidoo

This comment has been minimized.

Copy link
Member

23Skidoo commented Jan 20, 2017

CI is green, merging.

@23Skidoo 23Skidoo merged commit 7cdc32f into haskell:master Jan 20, 2017

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@23Skidoo 23Skidoo deleted the 23Skidoo:outdated-command branch Jan 20, 2017

Exit with a non-zero exit code when there are outdated dependencies.
``-q, --quiet``
Don't print any output. Implies ``-v0`` and ``--exit-code``.
``--ignore`` *PACKAGENAMES*

This comment has been minimized.

@jonathanjouty

jonathanjouty Jan 20, 2017

@23Skidoo Pedantry... shouldn't this be *[PACKAGENAMES]*?

This comment has been minimized.

@23Skidoo

23Skidoo Jan 20, 2017

Member

Actually no, that form isn't supported, because ignoring everything doesn't make sense (at least until a whitelist feature is added).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment