Hello community, here is the log from the commit of package ghc-path for openSUSE:Factory checked in at 2017-02-21 13:45:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-path (Old) and /work/SRC/openSUSE:Factory/.ghc-path.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-path" Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-path/ghc-path.changes 2017-01-12 15:51:00.984346671 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-path.new/ghc-path.changes 2017-02-21 13:45:50.242481191 +0100 @@ -1,0 +2,5 @@ +Sun Feb 5 19:32:35 UTC 2017 - psim...@suse.com + +- Update to version 0.5.12 with cabal2obs. + +------------------------------------------------------------------- Old: ---- path-0.5.11.tar.gz path.cabal New: ---- path-0.5.12.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-path.spec ++++++ --- /var/tmp/diff_new_pack.vxJARy/_old 2017-02-21 13:45:51.062365524 +0100 +++ /var/tmp/diff_new_pack.vxJARy/_new 2017-02-21 13:45:51.066364960 +0100 @@ -1,7 +1,7 @@ # # spec file for package ghc-path # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,19 +19,19 @@ %global pkg_name path %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.5.11 +Version: 0.5.12 Release: 0 Summary: Support for well-typed paths License: BSD-3-Clause Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-aeson-devel BuildRequires: ghc-deepseq-devel BuildRequires: ghc-exceptions-devel BuildRequires: ghc-filepath-devel +BuildRequires: ghc-hashable-devel BuildRequires: ghc-rpm-macros BuildRequires: ghc-template-haskell-devel BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -39,11 +39,8 @@ BuildRequires: ghc-HUnit-devel BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-bytestring-devel -BuildRequires: ghc-genvalidity-devel -BuildRequires: ghc-genvalidity-hspec-devel BuildRequires: ghc-hspec-devel BuildRequires: ghc-mtl-devel -BuildRequires: ghc-validity-devel %endif %description @@ -62,7 +59,6 @@ %prep %setup -q -n %{pkg_name}-%{version} -cp -p %{SOURCE1} %{pkg_name}.cabal %build %ghc_lib_build @@ -85,5 +81,6 @@ %files devel -f %{name}-devel.files %defattr(-,root,root,-) +%doc CHANGELOG README.md %changelog ++++++ path-0.5.11.tar.gz -> path-0.5.12.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/path-0.5.11/path.cabal new/path-0.5.12/path.cabal --- old/path-0.5.11/path.cabal 2016-12-06 13:53:46.000000000 +0100 +++ new/path-0.5.12/path.cabal 2017-01-30 11:06:13.000000000 +0100 @@ -1,5 +1,5 @@ name: path -version: 0.5.11 +version: 0.5.12 synopsis: Support for well-typed paths description: Support for well-typed paths. license: BSD3 @@ -12,6 +12,11 @@ cabal-version: >=1.8 extra-source-files: README.md, CHANGELOG +flag validity + manual: True + default: False + description: Enable validity tests. + library hs-source-dirs: src/ ghc-options: -Wall -O2 @@ -22,11 +27,11 @@ , template-haskell , deepseq , aeson + , hashable >= 1.2 && < 1.3 test-suite test type: exitcode-stdio-1.0 main-is: Main.hs - other-modules: Path.Gen hs-source-dirs: test build-depends: HUnit , QuickCheck @@ -34,12 +39,30 @@ , base , bytestring , filepath - , genvalidity - , genvalidity-hspec , hspec , mtl , path - , validity + +test-suite validity-test + if !flag(validity) + buildable: False + type: exitcode-stdio-1.0 + main-is: ValidityTest.hs + other-modules: Path.Gen + hs-source-dirs: test + if flag(validity) + build-depends: HUnit + , QuickCheck + , aeson + , base >= 4.9 && < 5 + , bytestring + , filepath + , genvalidity >= 0.3 && < 0.4 + , genvalidity-hspec >= 0.3 && < 0.4 + , hspec + , mtl + , path + , validity >= 0.3.1.1 && < 0.4 source-repository head type: git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/path-0.5.11/src/Path/Internal.hs new/path-0.5.12/src/Path/Internal.hs --- old/path-0.5.11/src/Path/Internal.hs 2016-12-06 12:45:35.000000000 +0100 +++ new/path-0.5.12/src/Path/Internal.hs 2017-01-30 10:51:38.000000000 +0100 @@ -1,4 +1,4 @@ -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} -- | Internal types and functions. @@ -10,6 +10,7 @@ import Control.DeepSeq (NFData (..)) import Data.Aeson (ToJSON (..)) import Data.Data +import Data.Hashable -- | Path of some base and type. -- @@ -57,3 +58,6 @@ toEncoding (Path x) = toEncoding x {-# INLINE toEncoding #-} #endif + +instance Hashable (Path b t) where + hashWithSalt n (Path path) = hashWithSalt n path diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/path-0.5.11/test/Main.hs new/path-0.5.12/test/Main.hs --- old/path-0.5.11/test/Main.hs 2016-12-06 13:34:29.000000000 +0100 +++ new/path-0.5.12/test/Main.hs 2017-01-30 10:57:37.000000000 +0100 @@ -1,4 +1,5 @@ {-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE ScopedTypeVariables #-} -- | Test suite. @@ -12,9 +13,7 @@ import Path import Path.Internal import Test.Hspec -import Test.Validity - -import Path.Gen () +import Test.QuickCheck -- | Test suite entry point, returns exit failure if any test fails. main :: IO () @@ -32,6 +31,7 @@ describe "Operations: isParentOf" operationIsParentOf describe "Operations: parent" operationParent describe "Operations: filename" operationFilename + describe "Operations: dirname" operationDirname describe "Restrictions" restrictions describe "Aeson Instances" aesonInstances @@ -50,32 +50,44 @@ parseFails "/.." parseFails "/foo/../bar/" parseFails "/foo/bar/.." + parseFailsPending "/hello/\n/world" + parseFailsPending "white/\r/space" where parseFails x = it (show x ++ " should be rejected") (isNothing (void (parseAbsDir x) <|> void (parseRelDir x) <|> void (parseAbsFile x) <|> void (parseRelFile x))) + parseFailsPending x = + it (show x ++ " should be rejected") + pending parseSucceeds x with = parserTest parseRelDir x (Just with) +-- | The 'dirname' operation. +operationDirname :: Spec +operationDirname = do + it + "dirname ($(mkAbsDir parent) </> $(mkRelFile dirname)) == dirname $(mkRelFile dirname) (unit test)" + (dirname ($(mkAbsDir "/home/chris/") </> $(mkRelDir "bar")) == + dirname $(mkRelDir "bar")) + it + "dirname ($(mkRelDir parent) </> $(mkRelFile dirname)) == dirname $(mkRelFile dirname) (unit test)" + (dirname ($(mkRelDir "home/chris/") </> $(mkRelDir "bar")) == + dirname $(mkRelDir "bar")) + -- | The 'filename' operation. operationFilename :: Spec operationFilename = - do it "filename ($(mkAbsDir parent) </> filename $(mkRelFile filename)) == $(mkRelFile filename)" - (filename ($(mkAbsDir "/home/chris/") </> - filename $(mkRelFile "bar.txt")) == - $(mkRelFile "bar.txt")) - it "filename ($(mkRelDir parent) </> filename $(mkRelFile filename)) == $(mkRelFile filename)" - (filename ($(mkRelDir "home/chris/") </> - filename $(mkRelFile "bar.txt")) == - $(mkRelFile "bar.txt")) - - it "produces a valid path on when passed a valid absolute path" $ do - producesValidsOnValids (filename :: Path Abs File -> Path Rel File) - - it "produces a valid path on when passed a valid relative path" $ do - producesValidsOnValids (filename :: Path Rel File -> Path Rel File) + do it "filename ($(mkAbsDir parent) </> $(mkRelFile filename)) == filename $(mkRelFile filename) (unit test)" + (filename ($(mkAbsDir "/home/chris/") </> + $(mkRelFile "bar.txt")) == + filename $(mkRelFile "bar.txt")) + + it "filename ($(mkRelDir parent) </> $(mkRelFile filename)) == filename $(mkRelFile filename) (unit test)" + (filename ($(mkRelDir "home/chris/") </> + $(mkRelFile "bar.txt")) == + filename $(mkRelFile "bar.txt")) -- | The 'parent' operation. operationParent :: Spec @@ -91,21 +103,16 @@ (parent (parent $(mkAbsDir "/")) == $(mkAbsDir "/")) - it "produces a valid path on when passed a valid file path" $ do - producesValidsOnValids (parent :: Path Abs File -> Path Abs Dir) - - it "produces a valid path on when passed a valid directory path" $ do - producesValidsOnValids (parent :: Path Abs Dir -> Path Abs Dir) - -- | The 'isParentOf' operation. operationIsParentOf :: Spec operationIsParentOf = - do it "isParentOf parent (parent </> child)" + do it "isParentOf parent (parent </> child) (unit test)" (isParentOf $(mkAbsDir "///bar/") ($(mkAbsDir "///bar/") </> $(mkRelFile "bar/foo.txt"))) - it "isParentOf parent (parent </> child)" + + it "isParentOf parent (parent </> child) (unit test)" (isParentOf $(mkRelDir "bar/") ($(mkRelDir "bar/") </> @@ -114,33 +121,23 @@ -- | The 'stripDir' operation. operationStripDir :: Spec operationStripDir = - do it "stripDir parent (parent </> child) = child" + do it "stripDir parent (parent </> child) = child (unit test)" (stripDir $(mkAbsDir "///bar/") ($(mkAbsDir "///bar/") </> $(mkRelFile "bar/foo.txt")) == Just $(mkRelFile "bar/foo.txt")) - it "stripDir parent (parent </> child) = child" + + it "stripDir parent (parent </> child) = child (unit test)" (stripDir $(mkRelDir "bar/") ($(mkRelDir "bar/") </> $(mkRelFile "bob/foo.txt")) == Just $(mkRelFile "bob/foo.txt")) + it "stripDir parent parent = _|_" (stripDir $(mkAbsDir "/home/chris/foo") $(mkAbsDir "/home/chris/foo") == Nothing) - it "produces a valid path on when passed a valid absolute file paths" $ do - producesValidsOnValids2 (stripDir :: Path Abs Dir -> Path Abs File -> Maybe (Path Rel File)) - - it "produces a valid path on when passed a valid absolute directory paths" $ do - producesValidsOnValids2 (stripDir :: Path Abs Dir -> Path Abs Dir -> Maybe (Path Rel Dir)) - - it "produces a valid path on when passed a valid relative file paths" $ do - producesValidsOnValids2 (stripDir :: Path Rel Dir -> Path Rel File -> Maybe (Path Rel File)) - - it "produces a valid path on when passed a valid relative directory paths" $ do - producesValidsOnValids2 (stripDir :: Path Rel Dir -> Path Rel Dir -> Maybe (Path Rel Dir)) - -- | The '</>' operation. operationAppend :: Spec operationAppend = @@ -161,18 +158,6 @@ $(mkRelFile "chris/test.txt") == $(mkRelFile "home/chris/test.txt")) - it "produces a valid path on when creating valid absolute file paths" $ do - producesValidsOnValids2 ((</>) :: Path Abs Dir -> Path Rel File -> Path Abs File) - - it "produces a valid path on when creating valid absolute directory paths" $ do - producesValidsOnValids2 ((</>) :: Path Abs Dir -> Path Rel Dir -> Path Abs Dir) - - it "produces a valid path on when creating valid relative file paths" $ do - producesValidsOnValids2 ((</>) :: Path Rel Dir -> Path Rel File -> Path Rel File) - - it "produces a valid path on when creating valid relative directory paths" $ do - producesValidsOnValids2 ((</>) :: Path Rel Dir -> Path Rel Dir -> Path Rel Dir) - -- | Tests for the tokenizer. parseAbsDirSpec :: Spec parseAbsDirSpec = @@ -185,9 +170,6 @@ succeeding "///foo//bar////mu" (Path "/foo/bar/mu/") succeeding "///foo//bar/.//mu" (Path "/foo/bar/mu/") - it "Produces valid paths when it succeeds" $ - validIfSucceedsOnArbitrary - (parseAbsDir :: FilePath -> Maybe (Path Abs Dir)) where failing x = parserTest parseAbsDir x Nothing succeeding x with = parserTest parseAbsDir x (Just with) @@ -214,9 +196,6 @@ succeeding "foo//bar////mu" (Path "foo/bar/mu/") succeeding "foo//bar/.//mu" (Path "foo/bar/mu/") - it "Produces valid paths when it succeeds" $ - validIfSucceedsOnArbitrary - (parseRelDir :: FilePath -> Maybe (Path Rel Dir)) where failing x = parserTest parseRelDir x Nothing succeeding x with = parserTest parseRelDir x (Just with) @@ -237,9 +216,6 @@ succeeding "///foo//bar////mu.txt" (Path "/foo/bar/mu.txt") succeeding "///foo//bar/.//mu.txt" (Path "/foo/bar/mu.txt") - it "Produces valid paths when it succeeds" $ - validIfSucceedsOnArbitrary - (parseAbsFile :: FilePath -> Maybe (Path Abs File)) where failing x = parserTest parseAbsFile x Nothing succeeding x with = parserTest parseAbsFile x (Just with) @@ -270,9 +246,6 @@ succeeding "foo//bar////mu.txt" (Path "foo/bar/mu.txt") succeeding "foo//bar/.//mu.txt" (Path "foo/bar/mu.txt") - it "Produces valid paths when it succeeds" $ - validIfSucceedsOnArbitrary - (parseRelFile :: FilePath -> Maybe (Path Rel File)) where failing x = parserTest parseRelFile x Nothing succeeding x with = parserTest parseRelFile x (Just with) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/path-0.5.11/test/Path/Gen.hs new/path-0.5.12/test/Path/Gen.hs --- old/path-0.5.11/test/Path/Gen.hs 2016-12-06 13:34:29.000000000 +0100 +++ new/path-0.5.12/test/Path/Gen.hs 2017-01-30 10:51:38.000000000 +0100 @@ -19,6 +19,7 @@ && not (FilePath.hasTrailingPathSeparator fp) && FilePath.isValid fp && not (".." `isInfixOf` fp) + && not (containsLineBreaks fp) && (parseAbsFile fp == Just p) instance Validity (Path Rel File) where @@ -29,6 +30,7 @@ && fp /= "." && fp /= ".." && not (".." `isInfixOf` fp) + && not (containsLineBreaks fp) && (parseRelFile fp == Just p) instance Validity (Path Abs Dir) where @@ -37,6 +39,7 @@ && FilePath.hasTrailingPathSeparator fp && FilePath.isValid fp && not (".." `isInfixOf` fp) + && not (containsLineBreaks fp) && (parseAbsDir fp == Just p) instance Validity (Path Rel Dir) where @@ -48,19 +51,30 @@ && fp /= "." && fp /= ".." && not (".." `isInfixOf` fp) + && not (containsLineBreaks fp) && (parseRelDir fp == Just p) +containsLineBreaks :: String -> Bool +containsLineBreaks s = any (`elem` s) "\n\r" -instance GenValidity (Path Abs File) where +instance GenUnchecked (Path Abs File) where genUnchecked = Path <$> arbitrary -instance GenValidity (Path Rel File) where +instance GenValid (Path Abs File) + +instance GenUnchecked (Path Rel File) where genUnchecked = Path <$> arbitrary -instance GenValidity (Path Abs Dir) where +instance GenValid (Path Rel File) + +instance GenUnchecked (Path Abs Dir) where genUnchecked = Path <$> arbitrary -instance GenValidity (Path Rel Dir) where +instance GenValid (Path Abs Dir) + +instance GenUnchecked (Path Rel Dir) where genUnchecked = Path <$> arbitrary +instance GenValid (Path Rel Dir) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/path-0.5.11/test/ValidityTest.hs new/path-0.5.12/test/ValidityTest.hs --- old/path-0.5.11/test/ValidityTest.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/path-0.5.12/test/ValidityTest.hs 2017-01-30 10:51:38.000000000 +0100 @@ -0,0 +1,163 @@ +{-# LANGUAGE TypeApplications #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE ScopedTypeVariables #-} + +-- | Test suite. + +module Main where + +import Control.Applicative +import Control.Monad +import Data.Aeson +import qualified Data.ByteString.Lazy.Char8 as LBS +import Data.Maybe +import Path +import Path.Internal +import Test.Hspec +import Test.QuickCheck +import Test.Validity + +import Path.Gen () + +-- | Test suite entry point, returns exit failure if any test fails. +main :: IO () +main = hspec spec + +-- | Test suite. +spec :: Spec +spec = do + describe "Parsing: Path Abs Dir" parseAbsDirSpec + describe "Parsing: Path Rel Dir" parseRelDirSpec + describe "Parsing: Path Abs File" parseAbsFileSpec + describe "Parsing: Path Rel File" parseRelFileSpec + describe "Operations: (</>)" operationAppend + describe "Operations: stripDir" operationStripDir + describe "Operations: isParentOf" operationIsParentOf + describe "Operations: parent" operationParent + describe "Operations: filename" operationFilename + +-- | The 'filename' operation. +operationFilename :: Spec +operationFilename = do + it "filename ($(mkAbsDir parent) </> $(mkRelFile filename)) == filename $(mkRelFile filename)" $ + forAll genValid $ \(parent :: Path Abs Dir) -> + forAll genValid $ \file -> + filename (parent </> file) `shouldBe` filename file + + it "filename ($(mkRelDir parent) </> $(mkRelFile filename)) == filename $(mkRelFile filename)" $ + forAll genValid $ \(parent :: Path Rel Dir) -> + forAll genValid $ \file -> + filename (parent </> file) `shouldBe` filename file + + it "produces a valid path on when passed a valid absolute path" $ do + producesValidsOnValids (filename @Abs) + + it "produces a valid path on when passed a valid relative path" $ do + producesValidsOnValids (filename @Rel) + +-- | The 'parent' operation. +operationParent :: Spec +operationParent = do + it "produces a valid path on when passed a valid file path" $ do + producesValidsOnValids (parent @File) + + it "produces a valid path on when passed a valid directory path" $ do + producesValidsOnValids (parent @Dir) + +-- | The 'isParentOf' operation. +operationIsParentOf :: Spec +operationIsParentOf = do + it "isParentOf parent (parent </> child)" $ + forAll genValid $ \(parent :: Path Abs Dir) -> + forAll genValid $ \(child :: Path Rel File) -> + isParentOf parent (parent </> child) + + it "isParentOf parent (parent </> child)" $ + forAll genValid $ \(parent :: Path Abs Dir) -> + forAll genValid $ \(child :: Path Rel Dir) -> + isParentOf parent (parent </> child) + + it "isParentOf parent (parent </> child)" $ + forAll genValid $ \(parent :: Path Rel Dir) -> + forAll genValid $ \(child :: Path Rel File) -> + isParentOf parent (parent </> child) + + it "isParentOf parent (parent </> child)" $ + forAll genValid $ \(parent :: Path Rel Dir) -> + forAll genValid $ \(child :: Path Rel Dir) -> + isParentOf parent (parent </> child) + +-- | The 'stripDir' operation. +operationStripDir :: Spec +operationStripDir = do + it "stripDir parent (parent </> child) = child" $ + forAll genValid $ \(parent :: Path Abs Dir) -> + forAll genValid $ \(child :: Path Rel File) -> + stripDir parent (parent </> child) == Just child + + it "stripDir parent (parent </> child) = child" $ + forAll genValid $ \(parent :: Path Rel Dir) -> + forAll genValid $ \(child :: Path Rel File) -> + stripDir parent (parent </> child) == Just child + + it "stripDir parent (parent </> child) = child" $ + forAll genValid $ \(parent :: Path Abs Dir) -> + forAll genValid $ \(child :: Path Rel Dir) -> + stripDir parent (parent </> child) == Just child + + it "stripDir parent (parent </> child) = child" $ + forAll genValid $ \(parent :: Path Rel Dir) -> + forAll genValid $ \(child :: Path Rel Dir) -> + stripDir parent (parent </> child) == Just child + + it "produces a valid path on when passed a valid absolute file paths" $ do + producesValidsOnValids2 (stripDir @Maybe @Abs @File) + + it "produces a valid path on when passed a valid absolute directory paths" $ do + producesValidsOnValids2 (stripDir @Maybe @Abs @Dir) + + it "produces a valid path on when passed a valid relative file paths" $ do + producesValidsOnValids2 (stripDir @Maybe @Rel @File) + + it "produces a valid path on when passed a valid relative directory paths" $ do + producesValidsOnValids2 (stripDir @Maybe @Rel @Dir) + +-- | The '</>' operation. +operationAppend :: Spec +operationAppend = do + it "produces a valid path on when creating valid absolute file paths" $ do + producesValidsOnValids2 ((</>) @Abs @File) + + it "produces a valid path on when creating valid absolute directory paths" $ do + producesValidsOnValids2 ((</>) @Abs @Dir) + + it "produces a valid path on when creating valid relative file paths" $ do + producesValidsOnValids2 ((</>) @Rel @File) + + it "produces a valid path on when creating valid relative directory paths" $ do + producesValidsOnValids2 ((</>) @Rel @Dir) + + +parseAbsDirSpec :: Spec +parseAbsDirSpec = do + it "Produces valid paths when it succeeds" $ + validIfSucceedsOnArbitrary + (parseAbsDir @Maybe) + +parseRelDirSpec :: Spec +parseRelDirSpec = do + it "Produces valid paths when it succeeds" $ + validIfSucceedsOnArbitrary + (parseRelDir @Maybe) + +parseAbsFileSpec :: Spec +parseAbsFileSpec = do + it "Produces valid paths when it succeeds" $ + validIfSucceedsOnArbitrary + (parseAbsFile @Maybe) + +parseRelFileSpec :: Spec +parseRelFileSpec = do + it "Produces valid paths when it succeeds" $ + validIfSucceedsOnArbitrary + (parseRelFile @Maybe) \ No newline at end of file