Skip to content

Commit 9e425fc

Browse files
committed
Uses/cabal.mk: Introduce CABAL_REVISION knob.
This knob allows pulling in a revised .cabal file for a Haskell package being ported. This allows us to drop local patches that were serving the same purpose.
1 parent c50d10c commit 9e425fc

File tree

13 files changed

+33
-296
lines changed

13 files changed

+33
-296
lines changed

‎Mk/Uses/cabal.mk‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
# When creating a new port, the initial list can be built
2020
# using make-use-cabal auxiliary target.
2121
#
22+
# CABAL_REVISION Specifies a Haskell package revision. Set this to an
23+
# integer to pull in revised .cabal file from Hackage.
24+
#
2225
# CABAL_FLAGS List of Cabal flags to be passed verbatim into --flags
2326
# argument of cabal-install utility. Used for both
2427
# cabal configure and cabal build.
@@ -125,6 +128,9 @@ MASTER_SITES+= https://hackage.haskell.org/package/${_hackage_group} \
125128

126129
. if ${_hackage_is_default} == yes
127130
DISTFILES+= ${PORTNAME}-${PORTVERSION}/${PORTNAME}-${PORTVERSION}${CABAL_EXTRACT_SUFX}
131+
. ifdef CABAL_REVISION
132+
DISTFILES+= ${PORTNAME}-${PORTVERSION}/revision/${CABAL_REVISION}.cabal
133+
. endif
128134
. else
129135
_hackage_group= :cabal_mk_hackage
130136
. endif
@@ -201,6 +207,11 @@ cabal-build: check-cabal
201207
make-use-cabal: check-cabal2tuple
202208
@${ECHO_MSG} "===> Processing plan.json"
203209
@${_CABAL2TUPLE_CMD} ${WRKSRC} || (${ECHO_CMD} "Did you forget to make cabal-configure ?" ; exit 1)
210+
. if ${_hackage_is_default} == yes
211+
@if ${GREP} -q 'x-revision' ${WRKSRC}/*.cabal; then \
212+
${ECHO_MSG} "Downloaded .cabal file contains x-revision, make sure to add CABAL_REVISION=" `${GREP} 'x-revision' ${WRKSRC}/*.cabal | ${SED} -e s/x-revision://`; \
213+
fi
214+
. endif
204215

205216
check-cabal:
206217
@if ! type ${CABAL_CMD} > /dev/null 2>&1; then \
@@ -225,18 +236,22 @@ cabal-post-extract:
225236
@${TEST} ! -f ${WRKSRC}/cabal.project || \
226237
(${ECHO_CMD} "cabal.project file is already present in WRKSRC! Set CABAL_PROJECT variable." && false)
227238
. endif
239+
# Copy revised .cabal file if present
240+
. if defined(CABAL_REVISION) && ${_hackage_is_default} == yes
241+
${CP} ${DISTDIR}/${DIST_SUBDIR}/${PORTNAME}-${PORTVERSION}/revision/${CABAL_REVISION}.cabal `find ${WRKSRC} -name '*.cabal' -depth 1`
242+
. endif
228243

229244
# Move extracted dependencies into ${CABAL_DEPSDIR} directory
230245
${MKDIR} ${CABAL_DEPSDIR}
231246
. for package in ${_use_cabal}
232247
. for pkg_name xrev in ${package:C/_[0-9]+//} x${package:C/[^_]*//:S/_//}
233248
# Copy revised .cabal file if present
234249
. if ${xrev} != "x"
235-
cp ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1`
250+
${CP} ${DISTDIR}/${DIST_SUBDIR}/${pkg_name}/revision/${xrev:S/x//}.cabal `find ${WRKDIR}/${pkg_name} -name '*.cabal' -depth 1`
236251
. endif
237252
# Move the dependency source itself
238253
cd ${WRKDIR} && \
239-
mv ${pkg_name} ${CABAL_DEPSDIR}/
254+
${MV} ${pkg_name} ${CABAL_DEPSDIR}/
240255
. endfor
241256
. endfor
242257
# Create the cabal-install config

‎converters/hs-aeson-pretty/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LICENSE= BSD3CLAUSE
1111

1212
USES= cabal
1313

14+
CABAL_REVISION= 2
1415
USE_CABAL= OneTuple-0.3.1_3 \
1516
QuickCheck-2.14.2 \
1617
StateVar-1.2.2 \

‎converters/hs-aeson-pretty/distinfo‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
TIMESTAMP = 1668511709
1+
TIMESTAMP = 1668587368
22
SHA256 (cabal/aeson-pretty-0.8.9/aeson-pretty-0.8.9.tar.gz) = 5dbc4f451dfa1e667b2c6ec5170714fed1905dc9cae6a1134b3376f355fa2a08
33
SIZE (cabal/aeson-pretty-0.8.9/aeson-pretty-0.8.9.tar.gz) = 5802
4+
SHA256 (cabal/aeson-pretty-0.8.9/revision/2.cabal) = f7b1808efab1b9edd0efbdfc2cd47e7dfe8bbd42ee970d1d3780112a4de125a1
5+
SIZE (cabal/aeson-pretty-0.8.9/revision/2.cabal) = 2559
46
SHA256 (cabal/OneTuple-0.3.1/OneTuple-0.3.1.tar.gz) = 98853682d52fb4cc37a45cd186fbd77cf2565d3df5171acc4cf026427e103eef
57
SIZE (cabal/OneTuple-0.3.1/OneTuple-0.3.1.tar.gz) = 5148
68
SHA256 (cabal/OneTuple-0.3.1/revision/3.cabal) = fc32cb744477befa450a538ea4975cc523f0a2f1585cb5a36e9936a3d18e9a3c

‎converters/hs-aeson-pretty/files/patch-aeson-pretty.cabal‎

Lines changed: 0 additions & 27 deletions
This file was deleted.

‎devel/hs-cpphs/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LICENSE= LGPL21
1111

1212
USES= cabal
1313

14+
CABAL_REVISION= 1
1415
USE_CABAL= polyparse-1.13_5
1516

1617
.include <bsd.port.mk>

‎devel/hs-cpphs/distinfo‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
TIMESTAMP = 1668511758
1+
TIMESTAMP = 1668595648
22
SHA256 (cabal/cpphs-1.20.9.1/cpphs-1.20.9.1.tar.gz) = 7f59b10bc3374004cee3c04fa4ee4a1b90d0dca84a3d0e436d5861a1aa3b919f
33
SIZE (cabal/cpphs-1.20.9.1/cpphs-1.20.9.1.tar.gz) = 45496
4+
SHA256 (cabal/cpphs-1.20.9.1/revision/1.cabal) = 0ad26fef4e6be4cb13e1df93aab7bdbe9c3d3bc6c63b84d9e29cc0f691fe12b9
5+
SIZE (cabal/cpphs-1.20.9.1/revision/1.cabal) = 3331
46
SHA256 (cabal/polyparse-1.13/polyparse-1.13.tar.gz) = 1c4c72980e1e5a4f07fea65ca08b2399581d2a6aa21eb1078f7ad286c279707b
57
SIZE (cabal/polyparse-1.13/polyparse-1.13.tar.gz) = 33144
68
SHA256 (cabal/polyparse-1.13/revision/5.cabal) = aca2fc54c5c90eaa85e59368ae3533cdc8a4bb85bb9d3e6de885f8e66eb11917

‎devel/hs-cpphs/files/patch-cpphs.cabal‎

Lines changed: 0 additions & 20 deletions
This file was deleted.

‎devel/hs-hasktags/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ LICENSE= BSD3CLAUSE
1111

1212
USES= cabal
1313

14+
CABAL_REVISION= 2
1415
USE_CABAL= ansi-terminal-0.11.3 \
1516
ansi-wl-pprint-0.6.9_3 \
1617
colour-2.3.6 \

‎devel/hs-hasktags/distinfo‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
TIMESTAMP = 1668511776
1+
TIMESTAMP = 1668595900
22
SHA256 (cabal/hasktags-0.72.0/hasktags-0.72.0.tar.gz) = adadb5800ab2996f0198a6fc6af959dee6d69339c204cc9789f83e67024fe726
33
SIZE (cabal/hasktags-0.72.0/hasktags-0.72.0.tar.gz) = 59000
4+
SHA256 (cabal/hasktags-0.72.0/revision/2.cabal) = 1d3cb246cf1b374bcbf5dfab2dd0f99c9c0898412281583ef89fe9bdc6347b38
5+
SIZE (cabal/hasktags-0.72.0/revision/2.cabal) = 2866
46
SHA256 (cabal/ansi-terminal-0.11.3/ansi-terminal-0.11.3.tar.gz) = f4d563ecf71fb1d304bcdcad478d97efd9f61f6d9d4797a5d56e7722a92a9e6b
57
SIZE (cabal/ansi-terminal-0.11.3/ansi-terminal-0.11.3.tar.gz) = 37868
68
SHA256 (cabal/ansi-wl-pprint-0.6.9/ansi-wl-pprint-0.6.9.tar.gz) = a7b2e8e7cd3f02f2954e8b17dc60a0ccd889f49e2068ebb15abfa1d42f7a4eac

‎devel/hs-hasktags/files/patch-hasktags.cabal‎

Lines changed: 0 additions & 216 deletions
This file was deleted.

0 commit comments

Comments
 (0)