Commit e7ba7834 authored by Bodigrim's avatar Bodigrim

Revert "Require base16-bytestring >= 1.0"

This reverts commit 981f6d9d.
parent 981f6d9d
......@@ -267,7 +267,7 @@ executable cabal
async >= 2.0 && < 2.3,
array >= 0.4 && < 0.6,
base >= 4.8 && < 4.15,
base16-bytestring >= 1.0 && < 1.1,
base16-bytestring >= 0.1.1 && < 1.1.0.0,
binary >= 0.7.3 && < 0.9,
bytestring >= 0.10.6.0 && < 0.11,
Cabal == 3.5.*,
......
{-# LANGUAGE CPP #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE DeriveGeneric #-}
module Distribution.Client.HashValue (
......@@ -71,8 +72,14 @@ hashFromTUF (Sec.Hash hashstr) =
--TODO: [code cleanup] either we should get TUF to use raw bytestrings or
-- perhaps we should also just use a base16 string as the internal rep.
case Base16.decode (BS.pack hashstr) of
#if MIN_VERSION_base16_bytestring(1,0,0)
Right hash -> HashValue hash
Left _ -> error "hashFromTUF: cannot decode base16"
#else
(hash, trailing) | not (BS.null hash) && BS.null trailing
-> HashValue hash
_ -> error "hashFromTUF: cannot decode base16 hash"
#endif
-- | Truncate a 32 byte SHA256 hash to
--
......
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
-----------------------------------------------------------------------------
-- | Separate module for HTTP actions, using a proxy server if one exists.
-----------------------------------------------------------------------------
......@@ -183,7 +184,11 @@ downloadURI transport verbosity uri path = do
_ <- P.string "#sha256="
str <- some P.hexDigit
let bs = Base16.decode (BS8.pack str)
#if MIN_VERSION_base16_bytestring(1,0,0)
either fail return bs
#else
return (fst bs)
#endif
------------------------------------------------------------------------------
-- Utilities for repo url management
......
......@@ -58,7 +58,7 @@ library
, aeson ^>= 1.4.2.0 || ^>=1.5.0.0
, async ^>= 2.2.1
, attoparsec ^>= 0.13.2.2
, base16-bytestring ^>= 1.0.0.0
, base16-bytestring ^>= 0.1.1.6 || ^>= 1.0.0.0
, bytestring ^>= 0.10.0.2
, containers ^>= 0.5.0.0 || ^>= 0.6.0.1
, cryptohash-sha256 ^>= 0.11.101.0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment