get last update timestamp from XX-index.timestamp's modification time #4578
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The reason we cannot the timestamp of the last update it from
XX-index.tar is because it's modification time is not updated unless
there is a newer version available in the repository.
On the other hand, XX-index.timestamp's modification time is always
updated, even if there are no new updates. That means that the
modifiation time of file will correspond to the last update attemp. So,
to decide whether to warn about having an old index we can use the last
modification time of that file.
One could also have the modification time of XX-index.tar updated even
thought there aren't any updates, but to do that I think we'd need to
modify checkForUpdates in Hackage.Security.Client.
Signed-off-by: Tomas Vestelind [email protected]
This fixes #4444 and I tested this by following the steps to reproduce described in that issue. But to summarize, I did:
.cabal/config
./dist/build/cabal/cabal update
(I'll exclude the./dist/.../
part from now one, it's just to show that I really used what I build)cabal/packages/next-hackage
and usedtouch
to set the modification date on all files to one year agocabal install
and verified that I got the errorWarning: The package list for 'next-hackage' is 365 days old.
cabal update && cabal install
and verified that the error was still there.cabal update && cabal install
and verified that the error was gone.