Bug 244784

Summary: Mk/Uses/cabal.mk: GitHub-based Haskell ports list the main tarball twice in distinfo
Product: Ports & Packages Reporter: Yuri Victorovich <yuri>
Component: Ports FrameworkAssignee: freebsd-haskell (Nobody) <haskell>
Status: Closed FIXED    
Severity: Affects Only Me CC: arrowd, ports-bugs
Priority: --- Keywords: needs-patch, needs-qa
Version: LatestFlags: koobs: merge-quarterly?
Hardware: Any   
OS: Any   

Description Yuri Victorovich freebsd_committer freebsd_triage 2020-03-13 06:36:51 UTC
Testcase: math/hs-penrose

> $ grep penrose distinfo 
> SHA256 (cabal/penrose-0.1.737.tar.gz) = 83caeed913b229b12c23d9de594ec09c7041e9481ec6de66759b4e6ca725846f
> SIZE (cabal/penrose-0.1.737.tar.gz) = 37014128
> SHA256 (cabal/penrose-penrose-v0.1-737-gb336c8d_GH0.tar.gz) = 36bba91fdca6a44edbe5bb06a90876763e4721409532a34761fcc4d6e86e3bb4
> SIZE (cabal/penrose-penrose-v0.1-737-gb336c8d_GH0.tar.gz) = 16580608
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2020-03-13 08:27:00 UTC
For now I workaround this by adding

MASTER_SITES=
DISTFILES=
EXTRACT_ONLY=${DISTNAME}${EXTRACT_SUFX}

Any ideas how to deal with this properly?
Comment 2 Gleb Popov freebsd_committer freebsd_triage 2020-03-24 16:30:27 UTC
Here is my try, but it obviously handles only GitHub and Gitlab:

diff --git Mk/Uses/cabal.mk Mk/Uses/cabal.mk
index 85d2a6a38e66..4e2316b01326 100644
--- Mk/Uses/cabal.mk
+++ Mk/Uses/cabal.mk
@@ -74,10 +74,15 @@ LIB_DEPENDS+=       libgmp.so:math/gmp \
 
 DIST_SUBDIR?=  cabal
 
