Skip to content

Commit

Permalink
Use the newest version of 'versions'.
Browse files Browse the repository at this point in the history
  • Loading branch information
athas committed Oct 24, 2020
1 parent e2d70aa commit 7b17dca
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cabal.project
@@ -1,5 +1,5 @@
packages: futhark.cabal
index-state: 2020-08-27T09:04:41Z
index-state: 2020-10-24T05:40:24Z

package futhark
ghc-options: -Werror -j
Expand Down
2 changes: 1 addition & 1 deletion futhark.cabal
Expand Up @@ -313,7 +313,7 @@ library
, utf8-string >=1
, vector >=0.12
, vector-binary-instances >=0.2.2.0
, versions >=3.3.1
, versions >=4.0.1
, zip-archive >=0.3.1.1
, zlib >=0.6.1.2
default-language: Haskell2010
Expand Down
4 changes: 2 additions & 2 deletions src/Futhark/Pkg/Info.hs
Expand Up @@ -284,7 +284,7 @@ ghglPkgInfo repo_url mk_archive_url mk_manifest_url mk_zip_dir owner repo versio
| [hash, ref] <- T.words l,
["refs", "tags", t] <- T.splitOn "/" ref,
"v" `T.isPrefixOf` t,
Right v <- semver $ T.drop 1 t,
Right v <- parseVersion $ T.drop 1 t,
_svMajor v `elem` versions = do
pinfo <-
ghglLookupCommit
Expand Down Expand Up @@ -359,7 +359,7 @@ glPkgInfo owner repo versions =
<> "/"
<> T.pack futharkPkg
mk_zip_dir r
| Right _ <- semver r = repo <> "-v" <> r
| Right _ <- parseVersion r = repo <> "-v" <> r
| otherwise = repo <> "-" <> r

-- | A package registry is a mapping from package paths to information
Expand Down
7 changes: 4 additions & 3 deletions src/Futhark/Pkg/Types.hs
Expand Up @@ -41,12 +41,13 @@ import Control.Monad
import Data.Either
import Data.Foldable
import Data.List (sortOn)
import qualified Data.List.NonEmpty as NE
import qualified Data.Map as M
import Data.Maybe
import qualified Data.Text as T
import qualified Data.Text.IO as T
import Data.Traversable
import Data.Versions (SemVer (..), VUnit (..), prettySemVer, semver)
import Data.Versions (SemVer (..), VUnit (..), prettySemVer)
import Data.Void
import System.FilePath
import qualified System.FilePath.Posix as Posix
Expand All @@ -69,13 +70,13 @@ pkgPathFilePath = joinPath . Posix.splitPath . T.unpack
-- @hash@ (typically the Git commit ID). This function detects such
-- versions.
isCommitVersion :: SemVer -> Maybe T.Text
isCommitVersion (SemVer 0 0 0 [_] [[Str s]]) = Just s
isCommitVersion (SemVer 0 0 0 [_] [Str s NE.:| []]) = Just s
isCommitVersion _ = Nothing

-- | @commitVersion timestamp commit@ constructs a commit version.
commitVersion :: T.Text -> T.Text -> SemVer
commitVersion time commit =
SemVer 0 0 0 [[Str time]] [[Str commit]]
SemVer 0 0 0 [Str time NE.:| []] [Str commit NE.:| []]

-- | Unfortunately, Data.Versions has a buggy semver parser that
-- collapses consecutive zeroes in the metadata field. So, we define
Expand Down
1 change: 1 addition & 0 deletions stack.yaml
Expand Up @@ -5,6 +5,7 @@ packages:
extra-deps:
- sexp-grammar-2.2.1@sha256:a05a86f83e7d1d9767fbc1b0cba7859455a10c6365173b72c10f5b0e93140a50,2473
- invertible-grammar-0.1.3@sha256:aeae40093db800e1130b8f58ae47f4474b131c22d830913d1051d1ab083f6f13,1651
- versions-4.0.1

flags: {}

Expand Down

0 comments on commit 7b17dca

Please sign in to comment.