Closed hasufell closed 6 years ago
Pasting gerrit patch for convenience
From e82a400eb8abb959609d855487d4fbd0388987ec Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Mon, 18 Sep 2017 22:33:41 +0200
Subject: [PATCH] hackage.exlib: introduce rev exparam
This exparam is used to represent the metadata
revisions that hackage uses in addition to the tarball.
E.g. for dependency updates, the tarball is often
not touched, but a new .cabal file uploaded to hackage.
The exparam 'rev' will cause an automatic fetch of
that new cabal file and replace it with the outdated
in src_unpack().
Change-Id: I08454b7473abae1fbb9cd3902106f7df0da9ebe0
---
exlibs/hackage.exlib | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/exlibs/hackage.exlib b/exlibs/hackage.exlib
index f36cd315..174a241e 100644
--- a/exlibs/hackage.exlib
+++ b/exlibs/hackage.exlib
@@ -5,10 +5,13 @@
## distribution infrastructure. All these packages are cabalized, so we
## require cabal.exlib.
+
myexparam ghc_dep=
myexparam -b has_lib=true
myexparam -b has_bin=false
+# hackage metadata rev (.cabal file)
+myexparam rev=
if exparam -b has_lib; then
myexparam -b has_haddock=true
@@ -30,3 +33,18 @@ require cabal [ \
HOMEPAGE="https://hackage.haskell.org/package/${PN}"
DOWNLOADS="https://hackage.haskell.org/package/${PNV}/${PNV}.tar.gz"
+# if we have a metadata revision on hackage, update the .cabal definition
+# from there
+hackage_rev=$(exparam rev)
+if [[ -n ${hackage_rev} ]] ; then
+ export_exlib_phases src_unpack
+
+ DOWNLOADS+=" https://hackage.haskell.org/package/${PNV}/revision/${hackage_rev}.cabal -> ${hackage_rev}.cabal.${PNV}"
+
+ hackage_src_unpack() {
+ cabal_src_unpack
+ edo cp "${FETCHEDDIR}"/${hackage_rev}.cabal.${PNV} \
+ "${WORK}"/${PN}.cabal
+ }
+fi
+
--
2.14.1
I guess I'll need to figure out if we actually fetch latests revision of cabal file from hackage.
Afaiu we do, we fetch e.g. https://hackage.haskell.org/package/hackage-security-0.5.2.2/hackage-security.cabal which points to the latest revision. Then we get x-revision: 4
key-value pair and use it to pull https://hackage.haskell.org/package/hackage-security-0.5.2.2/revision/4.cabal so we have a properly versioned cabal file paludis can rely on.
New diff:
From 643bd4d30e31876739ef538c6a325e231abc0919 Mon Sep 17 00:00:00 2001
From: Julian Ospald <hasufell@posteo.de>
Date: Mon, 18 Sep 2017 22:33:41 +0200
Subject: [PATCH] hackage.exlib: introduce rev exparam
This exparam is used to represent the metadata
revisions that hackage uses in addition to the tarball.
E.g. for dependency updates, the tarball is often
not touched, but a new .cabal file uploaded to hackage.
The exparam 'rev' will cause an automatic fetch of
that new cabal file and replace it with the outdated
in src_unpack().
Change-Id: I08454b7473abae1fbb9cd3902106f7df0da9ebe0
---
exlibs/hackage.exlib | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/exlibs/hackage.exlib b/exlibs/hackage.exlib
index f36cd315..a9bd6cc5 100644
--- a/exlibs/hackage.exlib
+++ b/exlibs/hackage.exlib
@@ -9,6 +9,8 @@ myexparam ghc_dep=
myexparam -b has_lib=true
myexparam -b has_bin=false
+# hackage metadata rev (.cabal file)
+myexparam rev=
if exparam -b has_lib; then
myexparam -b has_haddock=true
@@ -30,3 +32,23 @@ require cabal [ \
HOMEPAGE="https://hackage.haskell.org/package/${PN}"
DOWNLOADS="https://hackage.haskell.org/package/${PNV}/${PNV}.tar.gz"
+export_exlib_phases src_unpack
+
+# if we have a metadata revision on hackage, update the .cabal definition
+# from there
+hackage_rev=$(exparam rev)
+if [[ -n ${hackage_rev} ]] ; then
+
+ DOWNLOADS+=" https://hackage.haskell.org/package/${PNV}/revision/${hackage_rev}.cabal -> ${hackage_rev}.cabal.${PNV}"
+
+ hackage_src_unpack() {
+ cabal_src_unpack
+ edo cp "${FETCHEDDIR}"/${hackage_rev}.cabal.${PNV} \
+ "${WORK}"/${PN}.cabal
+ }
+else
+ hackage_src_unpack() {
+ cabal_src_unpack
+ }
+fi
+
--
2.14.1
Not interested in this change anymore, feel free to maintain/cherry-pick.
This updates the tarball .cabal file with the newer one from hackage.
Depends on hackage.exlib change: https://galileo.mailstation.de/gerrit/#/c/10089/
This is really needed for sanity. There are a lot of packages that would need manual .cabal file patching instead. This conforms to the hackage revision stuff: https://github.com/haskell-infra/hackage-trustees/blob/master/cookbook.md#best-practice-for-managing-meta-data