Repository navigation
get last update timestamp from XX-index.timestamp's modification time - #4578
tvestelind wants to merge 1 commit into
Conversation
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]>
|
@tvestelind, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hvr, @dcoutts and @owst to be potential reviewers. |
|
This is nice, but doesn't this only work for for secure repos? In the non-secure case we don't have the |
|
I just want to point out that |
|
Sorry, I thought that we wrote a .timestamp file in all cases. I'll have to rethink the solution then. Do you think that I should look into updating the modification time for XX-index.tar? |
|
Re:
I think that'd be a valid solution. |
|
Closing in favour of #4950. |
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-hackageand usedtouchto set the modification date on all files to one year agocabal installand verified that I got the errorWarning: The package list for 'next-hackage' is 365 days old.cabal update && cabal installand verified that the error was still there.cabal update && cabal installand verified that the error was gone.