+.  if !defined(USE_GITHUB) && !defined(USE_GITLAB)
 MASTER_SITES?= https://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/ \
                http://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/
 DISTFILES?=    ${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
 EXTRACT_ONLY?= ${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
+.  endif
+.  elif defined(USE_GITLAB)
+EXTRACT_ONLY?= ${GL_ACCOUNT}-${GL_PROJECT}-${GL_COMMIT}_GL0${EXTRACT_SUFX}
+.  endif
 
 _USES_extract= 701:cabal-post-extract
 _USES_patch=   701:cabal-post-patch
Comment 3 Gleb Popov freebsd_committer freebsd_triage 2020-03-26 17:44:34 UTC
Fixed this in development repo, will commit along with GHC 8.8.3 update.
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-05-04 18:08:19 UTC
A commit references this bug:

Author: arrowd
Date: Mon May  4 18:08:15 UTC 2020
New revision: 533933
URL: https://svnweb.freebsd.org/changeset/ports/533933

Log:
  Upgrade lang/ghc to 8.8.3 and many Haskell ports along the way.

  PR:		244784
  Submitted by:	Evilham <contact@evilham.com> (some ports)

Changes:
  head/Mk/Uses/cabal.mk
  head/UPDATING
  head/converters/hs-aeson-pretty/Makefile
  head/converters/hs-aeson-pretty/distinfo
  head/devel/elm-format/Makefile
  head/devel/elm-format/distinfo
  head/devel/elm-format/files/patch-elm-format.cabal
  head/devel/elm-format/files/patch-markdown_Cheapskate_ParserCombinators.hs
  head/devel/hs-alex/Makefile
  head/devel/hs-alex/distinfo
  head/devel/hs-bytestring-nums/Makefile
  head/devel/hs-c2hs/Makefile
  head/devel/hs-c2hs/distinfo
  head/devel/hs-cabal-install/Makefile
  head/devel/hs-cabal-install/distinfo
  head/devel/hs-cabal-install/files/patch-bootstrap.sh
  head/devel/hs-cabal-install/files/patch-cabal-install.cabal
  head/devel/hs-cpphs/Makefile
  head/devel/hs-cpphs/distinfo
  head/devel/hs-cpphs/files/
  head/devel/hs-cpphs/files/patch-cpphs.cabal
  head/devel/hs-darcs/Makefile
  head/devel/hs-darcs/distinfo
  head/devel/hs-darcs/files/
  head/devel/hs-data-default/Makefile
  head/devel/hs-data-default-class/Makefile
  head/devel/hs-data-default-instances-base/Makefile
  head/devel/hs-data-default-instances-containers/Makefile
  head/devel/hs-data-default-instances-dlist/Makefile
  head/devel/hs-data-default-instances-old-locale/Makefile
  head/devel/hs-dlist/Makefile
  head/devel/hs-extensible-exceptions/Makefile
  head/devel/hs-ghc-events/Makefile
  head/devel/hs-ghc-events/distinfo
  head/devel/hs-ghcprofview/Makefile
  head/devel/hs-ghcprofview/distinfo
  head/devel/hs-git-annex/Makefile
  head/devel/hs-git-annex/distinfo
  head/devel/hs-git-annex/files/patch-Database_ContentIdentifier.hs
  head/devel/hs-git-annex/files/patch-Database_Export.hs
  head/devel/hs-git-annex/files/patch-Database_Fsck.hs
  head/devel/hs-git-annex/files/patch-Database_Keys_SQL.hs
  head/devel/hs-git-annex/files/patch-Utility_Tor.hs
  head/devel/hs-haddock/Makefile
  head/devel/hs-haddock/distinfo
  head/devel/hs-haddock/pkg-plist
  head/devel/hs-happy/Makefile
  head/devel/hs-happy/distinfo
  head/devel/hs-hashable/Makefile
  head/devel/hs-hasktags/Makefile
  head/devel/hs-hasktags/distinfo
  head/devel/hs-hasktags/files/
  head/devel/hs-hasktags/files/patch-hasktags.cabal
  head/devel/hs-hlint/Makefile
  head/devel/hs-hlint/distinfo
  head/devel/hs-hoogle/Makefile
  head/devel/hs-hoogle/distinfo
  head/devel/hs-hpack/Makefile
  head/devel/hs-hpack/distinfo
  head/devel/hs-hspec-discover/Makefile
  head/devel/hs-mtl/Makefile
  head/devel/hs-mueval/Makefile
  head/devel/hs-mueval/distinfo
  head/devel/hs-old-locale/Makefile
  head/devel/hs-old-time/Makefile
  head/devel/hs-profiteur/Makefile
  head/devel/hs-profiteur/distinfo
  head/devel/hs-random/Makefile
  head/devel/hs-setlocale/Makefile
  head/devel/hs-shake/Makefile
  head/devel/hs-shake/distinfo
  head/devel/hs-spago/Makefile
  head/devel/hs-spago/distinfo
  head/devel/hs-spago/files/patch-package.yaml
  head/devel/hs-threadscope/Makefile
  head/devel/hs-threadscope/distinfo
  head/devel/hs-threadscope/files/patch-gtk2hs-buildtools-0.13.5.0_c2hs_toplevel_C2HSConfig.hs
  head/devel/hs-threadscope/files/patch-threadscope.cabal
  head/devel/hs-transformers-compat/Makefile
  head/devel/hs-unordered-containers/Makefile
  head/devel/hs-utf8-string/Makefile
  head/devel/stack/Makefile
  head/devel/stack/distinfo
  head/games/hedgewars-server/Makefile
  head/games/hedgewars-server/distinfo
  head/games/hs-scroll/Makefile
  head/games/hs-scroll/distinfo
  head/lang/elm/Makefile
  head/lang/elm/distinfo
  head/lang/elm/files/
  head/lang/ghc/Makefile
  head/lang/ghc/bsd.cabal.options.mk
  head/lang/ghc/distinfo
  head/lang/ghc/files/patch-ppc64
  head/lang/ghc/files865/
  head/lang/hs-brainfuck/Makefile
  head/lang/hs-unlambda/Makefile
  head/lang/purescript/files/patch-happy-1.19.9_happy.cabal
  head/lang/purescript/files/patch-purescript.cabal
  head/lang/purescript/files/patch-src_Language_PureScript_CST_Parser.y
  head/lang/purescript/files/patch-src_Language_PureScript_CST_Utils.hs
  head/lang/purescript/files/patch-src_Language_PureScript_Docs_Types.hs
  head/lang/purescript/files/patch-src_Language_PureScript_Names.hs
  head/lang/purescript/files/patch-src_Language_PureScript_Publish.hs
  head/math/hs-Agda/Makefile
  head/math/hs-Agda/distinfo
  head/math/hs-Agda/pkg-plist
  head/math/hs-penrose/Makefile
  head/math/hs-penrose/distinfo
  head/math/hs-penrose/files/patch-docopt-0.7.0.5_System_Console_Docopt_Public.hs
  head/math/hs-penrose/files/patch-docopt-0.7.0.5_System_Console_Docopt_QQ.hs
  head/math/hs-semigroups/Makefile
  head/net/hs-network/Makefile
  head/net-im/matterhorn/Makefile
  head/net-im/matterhorn/distinfo
  head/print/hs-hscolour/Makefile
  head/security/hs-cryptol/Makefile
  head/security/hs-cryptol/distinfo
  head/security/hs-cryptol/files/
  head/security/hs-cryptol/files/patch-src_Cryptol_Eval_Monad.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_ModuleSystem_Monad.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_Parser_NoInclude.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_Parser_NoPat.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_Parser_ParserUtils.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_TypeCheck_Monad.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_TypeCheck_Sanity.hs
  head/security/hs-cryptol/files/patch-src_Cryptol_Utils_Patterns.hs
  head/sysutils/hs-cputype/Makefile
  head/sysutils/hs-cputype/distinfo
  head/textproc/cgrep/Makefile
  head/textproc/cgrep/distinfo
  head/textproc/hs-lhs2tex/Makefile
  head/textproc/hs-lhs2tex/distinfo
  head/textproc/hs-pandoc/Makefile
  head/textproc/hs-pandoc/distinfo
  head/textproc/hs-pandoc-citeproc/Makefile
  head/textproc/hs-pandoc-citeproc/distinfo
  head/textproc/hs-pandoc-crossref/Makefile
  head/textproc/hs-pandoc-crossref/distinfo
  head/textproc/hs-yaml/Makefile
  head/textproc/hs-yaml/distinfo
  head/www/hs-DAV/Makefile
  head/www/hs-DAV/distinfo
  head/www/hs-hjsmin/Makefile
  head/www/hs-hjsmin/distinfo
  head/www/hs-wai-app-static/Makefile
  head/www/hs-wai-app-static/distinfo
  head/www/hs-yesod-bin/Makefile
  head/www/hs-yesod-bin/distinfo
  head/www/hs-yesod-bin/files/
  head/x11/conlecterm/Makefile
  head/x11/conlecterm/distinfo
  head/x11/conlecterm/files/
  head/x11/conlecterm/files/patch-gtk2hs-buildtools-0.13.5.0_c2hs_toplevel_C2HSConfig.hs
  head/x11/hs-X11/Makefile
  head/x11/hs-X11-xft/Makefile
  head/x11/hs-xmobar/Makefile
  head/x11/hs-xmobar/distinfo
  head/x11-wm/hs-xmonad/Makefile
  head/x11-wm/hs-xmonad/distinfo
  head/x11-wm/hs-xmonad/files/
  head/x11-wm/hs-xmonad/files/example_buildscript
  head/x11-wm/hs-xmonad/files/example_config.cabal
  head/x11-wm/hs-xmonad/pkg-message
  head/x11-wm/hs-xmonad/pkg-plist
  head/x11-wm/hs-xmonad-contrib/Makefile
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2020-05-04 18:13:42 UTC
Things improved a bit with recent update. As for now, only

EXTRACT_ONLY= ${DISTNAME}${EXTRACT_SUFX}

is required.
Comment 6 Yuri Victorovich freebsd_committer freebsd_triage 2020-05-04 18:19:44 UTC
(In reply to Gleb Popov from comment #5)

Thanks for working on this.
Comment 7 commit-hook freebsd_committer freebsd_triage 2020-12-30 18:58:10 UTC
A commit references this bug:

Author: arrowd
Date: Wed Dec 30 18:57:34 UTC 2020
New revision: 559679
URL: https://svnweb.freebsd.org/changeset/ports/559679

Log:
  Uses/cabal.mk: Set EXTRACT_ONLY based on DISTFILES value, just like bsd.port.mk does.

  This removes the need for specifying EXTRACT_ONLY for Haskell ports that have USE_{GITHUB,GITLAB}.

  PR:		244784

Changes:
  head/Mk/Uses/cabal.mk
  head/devel/elm-format/Makefile
  head/devel/stack/Makefile
  head/lang/elm/Makefile
  head/math/hs-penrose/Makefile
  head/net-im/matterhorn/Makefile
  head/sysutils/hs-cputype/Makefile
  head/x11/conlecterm/Makefile