From nobody Sun Nov 20 17:40:02 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NFd823htGz4hk3Q; Sun, 20 Nov 2022 17:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NFd822rbSz4MdY; Sun, 20 Nov 2022 17:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668966002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PdPDfNNme4ScBSZaOtvnEzX0dqq1PZZVGArmdcvPQvs=; b=BS34MWvJFI+242t0HHi9OkXodchwcJXdQMD6xT7GUTG/JaMq1AHKfVZy2eeeRbbyJCIz+r jpaO7TFHCvjnw0B8/lSXoTkMixXzueg7JRtsJNcDS7nBZw7nCorziXk77sMOl0VHKu4Fg5 sGgQXdwI/fYibkuU3cAU/j3nsjTUZ44rSDsvBTCJeTn2xYP5PxuYN0Zf2nl/E16TD0rAD8 T5jzqz7gi5G+Htm3z61iQcy0NEsrGScTVftvTdI90NNBw5/sLZEOr+T5p4GWC+8j6o2vla Uvmp9V/EBQzlSRvZT5AclA5DpRA4kLpxbn0PFYceTXRzMXgnCfUiuBYP0/RY9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668966002; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=PdPDfNNme4ScBSZaOtvnEzX0dqq1PZZVGArmdcvPQvs=; b=bD1OQG7BPmFvKfb2PWLg2xmseVIMdWn5ZIoTu3aBkYHrRnJDHYzSnAz/PkR2OppCiRjKyu 101Sm31B2UIQ8h9pgwgEi/1Req6s3gWCdAI5YxbvJOYsiuabAxe6RDOzK3r65vvHX2QLQr HuCksHvcjX5glAsWKCCsj4ygbQimXCRP03kWiIQVTKEQ8+x39l1/OU2nfFSMrofh2TRlaI wzfEMBWpeXrIVNW1nkInz6XdE4Yyu8TAxvWDhsn68/oqBQfThbbWTB85nZ67Qk1ErPIyXZ /QK2GfMXWI3bkbX3OlFPV/JmLK3S9hrwQIgY8kkjOXhTSBTIVS7fNx8m5Qe8Sw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668966002; a=rsa-sha256; cv=none; b=JxFI9EEfxxmFrCWYqqnQiPUaMUat48FmUWAn0lZwGZc1I9uu1Om/BT9mcQX6MVqz5E0MPt ENKqXj+wheO22cBXbn85OFp+xaiDh6MLQVIWQwHorxvFmKLaHn79fCnzLtmSCqdVysMOy+ U8n7InXKOHP8cgw3jj/qpURYVZNiEK2ECVVDEQqKp2U5BMPTVIN2Bb+g6TCMH+/m2QuR/z tnERdFo4ACrpiVRVNcX0SmckkvQb8+1OkJpAZSVVH6w51rErNLrnHynmQRZDmcXFA1JMkY VjWig9qtSW8G3vqo8utiVwFiKQC9pfixDiYYNQX1eTZdWrtnFsY1DZYZgMOngQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NFd821fkczXq1; Sun, 20 Nov 2022 17:40:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2AKHe2IS056029; Sun, 20 Nov 2022 17:40:02 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2AKHe2rm056026; Sun, 20 Nov 2022 17:40:02 GMT (envelope-from git) Date: Sun, 20 Nov 2022 17:40:02 GMT Message-Id: <202211201740.2AKHe2rm056026@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Gleb Popov Subject: git: 934c0a2d759f - main - Uses/cabal.mk: Add support for building multi-repository cabal.projects. List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: arrowd X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 934c0a2d759fe09a92739e4ed84e154b6d8e1970 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by arrowd: URL: https://cgit.FreeBSD.org/ports/commit/?id=934c0a2d759fe09a92739e4ed84e154b6d8e1970 commit 934c0a2d759fe09a92739e4ed84e154b6d8e1970 Author: Gleb Popov AuthorDate: 2022-11-20 16:35:05 +0000 Commit: Gleb Popov CommitDate: 2022-11-20 17:39:29 +0000 Uses/cabal.mk: Add support for building multi-repository cabal.projects. To build such projects a port must add the repository to MASTER_SITES under some group and then use this group in USE_CABAL. Cabal2Tuple (ports-mgmt/hs-cabal2tuple) supports this feature starting with version 2.0. Running `make make-use-cabal` will automatically pass necessary flags to it. --- Mk/Uses/cabal.mk | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/Mk/Uses/cabal.mk b/Mk/Uses/cabal.mk index 7d2aafc1534a..27237bde3974 100644 --- a/Mk/Uses/cabal.mk +++ b/Mk/Uses/cabal.mk @@ -145,12 +145,21 @@ BUILD_TARGET?= ${CABAL_EXECUTABLES:S/^/exe:&/} _use_cabal= ${USE_CABAL:O:u} . for package in ${_use_cabal} -. for pkg_name xrev in ${package:C/_[0-9]+//} x${package:C/[^_]*//:S/_//} +. for pkg_without_group xgroup in ${package:C/:.*$$//} x${package:S/${package:C/:.*$$//}//:C/^.*://} +. for pkg_name xrev in ${pkg_without_group:C/_[0-9]+//} x${pkg_without_group:C/[^_]*//:S/_//} +. if ${xgroup} == "x" DISTFILES+= ${pkg_name}/${pkg_name}${CABAL_EXTRACT_SUFX}${_hackage_group} -. if ${xrev} != "x" -DISTFILES+= ${pkg_name}/revision/${xrev:S/x//}.cabal${_hackage_group} -. endif +. if ${xrev} != "x" +DISTFILES+= ${pkg_name}/revision/${xrev:S/^x//}.cabal${_hackage_group} +. endif +. else +DISTFILES+= ${pkg_name}${CABAL_EXTRACT_SUFX}:${xgroup:S/^x//} +. if ${xrev} != "x" +DISTFILES+= ${pkg_name}/revision/${xrev:S/^x//}.cabal:${xgroup:S/^x//} +. endif +. endif # ${xgroup} == "x" _CABAL_EXTRACT_ONLY+= ${pkg_name}/${pkg_name}${CABAL_EXTRACT_SUFX} +. endfor . endfor . endfor @@ -162,6 +171,11 @@ EXTRACT_ONLY+= ${_CABAL_EXTRACT_ONLY} . endif . endif +. if defined(CABAL_REPOSITORIES) && !empty(CABAL_REPOSITORIES) +. for r in ${CABAL_REPOSITORIES} +CABAL2TUPLE_ARGS+= --group=${r} --master-site=${MASTER_SITES:M*\:${r}:[1]:S/:${r}//} +. endfor +. endif # Auxiliary targets used during port creation/updating. @@ -175,7 +189,7 @@ cabal-extract: check-cabal @${MAKE} -C ${.CURDIR} extract SKIP_CABAL_EXTRACT=yes USE_CABAL= ${RM} -rf ${CABAL_HOME} . endif - @${ECHO_MSG} "===> Fetching Cabal package index into ${CABAL_HOME}/.cabal" + @${ECHO_MSG} "===> Fetching Hackage index into ${CABAL_HOME}/.cabal" @${SETENV} HOME=${CABAL_HOME} ${CABAL_CMD} update . if ${_hackage_is_default} == yes @cd ${WRKDIR} && \ @@ -188,6 +202,11 @@ cabal-extract: check-cabal . endif # Remove Haskell dependencies that come from GH_TUPLE @${RM} -r ${WRKSRC}/dist-newstyle +. ifdef CABAL_REPOSITORIES + @${ECHO_MSG} "===> Fetching additional Cabal repositories index into ${CABAL_HOME}/.cabal" + @cd ${WRKSRC} && \ + ${SETENV} HOME=${CABAL_HOME} ${CABAL_CMD} update +. endif # Create a cookie for cabal-post-patch @${TOUCH} ${EXTRACT_COOKIE} ${CABAL_COOKIE} @@ -206,7 +225,7 @@ cabal-build: check-cabal # Generates USE_CABAL= ... line ready to be pasted into the port based on the plan.json file generated by cabal configure. make-use-cabal: check-cabal2tuple @${ECHO_MSG} "===> Processing plan.json" - @${_CABAL2TUPLE_CMD} ${WRKSRC} || (${ECHO_CMD} "Did you forget to make cabal-configure ?" ; exit 1) + @${_CABAL2TUPLE_CMD} ${CABAL2TUPLE_ARGS} ${WRKSRC} || (${ECHO_CMD} "Did you forget to make cabal-configure ?" ; exit 1) . if ${_hackage_is_default} == yes @if ${GREP} -q 'x-revision' ${WRKSRC}/*.cabal; then \ ${ECHO_MSG} "Downloaded .cabal file contains x-revision, make sure to add CABAL_REVISION=" `${GREP} 'x-revision' ${WRKSRC}/*.cabal | ${SED} -e s/x-revision://`; \ @@ -244,14 +263,16 @@ cabal-post-extract: # Move extracted dependencies into ${CABAL_DEPSDIR} directory ${MKDIR} ${CABAL_DEPSDIR} . for package in ${_use_cabal} -. for pkg_name xrev in ${package:C/_[0-9]+//} x${package:C/[^_]*//:S/_//} +. for pkg_without_group in ${package:C/:.*$$//} +. for pkg_name xrev in ${pkg_without_group:C/_[0-9]+//} x${pkg_without_group:C/[^_]*//:S/_//} # Copy revised .cabal file if present -. if ${xrev} != "x" - ${CP} ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1` -. endif +. if ${xrev} != "x" + ${CP} ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/^x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1` +. endif # Move the dependency source itself cd ${WRKDIR} && \ ${MV} ${pkg_name} ${CABAL_DEPSDIR}/ +. endfor . endfor . endfor # Create the cabal-install config @@ -268,8 +289,10 @@ cabal-post-patch: ${ECHO_CMD} "-- added by USES=cabal" >> ${WRKSRC}/cabal.project.local ${ECHO_CMD} "packages:" >> ${WRKSRC}/cabal.project.local . for package in ${_use_cabal} -. for pkg_name in ${package:C/_[0-9]+//} +. for pkg_without_group in ${package:C/:.*$$//} +. for pkg_name in ${pkg_without_group:C/_[0-9]+//} ${ECHO_CMD} " ${CABAL_DEPS_SUBDIR}/${pkg_name}" >> ${WRKSRC}/cabal.project.local +. endfor . endfor . endfor . endif # SKIP_CABAL_EXTRACT && !CABAL_COOKIE