Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package ghc-language-docker for
openSUSE:Factory checked in at 2024-12-20 23:10:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-language-docker (Old)
and /work/SRC/openSUSE:Factory/.ghc-language-docker.new.1881 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-language-docker"
Fri Dec 20 23:10:42 2024 rev:3 rq:1231454 version:13.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-language-docker/ghc-language-docker.changes
2024-03-20 21:16:10.330037870 +0100
+++
/work/SRC/openSUSE:Factory/.ghc-language-docker.new.1881/ghc-language-docker.changes
2024-12-20 23:11:19.058197107 +0100
@@ -1,0 +2,8 @@
+Wed Apr 24 18:33:18 UTC 2024 - Peter Simons <[email protected]>
+
+- Update language-docker to version 13.0.0.
+ Upstream does not provide a change log file.
+
+- Remove obsolete "fix-build-with-ghc-9.8.x.patch".
+
+-------------------------------------------------------------------
Old:
----
fix-build-with-ghc-9.8.x.patch
language-docker-11.0.0.tar.gz
New:
----
language-docker-13.0.0.tar.gz
BETA DEBUG BEGIN:
Old:
- Remove obsolete "fix-build-with-ghc-9.8.x.patch".
BETA DEBUG END:
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-language-docker.spec ++++++
--- /var/tmp/diff_new_pack.B5Zo8b/_old 2024-12-20 23:11:19.930233061 +0100
+++ /var/tmp/diff_new_pack.B5Zo8b/_new 2024-12-20 23:11:19.934233225 +0100
@@ -20,13 +20,12 @@
%global pkgver %{pkg_name}-%{version}
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 11.0.0
+Version: 13.0.0
Release: 0
Summary: Dockerfile parser, pretty-printer and embedded DSL
License: GPL-3.0-or-later
URL: https://hackage.haskell.org/package/%{pkg_name}
Source0:
https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
-Patch1:
https://github.com/hadolint/language-docker/pull/94.patch#/fix-build-with-ghc-9.8.x.patch
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-base-devel
BuildRequires: ghc-base-prof
@@ -96,7 +95,7 @@
This package provides the Haskell %{pkg_name} profiling library.
%prep
-%autosetup -n %{pkg_name}-%{version} -p1
+%autosetup -n %{pkg_name}-%{version}
%build
%ghc_lib_build
++++++ language-docker-11.0.0.tar.gz -> language-docker-13.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/language-docker-11.0.0/language-docker.cabal
new/language-docker-13.0.0/language-docker.cabal
--- old/language-docker-11.0.0/language-docker.cabal 2022-04-04
16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/language-docker.cabal 2001-09-09
03:46:40.000000000 +0200
@@ -1,13 +1,7 @@
-cabal-version: 1.12
-
--- This file has been generated from package.yaml by hpack version 0.34.4.
---
--- see: https://github.com/sol/hpack
---
--- hash: 1dcabc3e868541acb7c49590054c62c6637d1deaefc81e4b39de64333bc9d239
+cabal-version: 2.0
name: language-docker
-version: 11.0.0
+version: 13.0.0
synopsis: Dockerfile parser, pretty-printer and embedded DSL
description: All functions for parsing and pretty-printing Dockerfiles are
exported through @Language.Docker@. For more fine-grained operations look for
specific modules that implement a certain functionality.
See the <https://github.com/hadolint/language-docker GitHub
project> for the source-code and examples.
@@ -61,7 +55,9 @@
Language.Docker.Parser.Pairs
Language.Docker.Parser.Prelude
Language.Docker.Parser.Run
- Paths_language_docker
+ Language.Docker.Syntax.Port
+ Language.Docker.Syntax.PortRange
+ Language.Docker.Syntax.Protocol
hs-source-dirs:
src
default-extensions:
@@ -80,7 +76,7 @@
, split >=0.2
, text
, time
- default-language: Haskell2010
+ default-language: GHC2021
test-suite hspec
type: exitcode-stdio-1.0
@@ -90,12 +86,13 @@
Language.Docker.ParseAddSpec
Language.Docker.ParseCmdSpec
Language.Docker.ParseCopySpec
+ Language.Docker.ParseExposeSpec
+ Language.Docker.ParseHealthcheckSpec
Language.Docker.ParsePragmaSpec
Language.Docker.ParserSpec
Language.Docker.ParseRunSpec
Language.Docker.PrettyPrintSpec
TestHelper
- Paths_language_docker
hs-source-dirs:
test
default-extensions:
@@ -120,4 +117,5 @@
, split >=0.2
, text
, time
- default-language: Haskell2010
+ default-language: GHC2021
+ build-tool-depends: hspec-discover:hspec-discover == 2.*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Parser/Arguments.hs
new/language-docker-13.0.0/src/Language/Docker/Parser/Arguments.hs
--- old/language-docker-11.0.0/src/Language/Docker/Parser/Arguments.hs
2022-03-23 13:50:36.000000000 +0100
+++ new/language-docker-13.0.0/src/Language/Docker/Parser/Arguments.hs
2001-09-09 03:46:40.000000000 +0200
@@ -22,7 +22,7 @@
toEnd = untilEol "the shell arguments"
-- Parse arguments of a command in the heredoc format
-argumentsHeredoc :: Parser (Arguments Text)
+argumentsHeredoc :: (?esc :: Char) => Parser (Arguments Text)
argumentsHeredoc = ArgumentsText <$> heredoc
arguments :: (?esc :: Char) => Parser (Arguments Text)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Parser/Copy.hs
new/language-docker-13.0.0/src/Language/Docker/Parser/Copy.hs
--- old/language-docker-11.0.0/src/Language/Docker/Parser/Copy.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker/Parser/Copy.hs
2001-09-09 03:46:40.000000000 +0200
@@ -10,7 +10,8 @@
import Language.Docker.Syntax
data Flag
- = FlagChown Chown
+ = FlagChecksum Checksum
+ | FlagChown Chown
| FlagChmod Chmod
| FlagLink Link
| FlagSource CopySource
@@ -56,18 +57,23 @@
parseAdd = do
reserved "ADD"
flags <- addFlag `sepEndBy` requiredWhitespace
+ let checksumFlags = [c | FlagChecksum c <- flags]
let chownFlags = [c | FlagChown c <- flags]
let chmodFlags = [c | FlagChmod c <- flags]
let linkFlags = [l | FlagLink l <- flags]
let invalidFlags = [i | FlagInvalid i <- flags]
notFollowedBy (string "--") <?>
- "only the --chown flag, the --chmod flag or the src and dest paths"
- case (invalidFlags, chownFlags, linkFlags, chmodFlags) of
- ((k, v) : _, _, _, _) -> unexpectedFlag k v
- (_, _ : _ : _, _, _) -> customError $ DuplicateFlagError "--chown"
- (_, _, _ : _ : _, _) -> customError $ DuplicateFlagError "--chmod"
- (_, _, _, _ : _ : _) -> customError $ DuplicateFlagError "--link"
+ "only the --checksum, --chown, --chmod, --link flags or the src and dest
paths"
+ case (invalidFlags, checksumFlags, chownFlags, linkFlags, chmodFlags) of
+ ((k, v) : _, _, _, _, _) -> unexpectedFlag k v
+ (_, _ : _ : _, _, _, _) -> customError $ DuplicateFlagError "--checksum"
+ (_, _, _ : _ : _, _, _) -> customError $ DuplicateFlagError "--chown"
+ (_, _, _, _ : _ : _, _) -> customError $ DuplicateFlagError "--chmod"
+ (_, _, _, _, _ : _ : _) -> customError $ DuplicateFlagError "--link"
_ -> do
+ let chk = case checksumFlags of
+ [] -> NoChecksum
+ c : _ -> c
let cho = case chownFlags of
[] -> NoChown
c : _ -> c
@@ -78,7 +84,7 @@
case linkFlags of
[] -> NoLink
l : _ -> l
- fileList "ADD" (\src dest -> Add (AddArgs src dest) (AddFlags cho chm
lnk))
+ fileList "ADD" (\src dest -> Add (AddArgs src dest) (AddFlags chk cho
chm lnk))
heredocList :: (?esc :: Char) =>
(NonEmpty SourcePath -> TargetPath -> Instruction Text) ->
@@ -114,11 +120,18 @@
copyFlag = (FlagSource <$> try copySource <?> "only one --from") <|> addFlag
addFlag :: (?esc :: Char) => Parser Flag
-addFlag = (FlagChown <$> try chown <?> "--chown")
+addFlag = (FlagChecksum <$> try checksum <?> "--checksum")
+ <|> (FlagChown <$> try chown <?> "--chown")
<|> (FlagChmod <$> try chmod <?> "--chmod")
<|> (FlagLink <$> try link <?> "--link")
<|> (FlagInvalid <$> try anyFlag <?> "other flag")
+checksum :: (?esc :: Char) => Parser Checksum
+checksum = do
+ void $ string "--checksum="
+ chk <- someUnless "the remote file checksum" (== ' ')
+ return $ Checksum chk
+
chown :: (?esc :: Char) => Parser Chown
chown = do
void $ string "--chown="
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Parser/Expose.hs
new/language-docker-13.0.0/src/Language/Docker/Parser/Expose.hs
--- old/language-docker-11.0.0/src/Language/Docker/Parser/Expose.hs
2021-08-04 09:26:50.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker/Parser/Expose.hs
2001-09-09 03:46:40.000000000 +0200
@@ -12,22 +12,48 @@
reserved "EXPOSE"
Expose <$> ports
+ports :: (?esc :: Char) => Parser Ports
+ports = Ports <$> portspec `sepEndBy` requiredWhitespace
+
+portspec :: (?esc :: Char) => Parser PortSpec
+portspec =
+ ( try parsePortRangeSpec <?> "A range of ports optionally followed by the
protocol" )
+ <|> ( parsePortSpec <?> "A port optionally followed by the protocol" )
+
+parsePortRangeSpec :: (?esc :: Char) => Parser PortSpec
+parsePortRangeSpec = PortRangeSpec <$> portRange
+
+parsePortSpec :: (?esc :: Char) => Parser PortSpec
+parsePortSpec = PortSpec <$> port
+
port :: (?esc :: Char) => Parser Port
port = (try portVariable <?> "a variable")
- <|> (try portRange <?> "a port range optionally followed by the protocol
(udp/tcp)") -- There a many valid representations of ports
<|> (try portWithProtocol <?> "a port with its protocol (udp/tcp)")
<|> (portInt <?> "a valid port number")
-ports :: (?esc :: Char) => Parser Ports
-ports = Ports <$> port `sepEndBy` requiredWhitespace
+portRangeLimit :: (?esc :: Char) => Parser Port
+portRangeLimit = number <|> variable
+ where
+ number = do
+ num <- natural
+ return $ Port (fromIntegral num) TCP
+
+ variable = do
+ void (char '$')
+ var <- someUnless "the variable name" (\c -> c == '-' || c == '/')
+ return $ PortStr (T.append "$" var)
-portRange :: Parser Port
+portRange :: (?esc :: Char) => Parser PortRange
portRange = do
- start <- natural
+ start <- portRangeLimit
void $ char '-'
- finish <- try natural
+ finish <- try portRangeLimit
proto <- try protocol <|> return TCP
- return $ PortRange (fromIntegral start) (fromIntegral finish) proto
+ return $ PortRange (setProto start proto) (setProto finish proto)
+ where
+ setProto :: Port -> Protocol -> Port
+ setProto (Port p _) prot = Port p prot
+ setProto (PortStr s) _ = PortStr s
protocol :: Parser Protocol
protocol = do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Parser/Healthcheck.hs
new/language-docker-13.0.0/src/Language/Docker/Parser/Healthcheck.hs
--- old/language-docker-11.0.0/src/Language/Docker/Parser/Healthcheck.hs
2021-06-13 13:17:06.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker/Parser/Healthcheck.hs
2001-09-09 03:46:40.000000000 +0200
@@ -70,12 +70,14 @@
durationFlag :: Text -> Parser Duration
durationFlag flagName = do
void $ try (string flagName)
- scale <- natural
+ value <- try ( fromRational . realToFrac <$> fractional )
+ <|> ( secondsToDiffTime . fromInteger <$> natural )
+ <?> "a natural or fractional number"
unit <- char 's' <|> char 'm' <|> char 'h' <?> "either 's', 'm' or 'h' as
the unit"
case unit of
- 's' -> return $ Duration (secondsToDiffTime scale)
- 'm' -> return $ Duration (secondsToDiffTime (scale * 60))
- 'h' -> return $ Duration (secondsToDiffTime (scale * 60 * 60))
+ 's' -> return $ Duration value
+ 'm' -> return $ Duration (value * 60)
+ 'h' -> return $ Duration (value * 60 * 60)
_ -> fail "only 's', 'm' or 'h' are allowed as the duration"
retriesFlag :: Parser Retries
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Parser/Prelude.hs
new/language-docker-13.0.0/src/Language/Docker/Parser/Prelude.hs
--- old/language-docker-11.0.0/src/Language/Docker/Parser/Prelude.hs
2022-03-23 13:50:36.000000000 +0100
+++ new/language-docker-13.0.0/src/Language/Docker/Parser/Prelude.hs
2001-09-09 03:46:40.000000000 +0200
@@ -14,6 +14,8 @@
doubleQuotedString,
doubleQuotedStringEscaped,
eol,
+ escapedLineBreaks',
+ fractional,
heredoc,
heredocContent,
heredocMarker,
@@ -133,6 +135,9 @@
natural :: Parser Integer
natural = L.decimal <?> "positive number"
+fractional :: Parser Float
+fractional = L.float <?> "fractional number"
+
commaSep :: (?esc :: Char) => Parser a -> Parser [a]
commaSep p = sepBy (p <* whitespace) (symbol ",")
@@ -170,7 +175,7 @@
s <- manyTill anySingle spaceChar
return $ T.pack s
-heredocMarker :: Parser Text
+heredocMarker :: (?esc :: Char) => Parser Text
heredocMarker = do
void $ string "<<"
void $ takeWhileP (Just "dash") (== '-')
@@ -178,11 +183,14 @@
optional heredocRedirect
pure m
-heredocRedirect :: Parser Text
+heredocRedirect :: (?esc :: Char) => Parser Text
heredocRedirect = do
- void $ char '>'
- takeWhileP (Just "heredoc path") (/= '\n')
+ void $ ( string "|" <|> string ">" <|> string ">>" ) *> onlySpaces
+ untilEol "heredoc path"
+-- | This tries to parse everything until there is the just the heredoc marker
+-- on its own on a line. Making provisions for the case that the marker is
+-- followed by the end of the file rather than another newline.
heredocContent :: Text -> Parser Text
heredocContent marker = do
emptyHeredoc <- observing delimiter
@@ -215,17 +223,24 @@
hidden eof
pure t
-heredoc :: Parser Text
+heredoc :: (?esc :: Char) => Parser Text
heredoc = do
m <- heredocMarker
heredocContent m
-- | Parses text until a heredoc or newline is found. Will also consume the
--- heredoc.
-untilHeredoc :: Parser Text
+-- heredoc. It will however respect escaped newlines.
+untilHeredoc :: (?esc :: Char) => Parser Text
untilHeredoc = do
- txt <- manyTill (anySingleBut '\n') heredoc
- return $ T.strip $ T.pack txt
+ txt <- manyTill chars heredoc
+ return $ T.strip $ mconcat txt
+ where
+ chars =
+ choice
+ [ castToSpace <$> escapedLineBreaks,
+ charToTxt <$> anySingleBut '\n'
+ ]
+ charToTxt c = T.pack [c]
onlySpaces :: Parser Text
onlySpaces = takeWhileP (Just "spaces") (\c -> c == ' ' || c == '\t')
@@ -250,6 +265,17 @@
FoundWhitespace <$ onlySpaces1 <|> pure MissingWhitespace
newlines = takeWhile1P Nothing isNl
+-- | This converts escaped line breaks, but keeps _all_ spaces before and after
+escapedLineBreaks' :: (?esc :: Char) => Parser Text
+escapedLineBreaks' = mconcat <$> breaks
+ where
+ breaks =
+ some $ do
+ try ( char ?esc *> onlySpaces *> newlines )
+ skipMany . try $ onlySpaces *> comment *> newlines
+ onlySpaces1
+ newlines = takeWhile1P Nothing isNl
+
foundWhitespace :: (?esc :: Char) => Parser FoundWhitespace
foundWhitespace = mconcat <$> found
where
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/PrettyPrint.hs
new/language-docker-13.0.0/src/Language/Docker/PrettyPrint.hs
--- old/language-docker-11.0.0/src/Language/Docker/PrettyPrint.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker/PrettyPrint.hs
2001-09-09 03:46:40.000000000 +0200
@@ -123,12 +123,9 @@
accumulate c EscapeAccum {buffer, escaping = False} =
EscapeAccum (B.singleton c <> buffer) 0 False
-prettyPrintPort :: Port -> Doc ann
-prettyPrintPort (PortStr str) = pretty str
-prettyPrintPort (PortRange start stop TCP) = pretty start <> "-" <> pretty stop
-prettyPrintPort (PortRange start stop UDP) = pretty start <> "-" <> pretty
stop <> "/udp"
-prettyPrintPort (Port num TCP) = pretty num <> "/tcp"
-prettyPrintPort (Port num UDP) = pretty num <> "/udp"
+prettyPrintPortSpec :: PortSpec -> Doc ann
+prettyPrintPortSpec (PortSpec port) = pretty port
+prettyPrintPortSpec (PortRangeSpec portrange) = pretty portrange
prettyPrintFileList :: NonEmpty SourcePath -> TargetPath -> Doc ann
prettyPrintFileList sources (TargetPath dest) =
@@ -139,6 +136,12 @@
_ -> ""
in hsep $ [pretty s | SourcePath s <- toList sources] ++ [pretty dest <>
ending]
+prettyPrintChecksum :: Checksum -> Doc ann
+prettyPrintChecksum checksum =
+ case checksum of
+ Checksum c -> "--checksum=" <> pretty c
+ NoChecksum -> mempty
+
prettyPrintChown :: Chown -> Doc ann
prettyPrintChown chown =
case chown of
@@ -273,7 +276,7 @@
pretty w
Expose (Ports ps) -> do
"EXPOSE"
- hsep (fmap prettyPrintPort ps)
+ hsep (fmap prettyPrintPortSpec ps)
Volume dir -> do
"VOLUME"
pretty dir
@@ -318,8 +321,9 @@
prettyPrintBaseImage b
Add
AddArgs {sourcePaths, targetPath}
- AddFlags {chownFlag, chmodFlag, linkFlag} -> do
+ AddFlags {checksumFlag, chownFlag, chmodFlag, linkFlag} -> do
"ADD"
+ prettyPrintChecksum checksumFlag
prettyPrintChown chownFlag
prettyPrintChmod chmodFlag
prettyPrintLink linkFlag
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Syntax/Port.hs
new/language-docker-13.0.0/src/Language/Docker/Syntax/Port.hs
--- old/language-docker-11.0.0/src/Language/Docker/Syntax/Port.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/language-docker-13.0.0/src/Language/Docker/Syntax/Port.hs
2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,19 @@
+module Language.Docker.Syntax.Port where
+
+
+import Data.Text
+import Prettyprinter
+import Language.Docker.Syntax.Protocol
+
+
+-- | A port can either be a number (plus a protocol, tcp by default) or a
+-- variable.
+data Port
+ = Port !Int !Protocol
+ | PortStr !Text
+ deriving (Show, Eq, Ord)
+
+
+instance Pretty Port where
+ pretty (Port num proto) = pretty num <> pretty proto
+ pretty (PortStr str) = pretty str
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Syntax/PortRange.hs
new/language-docker-13.0.0/src/Language/Docker/Syntax/PortRange.hs
--- old/language-docker-11.0.0/src/Language/Docker/Syntax/PortRange.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/language-docker-13.0.0/src/Language/Docker/Syntax/PortRange.hs
2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,20 @@
+module Language.Docker.Syntax.PortRange where
+
+
+import Prettyprinter
+import Language.Docker.Syntax.Port
+import Language.Docker.Syntax.Protocol
+
+
+-- | A port range starts and ends with either a number or a variable and can
+-- have a protocol associated (tcp by default). The protocol of the start and
+-- end port shall be ignored.
+data PortRange
+ = PortRange !Port !Port
+ deriving (Show, Eq, Ord)
+
+
+instance Pretty PortRange where
+ pretty (PortRange (Port start UDP) (Port end UDP)) = pretty start <> "-" <>
pretty end <> "/udp"
+ pretty (PortRange (Port start UDP) end) = pretty start <> "-" <> pretty end
<> "/udp"
+ pretty (PortRange start end) = pretty start <> "-" <> pretty end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/src/Language/Docker/Syntax/Protocol.hs
new/language-docker-13.0.0/src/Language/Docker/Syntax/Protocol.hs
--- old/language-docker-11.0.0/src/Language/Docker/Syntax/Protocol.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/language-docker-13.0.0/src/Language/Docker/Syntax/Protocol.hs
2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,15 @@
+module Language.Docker.Syntax.Protocol where
+
+
+import Prettyprinter
+
+
+data Protocol
+ = TCP
+ | UDP
+ deriving (Show, Eq, Ord)
+
+
+instance Pretty Protocol where
+ pretty TCP = ""
+ pretty UDP = "/udp"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/language-docker-11.0.0/src/Language/Docker/Syntax.hs
new/language-docker-13.0.0/src/Language/Docker/Syntax.hs
--- old/language-docker-11.0.0/src/Language/Docker/Syntax.hs 2022-04-04
16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker/Syntax.hs 2001-09-09
03:46:40.000000000 +0200
@@ -4,7 +4,13 @@
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE TypeFamilies #-}
-module Language.Docker.Syntax where
+module Language.Docker.Syntax
+ ( module Language.Docker.Syntax,
+ module Language.Docker.Syntax.Port,
+ module Language.Docker.Syntax.PortRange,
+ module Language.Docker.Syntax.Protocol
+ )
+where
import Data.Default.Class (Default (..))
import Data.List (intercalate, isInfixOf)
@@ -18,6 +24,12 @@
import GHC.Exts (IsList (..))
import Text.Printf
+
+import Language.Docker.Syntax.Port
+import Language.Docker.Syntax.PortRange
+import Language.Docker.Syntax.Protocol
+
+
data Image
= Image
{ registryName :: !(Maybe Registry),
@@ -56,30 +68,19 @@
}
deriving (Show, Eq, Ord, IsString)
-data Protocol
- = TCP
- | UDP
- deriving (Show, Eq, Ord)
-
-data Port
- = Port
- !Int
- !Protocol
- | PortStr !Text
- | PortRange
- !Int
- !Int
- !Protocol
+data PortSpec
+ = PortSpec !Port
+ | PortRangeSpec !PortRange
deriving (Show, Eq, Ord)
newtype Ports
= Ports
- { unPorts :: [Port]
+ { unPorts :: [PortSpec]
}
deriving (Show, Eq, Ord)
instance IsList Ports where
- type Item Ports = Port
+ type Item Ports = PortSpec
fromList = Ports
toList (Ports ps) = ps
@@ -118,6 +119,17 @@
}
deriving (Show, Eq, Ord, IsString)
+data Checksum
+ = Checksum !Text
+ | NoChecksum
+ deriving (Show, Eq, Ord)
+
+instance IsString Checksum where
+ fromString ch =
+ case ch of
+ "" -> NoChecksum
+ _ -> Checksum (Text.pack ch)
+
data Chown
= Chown !Text
| NoChown
@@ -160,7 +172,7 @@
= Duration
{ durationTime :: DiffTime
}
- deriving (Show, Eq, Ord, Num)
+ deriving (Show, Eq, Ord, Num, Fractional)
newtype Retries
= Retries
@@ -196,14 +208,15 @@
data AddFlags
= AddFlags
- { chownFlag :: !Chown,
+ { checksumFlag :: !Checksum,
+ chownFlag :: !Chown,
chmodFlag :: !Chmod,
linkFlag :: !Link
}
deriving (Show, Eq, Ord)
instance Default AddFlags where
- def = AddFlags NoChown NoChmod NoLink
+ def = AddFlags NoChecksum NoChown NoChmod NoLink
data Check args
= Check !(CheckArgs args)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/language-docker-11.0.0/src/Language/Docker.hs
new/language-docker-13.0.0/src/Language/Docker.hs
--- old/language-docker-11.0.0/src/Language/Docker.hs 2021-06-13
13:17:06.000000000 +0200
+++ new/language-docker-13.0.0/src/Language/Docker.hs 2001-09-09
03:46:40.000000000 +0200
@@ -1,3 +1,5 @@
+{-# LANGUAGE DuplicateRecordFields #-}
+
module Language.Docker
( Language.Docker.Syntax.Dockerfile,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/ParseAddSpec.hs
new/language-docker-13.0.0/test/Language/Docker/ParseAddSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/ParseAddSpec.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/test/Language/Docker/ParseAddSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -41,13 +41,21 @@
)
def
]
+ it "with checksum flag" $
+ let file = Text.unlines ["ADD --checksum=sha256:24454f830cdd
http://www.example.com/foo bar"]
+ in assertAst
+ file
+ [ Add
+ ( AddArgs (fmap SourcePath ["http://www.example.com/foo"])
(TargetPath "bar") )
+ ( AddFlags (Checksum "sha256:24454f830cdd") NoChown NoChmod
NoLink )
+ ]
it "with chown flag" $
let file = Text.unlines ["ADD --chown=root:root foo bar"]
in assertAst
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags (Chown "root:root") NoChmod NoLink )
+ ( AddFlags NoChecksum (Chown "root:root") NoChmod NoLink )
]
it "with chmod flag" $
let file = Text.unlines ["ADD --chmod=640 foo bar"]
@@ -55,7 +63,7 @@
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags NoChown (Chmod "640") NoLink )
+ ( AddFlags NoChecksum NoChown (Chmod "640") NoLink )
]
it "with link flag" $
let file = Text.unlines ["ADD --link foo bar"]
@@ -63,7 +71,7 @@
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags NoChown NoChmod Link )
+ ( AddFlags NoChecksum NoChown NoChmod Link )
]
it "with chown and chmod flag" $
let file = Text.unlines ["ADD --chown=root:root --chmod=640 foo bar"]
@@ -71,7 +79,7 @@
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags (Chown "root:root") (Chmod "640") NoLink )
+ ( AddFlags NoChecksum (Chown "root:root") (Chmod "640") NoLink
)
]
it "with chown and chmod flag other order" $
let file = Text.unlines ["ADD --chmod=640 --chown=root:root foo bar"]
@@ -79,16 +87,16 @@
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags (Chown "root:root") (Chmod "640") NoLink )
+ ( AddFlags NoChecksum (Chown "root:root") (Chmod "640") NoLink
)
]
it "with all flags" $
let file =
- Text.unlines ["ADD --chmod=640 --chown=root:root --link foo bar"]
+ Text.unlines ["ADD --chmod=640 --chown=root:root
--checksum=sha256:24454f830cdd --link foo bar"]
in assertAst
file
[ Add
( AddArgs (fmap SourcePath ["foo"]) (TargetPath "bar") )
- ( AddFlags (Chown "root:root") (Chmod "640") Link )
+ ( AddFlags (Checksum "sha256:24454f830cdd") (Chown
"root:root") (Chmod "640") Link )
]
it "list of quoted files and chown" $
let file =
@@ -101,5 +109,5 @@
(fmap SourcePath ["foo", "bar", "baz"])
(TargetPath "/app")
)
- ( AddFlags (Chown "user:group") NoChmod NoLink )
+ ( AddFlags NoChecksum (Chown "user:group") NoChmod NoLink )
]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/ParseExposeSpec.hs
new/language-docker-13.0.0/test/Language/Docker/ParseExposeSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/ParseExposeSpec.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/language-docker-13.0.0/test/Language/Docker/ParseExposeSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,148 @@
+module Language.Docker.ParseExposeSpec where
+
+import Data.Default.Class (def)
+import qualified Data.Text as Text
+import Language.Docker.Syntax
+import TestHelper
+import Test.Hspec
+
+
+spec :: Spec
+spec = do
+ describe "parse EXPOSE" $ do
+
+ it "should handle number ports" $
+ let content = "EXPOSE 8080"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (Port 8080 TCP)
+ ]
+ )
+ ]
+
+ it "should handle many number ports" $
+ let content = "EXPOSE 8080 8081"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (Port 8080 TCP),
+ PortSpec (Port 8081 TCP)
+ ]
+ )
+ ]
+
+ it "should handle ports with protocol" $
+ let content = "EXPOSE 8080/TCP 8081/UDP"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (Port 8080 TCP),
+ PortSpec (Port 8081 UDP)
+ ]
+ )
+ ]
+
+ it "should handle ports with protocol and variables" $
+ let content = "EXPOSE $PORT 8080 8081/UDP"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (PortStr "$PORT"),
+ PortSpec (Port 8080 TCP),
+ PortSpec (Port 8081 UDP)
+ ]
+ )
+ ]
+
+ it "should handle port ranges" $
+ let content = "EXPOSE 80 81 8080-8085"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (Port 80 TCP),
+ PortSpec (Port 81 TCP),
+ PortRangeSpec
+ ( PortRange (Port 8080 TCP) (Port 8085 TCP) )
+ ]
+ )
+ ]
+
+ it "should handle udp port ranges" $
+ let content = "EXPOSE 80 81 8080-8085/udp"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (Port 80 TCP),
+ PortSpec (Port 81 TCP),
+ PortRangeSpec
+ ( PortRange (Port 8080 UDP) (Port 8085 UDP) )
+ ]
+ )
+ ]
+
+ it "should handle one variable port ranges 1" $
+ let content = "EXPOSE 8080-${bar}/udp"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortRangeSpec
+ ( PortRange (Port 8080 UDP) (PortStr "${bar}") )
+ ]
+ )
+ ]
+
+ it "should handle one variable port ranges 2" $
+ let content = "EXPOSE ${foo}-8080/udp"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortRangeSpec
+ ( PortRange (PortStr "${foo}") (Port 8080 UDP) )
+ ]
+ )
+ ]
+
+ it "should handle two variables port ranges" $
+ let content = "EXPOSE ${foo}-${bar}/udp"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortRangeSpec
+ ( PortRange (PortStr "${foo}") (PortStr "${bar}") )
+ ]
+ )
+ ]
+
+ it "should handle multiline variables" $
+ let content =
+ "EXPOSE ${PORT} ${PORT_SSL} \\\n\
+ \ ${PORT_HTTP} ${PORT_HTTPS} \\\n\
+ \ ${PORT_REP} \\\n\
+ \ ${PORT_ADMIN} ${PORT_ADMIN_HTTP}"
+ in assertAst
+ content
+ [ Expose
+ ( Ports
+ [ PortSpec (PortStr "${PORT}"),
+ PortSpec (PortStr "${PORT_SSL}"),
+ PortSpec (PortStr "${PORT_HTTP}"),
+ PortSpec (PortStr "${PORT_HTTPS}"),
+ PortSpec (PortStr "${PORT_REP}"),
+ PortSpec (PortStr "${PORT_ADMIN}"),
+ PortSpec (PortStr "${PORT_ADMIN_HTTP}")
+ ]
+ )
+ ]
+ it "should fail with wrong protocol" $
+ let content = "EXPOSE 80/ip"
+ in expectFail content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/ParseHealthcheckSpec.hs
new/language-docker-13.0.0/test/Language/Docker/ParseHealthcheckSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/ParseHealthcheckSpec.hs
1970-01-01 01:00:00.000000000 +0100
+++ new/language-docker-13.0.0/test/Language/Docker/ParseHealthcheckSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -0,0 +1,81 @@
+module Language.Docker.ParseHealthcheckSpec where
+
+import Data.Default.Class (def)
+import Language.Docker.Syntax
+import Test.Hspec
+import TestHelper
+import qualified Data.Set as Set
+import qualified Data.Text as Text
+
+
+spec :: Spec
+spec = do
+ describe "parse HEALTHCHECK" $ do
+ it "parse healthcheck with interval" $
+ assertAst
+ "HEALTHCHECK --interval=5m \\\nCMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs "curl -f http://localhost/" (Just 300) Nothing Nothing
Nothing
+ ]
+ it "parse healthcheck with retries" $
+ assertAst
+ "HEALTHCHECK --retries=10 CMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing
(Just $ Retries 10)
+ ]
+ it "parse healthcheck with timeout" $
+ assertAst
+ "HEALTHCHECK --timeout=10s CMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs "curl -f http://localhost/" Nothing (Just 10) Nothing
Nothing
+ ]
+ it "parse healthcheck with start-period" $
+ assertAst
+ "HEALTHCHECK --start-period=2m CMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs "curl -f http://localhost/" Nothing Nothing (Just 120)
Nothing
+ ]
+ it "parse healthcheck with all flags" $
+ assertAst
+ "HEALTHCHECK --start-period=2s --timeout=1m --retries=3 --interval=5s
CMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs
+ "curl -f http://localhost/"
+ (Just 5)
+ (Just 60)
+ (Just 2)
+ (Just $ Retries 3)
+ ]
+ it "parse healthcheck with no flags" $
+ assertAst
+ "HEALTHCHECK CMD curl -f http://localhost/"
+ [ Healthcheck $
+ Check $
+ CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing
Nothing
+ ]
+
+ it "fractional arguments to flags" $
+ let file =
+ Text.unlines
+ [ "HEALTHCHECK \\",
+ " --interval=0.5s \\",
+ " --timeout=0.1s \\",
+ " --start-period=0.2s \\",
+ " CMD curl -f http://localhost"
+ ]
+ in assertAst
+ file
+ [ Healthcheck $
+ Check $
+ CheckArgs
+ "curl -f http://localhost"
+ ( Just 0.5 )
+ ( Just 0.10000000149 )
+ ( Just 0.20000000298 )
+ Nothing
+ ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/ParseRunSpec.hs
new/language-docker-13.0.0/test/Language/Docker/ParseRunSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/ParseRunSpec.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/test/Language/Docker/ParseRunSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -14,6 +14,9 @@
it "escaped with space before" $
let dockerfile = Text.unlines ["RUN yum install -y \\", "imagemagick
\\", "mysql"]
in assertAst dockerfile [Run "yum install -y imagemagick mysql"]
+ it "escaped linebreak, indented" $
+ let file = Text.unlines [ "RUN foo ; \\", " bar" ]
+ in assertAst file [ Run "foo ; bar" ]
it "does not choke on unmatched brackets" $
let dockerfile = Text.unlines ["RUN [foo"]
in assertAst dockerfile [Run "[foo"]
@@ -501,17 +504,25 @@
in assertAst file [ Run $ RunArgs (ArgumentsText "foo\nbar EOF") flags ]
it "heredoc with redirection to file" $
let file = Text.unlines [ "RUN <<EOF > /file", "foo", "EOF" ]
- flags = def {security = Nothing }
+ flags = def { security = Nothing }
in assertAst file [ Run $ RunArgs (ArgumentsText "foo") flags ]
it "heredoc to program stdin" $
let file = Text.unlines [ "RUN python <<EOF", "print(\"foo\")", "EOF" ]
- flags = def {security = Nothing }
+ flags = def { security = Nothing }
in assertAst file [ Run $ RunArgs (ArgumentsText "python") flags ]
- it "heredoc to program stdin with redirect to file" $
+ it "heredoc to program stdin with redirect to file with '>'" $
let file = Text.unlines [ "RUN python <<EOF > /file", "print(\"foo\")",
"EOF" ]
- flags = def {security = Nothing }
+ flags = def { security = Nothing }
+ in assertAst file [ Run $ RunArgs (ArgumentsText "python") flags ]
+ it "heredoc to program stdin with redirect to file with '>>'" $
+ let file = Text.unlines [ "RUN python <<EOF >> /file", "print(\"foo\")",
"EOF" ]
+ flags = def { security = Nothing }
in assertAst file [ Run $ RunArgs (ArgumentsText "python") flags ]
- it "heredoc with line continuation" $
+ it "heredoc pipe to program" $
+ let file = Text.unlines [ "RUN cat <<EOF | sh", "echo foo", "EOF" ]
+ flags = def { security = Nothing }
+ in assertAst file [ Run $ RunArgs ( ArgumentsText "cat" ) flags ]
+ it "heredoc with line continuation in the heredoc" $
let file = Text.unlines [ "RUN <<EOF", "apt-get update", "apt-get
install foo bar \\", " buzz bar", "EOF" ]
flags = def {security = Nothing }
in assertAst
@@ -572,3 +583,57 @@
)
( def :: CopyFlags )
]
+
+ -- See https://github.com/hadolint/hadolint/issues/923 for the following
+ -- tests
+ it "heredoc in command chain with escaped newlines after redirect" $
+ let file =
+ Text.unlines
+ [ "RUN ls && cat <<EOF >> go.mod && \\",
+ " tac go.mod",
+ "replace (",
+ " github.com/user/repo => ../dir",
+ ")",
+ "EOF"
+ ]
+ flags = def
+
+ in assertAst
+ file
+ [ Run $ RunArgs ( ArgumentsText "ls && cat" ) flags
+ ]
+
+ it "heredoc in command chain with escaped newlines before heredoc" $
+ let file =
+ Text.unlines
+ [ "RUN ls && \\",
+ " cat <<EOF >> go.mod && tac go.mod",
+ "replace (",
+ " github.com/user/repo => ../dir",
+ ")",
+ "EOF"
+ ]
+ flags = def
+
+ in assertAst
+ file
+ [ Run $ RunArgs ( ArgumentsText "ls && cat" ) flags
+ ]
+
+ it "heredoc in command chain with escaped newlines before and after
heredoc" $
+ let file =
+ Text.unlines
+ [ "RUN ls && \\",
+ " cat <<EOF >> go.mod && \\",
+ " tac go.mod",
+ "replace (",
+ " github.com/user/repo => ../dir",
+ ")",
+ "EOF"
+ ]
+ flags = def
+
+ in assertAst
+ file
+ [ Run $ RunArgs ( ArgumentsText "ls && cat" ) flags
+ ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/ParserSpec.hs
new/language-docker-13.0.0/test/Language/Docker/ParserSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/ParserSpec.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/test/Language/Docker/ParserSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -174,54 +174,6 @@
describe "parse SHELL" $
it "quoted shell params" $
assertAst "SHELL [\"/bin/bash\", \"-c\"]" [Shell ["/bin/bash", "-c"]]
- describe "parse HEALTHCHECK" $ do
- it "parse healthcheck with interval" $
- assertAst
- "HEALTHCHECK --interval=5m \\\nCMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs "curl -f http://localhost/" (Just 300) Nothing Nothing
Nothing
- ]
- it "parse healthcheck with retries" $
- assertAst
- "HEALTHCHECK --retries=10 CMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing
(Just $ Retries 10)
- ]
- it "parse healthcheck with timeout" $
- assertAst
- "HEALTHCHECK --timeout=10s CMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs "curl -f http://localhost/" Nothing (Just 10) Nothing
Nothing
- ]
- it "parse healthcheck with start-period" $
- assertAst
- "HEALTHCHECK --start-period=2m CMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs "curl -f http://localhost/" Nothing Nothing (Just 120)
Nothing
- ]
- it "parse healthcheck with all flags" $
- assertAst
- "HEALTHCHECK --start-period=2s --timeout=1m --retries=3 --interval=5s
CMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs
- "curl -f http://localhost/"
- (Just 5)
- (Just 60)
- (Just 2)
- (Just $ Retries 3)
- ]
- it "parse healthcheck with no flags" $
- assertAst
- "HEALTHCHECK CMD curl -f http://localhost/"
- [ Healthcheck $
- Check $
- CheckArgs "curl -f http://localhost/" Nothing Nothing Nothing
Nothing
- ]
describe "parse MAINTAINER" $ do
it "maintainer of untagged scratch image" $
assertAst
@@ -289,48 +241,6 @@
Comment " This is a comment",
Run "echo hello"
]
- describe "expose" $ do
- it "should handle number ports" $
- let content = "EXPOSE 8080"
- in assertAst content [Expose (Ports [Port 8080 TCP])]
- it "should handle many number ports" $
- let content = "EXPOSE 8080 8081"
- in assertAst content [Expose (Ports [Port 8080 TCP, Port 8081 TCP])]
- it "should handle ports with protocol" $
- let content = "EXPOSE 8080/TCP 8081/UDP"
- in assertAst content [Expose (Ports [Port 8080 TCP, Port 8081 UDP])]
- it "should handle ports with protocol and variables" $
- let content = "EXPOSE $PORT 8080 8081/UDP"
- in assertAst content [Expose (Ports [PortStr "$PORT", Port 8080 TCP,
Port 8081 UDP])]
- it "should handle port ranges" $
- let content = "EXPOSE 80 81 8080-8085"
- in assertAst content [Expose (Ports [Port 80 TCP, Port 81 TCP,
PortRange 8080 8085 TCP])]
- it "should handle udp port ranges" $
- let content = "EXPOSE 80 81 8080-8085/udp"
- in assertAst content [Expose (Ports [Port 80 TCP, Port 81 TCP,
PortRange 8080 8085 UDP])]
- it "should handle multiline variables" $
- let content =
- "EXPOSE ${PORT} ${PORT_SSL} \\\n\
- \ ${PORT_HTTP} ${PORT_HTTPS} \\\n\
- \ ${PORT_REP} \\\n\
- \ ${PORT_ADMIN} ${PORT_ADMIN_HTTP}"
- in assertAst
- content
- [ Expose
- ( Ports
- [ PortStr "${PORT}",
- PortStr "${PORT_SSL}",
- PortStr "${PORT_HTTP}",
- PortStr "${PORT_HTTPS}",
- PortStr "${PORT_REP}",
- PortStr "${PORT_ADMIN}",
- PortStr "${PORT_ADMIN_HTTP}"
- ]
- )
- ]
- it "should fail with wrong protocol" $
- let content = "EXPOSE 80/ip"
- in expectFail content
describe "syntax" $ do
it "should handle lowercase instructions (#7 -
https://github.com/beijaflor-io/haskell-language-dockerfile/issues/7)" $
let content = "from ubuntu"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/language-docker-11.0.0/test/Language/Docker/PrettyPrintSpec.hs
new/language-docker-13.0.0/test/Language/Docker/PrettyPrintSpec.hs
--- old/language-docker-11.0.0/test/Language/Docker/PrettyPrintSpec.hs
2022-04-04 16:27:46.000000000 +0200
+++ new/language-docker-13.0.0/test/Language/Docker/PrettyPrintSpec.hs
2001-09-09 03:46:40.000000000 +0200
@@ -21,25 +21,30 @@
( AddArgs [SourcePath "foo"] (TargetPath "bar") )
( def :: AddFlags )
in assertPretty "ADD foo bar" add
+ it "with just checksum" $ do
+ let add = Add
+ ( AddArgs [SourcePath "http://www.example.com/foo"]
(TargetPath "bar") )
+ ( AddFlags ( Checksum "sha256:24454f830cdd" ) NoChown
NoChmod NoLink )
+ in assertPretty "ADD --checksum=sha256:24454f830cdd
http://www.example.com/foo bar" add
it "with just chown" $ do
let add = Add
( AddArgs [SourcePath "foo"] (TargetPath "bar") )
- ( AddFlags ( Chown "root:root" ) NoChmod NoLink )
+ ( AddFlags NoChecksum ( Chown "root:root" ) NoChmod NoLink )
in assertPretty "ADD --chown=root:root foo bar" add
it "with just chmod" $ do
let add = Add
( AddArgs [SourcePath "foo"] (TargetPath "bar") )
- ( AddFlags NoChown ( Chmod "751" ) NoLink )
+ ( AddFlags NoChecksum NoChown ( Chmod "751" ) NoLink )
in assertPretty "ADD --chmod=751 foo bar" add
it "with just link" $ do
let add = Add
( AddArgs [SourcePath "foo"] (TargetPath "bar") )
- ( AddFlags NoChown NoChmod Link )
+ ( AddFlags NoChecksum NoChown NoChmod Link )
in assertPretty "ADD --link foo bar" add
it "with chown, chmod and link" $ do
let add = Add
( AddArgs [SourcePath "foo"] (TargetPath "bar") )
- ( AddFlags ( Chown "root:root" ) ( Chmod "751" ) Link )
+ ( AddFlags NoChecksum ( Chown "root:root" ) ( Chmod "751" )
Link )
in assertPretty "ADD --chown=root:root --chmod=751 --link foo bar" add
describe "pretty print COPY" $ do