cabal icon indicating copy to clipboard operation
cabal copied to clipboard

Improve cabal update message

Open andreabedini opened this issue 2 years ago • 9 comments

This change tries to address #9039 and similar issues.

  • cabal update now mentions a "global index-state".
  • cabal update reports the head timestamp of the package index as well as the set index-state.

Example:

$ cabal update repository.localhost,2016-09-24T17:47:48Z
Downloading the latest package list from repository.localhost
Package list of repository.localhost is up to date to 2023-12-15T04:30:20Z.
The global index-state for repository.localhost now resolves to 2016-09-24T17:47:48Z.
To revert to previous state run:
    cabal v2-update 'repository.localhost,2022-01-28T02:36:41Z'

$ cabal update repository.localhost,2022-01-28T02:36:41Z
Downloading the latest package list from repository.localhost
Package list of repository.localhost is up to date to 2023-12-15T04:30:20Z.
The global index-state for repository.localhost now resolves to 2022-01-28T02:36:41Z.
To revert to previous state run:
    cabal v2-update 'repository.localhost,2016-09-24T17:47:48Z'

andreabedini avatar Dec 15 '23 04:12 andreabedini

I don't really understand the output:

Package list of repository.localhost is up to date at 2023-12-15T04:30:20Z.
The global index-state for repository.localhost now is 2016-09-24T17:47:48Z.

How can it be "up to date" if it refers to a date later than what the global index-state points to? Or is it the case that you can "download up to the latest" but set the global index to resolve always to a previous date, if not otherwise specified?

jasagredo avatar Dec 18 '23 10:12 jasagredo

How can it be "up to date" if it refers to a date later than what the global index-state points to? Or is it the case that you can "download up to the latest" but set the global index to resolve always to a previous date, if not otherwise specified?

Yes, this is the behaviour I was trying (and failed apparently :joy:) to make explicit in the message.

Running cabal update always brings 01-index.tar.gz up to date with the latest available on the repository. 2023-12-15T04:30:20Z is the timestamp of the most recent entry in 01-index.tar.gz. cabal update repository.localhost,2016-09-24T17:47:48Z also brings 01-index.tar.gz up to date but when writes in 01-index.timestamp that the default index state should be 2016-09-24T17:47:48Z unless something else is specified.

I don't know how to express this any better.

andreabedini avatar Dec 18 '23 23:12 andreabedini

Hmm, how about something like:

The repository repository.localhost now has data for index-states up to 2023-12-15T04:30:20Z.
The global index-state for the repository repository.localhost has been set to 2016-09-24T17:47:48Z.

michaelpj avatar Dec 18 '23 23:12 michaelpj

The most recent known index-state for the repository ......... has been updated to 2023-12-15T04:30:20Z.
The default index-state timestamp for the repository ......... has been set to 2016-09-24T17:47:48Z.

Or something along those lines?

jasagredo avatar Dec 18 '23 23:12 jasagredo

That's why I should not do user facing changes :joy:

I am happy with

The most recent known index-state for the repository ... The default index-state timestamp for the repository ...

Should we say something different if the two timestamps are the same (which happens when you just do cabal update, i.e. the vast majority of cases).

andreabedini avatar Dec 19 '23 06:12 andreabedini

Perhaps something like:

The most recent known index-state and the default index-state timestamp for the repository ......... have both been updated to 2023-12-15T04:30:20Z.

I think that is quite clear

jasagredo avatar Dec 19 '23 06:12 jasagredo

I have updated the message but the test output is now non-reproducible as it contains a variable timestamp. I might need the same workaraound as RejectFutureIndexState.

The thing is that we disabled those two tests anyway (#9593). Maybe it's better to focus on #9540 before this PR.

andreabedini avatar Jan 19 '24 08:01 andreabedini

I never looked into the "marked output" shenanigans, but they could help to ignore the variable potion of the output?

ulysses4ever avatar Jan 19 '24 13:01 ulysses4ever

This is marked as needs review, but it looks like there's some outstanding test tweaks before it can be reviewed and merged?

gbaz avatar Oct 10 '24 17:10 gbaz