From 4287d474f85218acca7daecbd3bd37cbb5fba61c Mon Sep 17 00:00:00 2001
From: Niels de Vos <ndevos@redhat.com>
Date: Tue, 26 Jun 2018 10:40:01 +0200
Subject: [PATCH] build: add a check for mercurial/hg

When running `make vendor` without `hg` in the path, the build fails
with the following error:

   [WARN] Unable to checkout bitbucket.org/ww/goautoneg
   [ERROR] Update failed for bitbucket.org/ww/goautoneg: hg is not installed
   [ERROR] Failed to install: hg is not installed
   make: *** [Makefile:74: vendor] Error 1

Glide needs to fetch a repository from bitbucket.org, which is a
Mercurial hosting site. The `hg` executable needs to be available to
download the requires pkgs.

Reported-by: Madhu Rajanna <mrajanna@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
---
 Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Makefile b/Makefile
index 41d9bbb0..19d9e513 100644
--- a/Makefile
+++ b/Makefile
@@ -20,6 +20,7 @@ ifeq ($(GOARCH),$(GOHOSTARCH))
 endif
 endif
 GLIDEPATH := $(shell command -v glide 2> /dev/null)
+HGPATH := $(shell command -v hg 2> /dev/null)
 DIR=.
 
 ifeq (master,$(BRANCH))
@@ -69,6 +70,11 @@ ifndef GLIDEPATH
 	$(info by running: curl https://glide.sh/get | sh.)
 	$(info )
 	$(error glide is required to continue)
+endif
+ifndef HGPATH
+	$(info Please install mercurial/hg.)
+	$(info glide needs to fetch pkgs from a mercurial repository.)
+	$(error mercurial/hg is required to continue)
 endif
 	echo "Installing vendor directory"
 	glide install -v
-- 
GitLab