get rid of another cmd date

This commit is contained in:
Jan Tojnar 2018-04-04 16:59:17 +02:00
parent 432a184db5
commit 4060b0112a
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
2 changed files with 4 additions and 2 deletions

View File

@ -14,6 +14,7 @@ dependencies:
- base >= 4.7 && < 5
- shelly >= 1.6 && < 1.8
- text
- directory >= 1.3 && < 1.4
- filepath
- time >= 1.8 && < 1.10
- optparse-applicative

View File

@ -17,6 +17,7 @@ import Data.Text (Text)
import Data.Time.Clock (UTCTime, addUTCTime, diffUTCTime, getCurrentTime)
import Data.Time.Format (defaultTimeLocale, formatTime, iso8601DateFormat)
import Shelly
import System.Directory (getModificationTime)
import Utils (ExitCode(..), Options(..), Version, canFail, checkAttrPathVersion, orElse, parseUpdates, setupNixpkgs, tRead)
default (T.Text)
@ -154,8 +155,8 @@ updatePackage options log packageName oldVersion newVersion okToPrAt = do
forM_ nameBlackList $ \(isBlacklisted, message) -> do
when (isBlacklisted packageName) $ errorExit message
oneHourAgo <- cmd "date" "+%s" "-d" "-1 hour"
fetchedLast <- cmd "stat" "-c" "%Y" ".git/FETCH_HEAD"
oneHourAgo <- addUTCTime (fromInteger $ - 60 * 60) <$> liftIO getCurrentTime
fetchedLast <- liftIO $ getModificationTime ".git/FETCH_HEAD"
when (fetchedLast < oneHourAgo) $ do
canFail $ cmd "git" "fetch" "--prune" "--multiple" "upstream" "origin"