Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2021 05:41:17 GMT
From:      Gleb Popov <arrowd@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: f4397f5de040 - main - Uses/cabal.mk: Improve cabal-extract for USE_GITHUB/USE_GITLAB cases.
Message-ID:  <202104290541.13T5fHRP056472@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by arrowd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f4397f5de0408abed022dca95ac78ba27686a205

commit f4397f5de0408abed022dca95ac78ba27686a205
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2021-04-27 18:47:40 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2021-04-29 05:39:22 +0000

    Uses/cabal.mk: Improve cabal-extract for USE_GITHUB/USE_GITLAB cases.
    
    The `cabal-extract` is an auxiliary target that is intended to be run
    interactively by the port developer. It populates Cabal cache and then tries
    to fetch the main distribution file from Hackage package database. However,
    some packages reside on GitHub and other hostings, in which case this target
    fails. This commit modifies the target in such way that it does the usual
    `make extract`, but preserves the Cabal cache.
    
    Differential Revision: https://reviews.freebsd.org/D30014
---
 Mk/Uses/cabal.mk | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk
index 45ee43883ef6..ee632acd1f79 100644
--- a/Mk/Uses/cabal.mk
+++ b/Mk/Uses/cabal.mk
@@ -76,6 +76,12 @@ LIB_DEPENDS+=	libgmp.so:math/gmp \
 DIST_SUBDIR?=	cabal
 
 .  if !defined(USE_GITHUB) && !defined(USE_GITLAB) && !${cabal_ARGS:Mnodefault}
+_hackage_is_default=	yes
+.  else
+_hackage_is_default=	no
+.  endif
+
+.  if ${_hackage_is_default} == yes
 MASTER_SITES=	https://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/ \
 		http://hackage.haskell.org/package/${PORTNAME}-${PORTVERSION}/
 DISTFILES+=	${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
@@ -125,8 +131,15 @@ DISTFILES+=	${package:C/_[0-9]+//}/revision/${package:C/[^_]*//:S/_//}.cabal:${p
 cabal-extract: ${WRKDIR}
 	${RM} -rf ${CABAL_HOME}/.cabal
 	${SETENV} HOME=${CABAL_HOME} cabal new-update
+.  if ${_hackage_is_default} == yes
 	cd ${WRKDIR} && \
 		${SETENV} ${LOCALE_ENV} HOME=${CABAL_HOME} cabal get ${PORTNAME}-${PORTVERSION}
+.  else
+	${MV} ${CABAL_HOME} /tmp/${PORTNAME}-cabal-home
+	cd ${.CURDIR} && ${MAKE} extract CABAL_BOOTSTRAP=yes
+	${RM} -rf ${CABAL_HOME}
+	${MV} /tmp/${PORTNAME}-cabal-home ${CABAL_HOME}
+.  endif
 
 # Fetches and unpacks dependencies sources for a cabal-extract'ed package.
 # Builds them as side-effect.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104290541.13T5fHRP056472>