From b419fc70f63508649c5db9519ad128480f98f4d9 Mon Sep 17 00:00:00 2001
From: Ralf Jung <jung@mpi-sws.org>
Date: Wed, 25 Apr 2018 11:50:20 +0200
Subject: [PATCH] only do the 'reinstall build-dep package' on opam 1

---
 Makefile | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index aa91ea531..0e955efec 100644
--- a/Makefile
+++ b/Makefile
@@ -31,13 +31,15 @@ build-dep: build-dep/opam phony
 	@# that are incompatible with our build requirements.
 	@# To achieve this, we create a fake opam package that has our build-dependencies as
 	@# dependencies, but does not actually install anything.
-	@# Reinstalling is needed in case the pin already exists, but the builddep package changed.
-	@# Once we depend on opam 2, we can remove that last step.
+	@# Reinstalling is needed with opam 1 in case the pin already exists, but the builddep
+	@# package changed.
 	@BUILD_DEP_PACKAGE="$$(egrep "^name:" build-dep/opam | sed 's/^name: *"\(.*\)" */\1/')"; \
 	  echo "# Pinning build-dep package." && \
 	  opam pin add -k path $(OPAMFLAGS) "$$BUILD_DEP_PACKAGE".dev build-dep && \
-	  echo "# Reinstalling build-dep package." && \
-	  opam reinstall $(OPAMFLAGS) "$$BUILD_DEP_PACKAGE"
+	  (! opam --version | grep "^1\.") || ( \
+	    echo "# Reinstalling build-dep package." && \
+	    opam reinstall $(OPAMFLAGS) "$$BUILD_DEP_PACKAGE" \
+	  )
 
 # Some files that do *not* need to be forwarded to Makefile.coq
 Makefile: ;
-- 
GitLab