Portage/Dependency.hs: simplify datastructure holding dependency ranges

- Removed most of horrible simplification code I wrote long ago :]
- Tuned prettyprinter to print-out better nested USE flags.
  Now generates less newlines
- Added basic prettyprinter test
  Now it thoroughly tests cases for empty depends

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: added comparison against nonstrict bounds

    Writing live-sequencer-0.0.4.ebuild
    hackport: i am too lazy to implement LBound:compare
    NonstrictLB (Version {versionNumber = [0,2,1], versionChar = Nothing, versionSuffix = [], versionRevision = 0})
    NonstrictLB (Version {versionNumber = [0,2], versionChar = Nothing, versionSuffix = [], versionRevision = 0})

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: added basic simplification passes

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: convert 'simplify_deps' to no-op

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Cabal2Ebuild.hs: fix error when converting "mtl ==2.0.* || >=2.1.1 && <2.2" depends

Before the patch agda-2.3.2.1.ebuild had:
    || ( >=dev-haskell/mtl-2.0:=[profile?] <dev-haskell/mtl-2.1:=[profile?] >=dev-haskell/mtl-2.1.1:=[profile?] <dev-haskell/mtl-2.2:=[profile?] )
After patch:
    || ( ( >=dev-haskell/mtl-2.0:=[profile?] <dev-haskell/mtl-2.1:=[profile?] )
         ( >=dev-haskell/mtl-2.1.1:=[profile?] <dev-haskell/mtl-2.2:=[profile?] ) )

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Revert "Portage/Dependency.hs: convert 'simplify_deps' to no-op"

This reverts commit 9b758735f3598db946fbb739be4c9e3db65d8a9c.

As duplicates pop-up. Better tune normalize_depend firt and then
get rid of this.
Portage/Dependency.hs: add 'remove_duplicates' pass to remove simplest redundancy

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Merge/Dependencies.hs: fix broken 'cabalDependency' guesser

Before the fix 'cabalDependency' returned exact ~version of
cabal shipped with GHC, while it was intended to return
>=version.

Our reimplementation of simplifier exposed that bug.

Reported-by: Alexander Vershilov <alexander.vershilov@gmail.com>
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Merge.hs: cleanup: used 'let' match instead 'toList' / 'fromList' round-trip

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Merge.hs: once again drop shipped and circular depends on themselves

Was broken after USE flag support switch.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
cleanup: convert 'convertDependency' return type from '[Dependency]' to 'Dependency'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: moved type definitions to 'Portage/Dependency/Types.hs'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: move 'normalize_depend' to 'Portage/Dependency/Normalize.hs'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: move simple helpers for depend creation to 'Portage/Dependency/Builder.hs'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency.hs: move stringifiers to 'Portage/Dependency/Print.hs'

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
hackport.cabal: enable '-Wall' for all targets

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Portage/Dependency/Print.hs: added 'dep2str_denorm' to show depends as-is (without normalization)

Useful for debugging simplification passes.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
tests/print_deps.hs: unmess 'actual' / 'expected' once again

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
tests/print_deps.hs: added pretty-printing for denorm case

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
tests/RunTests.hs: cleanup: added top-level signatures

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>