Avoid overwriting the text templates if they already exist
philderbeast opened this issue · 0 comments
philderbeast commented
Found this when using Updo in a Github action run when stackage was setup locally but because of the recipe overwrite, a constraint conflict arose pulling in Stackage's cabal.config
:
$ cabal build all --enable-tests --enable-benchmarks --dry-run
Resolving dependencies...
Error: cabal: Could not resolve dependencies:
[__0] trying: hpack-dhall-0.5.7 (user goal)
[__1] next goal: hpack (dependency of hpack-dhall)
[__1] rejecting: hpack-0.36.0 (constraint from project config
https://stackage.org/lts-21.25/cabal.config requires ==0.35.2)
Here's how to reproduce it using touch, when project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall
and project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall
already exist.
$ touch updo/project-skeleton/ghc-x.y.z/text-templates/dhall2cabal.dhall
$ make -f project-files.mk cabal.project
mkdir -p project-dhall/pkgs
[ -e project-dhall/pkgs/hpack-dhall.dhall ] || cp updo/project-skeleton/pkgs/all-in-one.dhall project-dhall/pkgs/all-in-one.dhall
mkdir -p project-dhall
[ -e project-dhall/pkg-groups.dhall ] || cp updo/project-skeleton/pkg-groups.dhall project-dhall/pkg-groups.dhall
mkdir -p project-dhall/ghc-9.4.8/text-templates
cp updo/project-skeleton/ghc-x.y.z/text-templates/cabal-snippet.dhall project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall
cp updo/project-skeleton/ghc-x.y.z/text-templates/dhall2cabal.dhall project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall
echo './project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall ./.updo/pkgs-sorted.dhall "lts-21.25"' \
| dhall text | sed -E "s/@(rev|sha256):.*$//" > ghc-9.4.8.dhall2cabal.project
cp ghc-9.4.8.dhall2cabal.project cabal.project
rm ghc-9.4.8.dhall2cabal.project
The overwriting changes the configured set up:
$ git diff
diff --git a/cabal.project b/cabal.project
old mode 100755
new mode 100644
index 81dda4f..7c869ca
--- a/cabal.project
+++ b/cabal.project
@@ -1,8 +1,10 @@
-import: ./project-stackage/lts-21.25.config
+import: https://stackage.org/lts-21.25/cabal.config
+-- We have 1 package.
packages:
.
+-- Version equality constraints.
constraints:
crypton ==1.0.0
, crypton-connection ==0.4.0
@@ -13,6 +15,6 @@ constraints:
, hpack ==0.36.0
, http-client-tls ==0.3.6.3
, tls ==2.0.5
-
program-options
ghc-options: -fhide-source-paths
+
diff --git a/project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall b/project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall
index d8ba517..2d7a4ee 100644
--- a/project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall
+++ b/project-dhall/ghc-9.4.8/text-templates/cabal-snippet.dhall
@@ -1,4 +1,4 @@
''
-
program-options
- ghc-options: -fhide-source-paths''
+ ghc-options: -fhide-source-paths
+''
diff --git a/project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall b/project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall
index 49ca975..fc7b24d 100644
--- a/project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall
+++ b/project-dhall/ghc-9.4.8/text-templates/dhall2cabal.dhall
@@ -22,8 +22,8 @@ in \(pkgs-done : List Text) ->
in ''
${../../../updo/text-templates/dhall2cabal.dhall
- TYPES.Verbosity.Quiet
- TYPES.Stackage.StackageLocal
+ TYPES.Verbosity.Info
+ TYPES.Stackage.StackageWeb
stackage-resolver
( if null Text pkgs-todo
then TYPES.PkgSet.AllPkgs pkgs-done