diff --git a/cabal-install/src/Distribution/Client/CmdUpdate.hs b/cabal-install/src/Distribution/Client/CmdUpdate.hs index b205dfda348..15e7e52afce 100644 --- a/cabal-install/src/Distribution/Client/CmdUpdate.hs +++ b/cabal-install/src/Distribution/Client/CmdUpdate.hs @@ -45,7 +45,6 @@ import Distribution.Simple.Utils ( die', notice, wrapText, writeFileAtomic, noticeNoWrap ) import Distribution.Verbosity ( normal, lessVerbose ) -import Distribution.Client.IndexUtils.Timestamp import Distribution.Client.IndexUtils.IndexState import Distribution.Client.IndexUtils ( updateRepoIndexCache, Index(..), writeIndexTimestamp @@ -201,7 +200,8 @@ updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do then Just `fmap` getCurrentTime else return Nothing updated <- Sec.uncheckClientErrors $ Sec.checkForUpdates repoSecure ce - + -- this resolves indexState (which could be HEAD) into a timestamp + new_ts <- currentIndexTimestamp (lessVerbose verbosity) repoCtxt repo let rname = remoteRepoName (repoRemote repo) -- Update cabal's internal index as well so that it's not out of sync @@ -211,20 +211,20 @@ updateRepo verbosity _updateFlags repoCtxt (repo, indexState) = do now <- getCurrentTime setModificationTime (indexBaseName repo <.> "tar") now noticeNoWrap verbosity $ - "Package list of " ++ prettyShow rname ++ - " is up to date at index-state " ++ prettyShow (IndexStateTime current_ts) + "Package list of " ++ prettyShow rname ++ " is up to date." Sec.HasUpdates -> do updateRepoIndexCache verbosity index - new_ts <- currentIndexTimestamp (lessVerbose verbosity) repoCtxt repo noticeNoWrap verbosity $ - "Updated package list of " ++ prettyShow rname ++ - " to the index-state " ++ prettyShow (IndexStateTime new_ts) - - -- TODO: This will print multiple times if there are multiple - -- repositories: main problem is we don't have a way of updating - -- a specific repo. Once we implement that, update this. - when (current_ts /= nullTimestamp) $ - noticeNoWrap verbosity $ - "To revert to previous state run:\n" ++ - " cabal v2-update '" ++ prettyShow (UpdateRequest rname (IndexStateTime current_ts)) ++ "'\n" + "Package list of " ++ prettyShow rname ++ " has been updated." + + noticeNoWrap verbosity $ + "The index-state is set to " ++ prettyShow (IndexStateTime new_ts) ++ "." + + -- TODO: This will print multiple times if there are multiple + -- repositories: main problem is we don't have a way of updating + -- a specific repo. Once we implement that, update this. + when (new_ts /= current_ts) $ + noticeNoWrap verbosity $ + "To revert to previous state run:\n" ++ + " cabal v2-update '" ++ prettyShow (UpdateRequest rname (IndexStateTime current_ts)) ++ "'\n" \ No newline at end of file diff --git a/changelog.d/pr-7934 b/changelog.d/pr-7934 new file mode 100644 index 00000000000..239f7dd2842 --- /dev/null +++ b/changelog.d/pr-7934 @@ -0,0 +1,3 @@ +synopsis: Fix the timestamp shown during cabal update +packages: cabal-install +prs: #7934