Commit fa8b12a1 authored by Dmitry Safonov's avatar Dmitry Safonov Committed by Pavel Emelyanov

Makefile: suppress git describe warnings

This should fix errors on build envs, where git tags haven't
been fetched. I.e, Travis-ci does not fetch tags before
building a project, wich results in:
   ---> Running in 0d63a3d28a7a
  fatal: No names found, cannot describe anything.
  fatal: No names found, cannot describe anything.
  make[1]: Entering directory '/criu'

The other way is to fetch tags on `git describe` failure, but
it that way has two cons:
- it will change user's git (and I'm not sure it's right);
- we need not only fetch tags in that case, but also remotes,
  as otherwise it will fail with "fatal: No tags can describe <hash>":
  https://travis-ci.org/0x7f454c46/criu/jobs/133362045#L1748

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 39cbd916
......@@ -141,8 +141,9 @@ include Makefile.versions
VERSION_HEADER := $(SRC_DIR)/criu/include/version.h
GITID_FILE := .gitid
GITID := $(shell if [ -d ".git" ]; then git describe; fi)
GITID := $(shell if [ -d ".git" ]; then git describe --always; fi)
# Git repository wasn't inited in CRIU folder
ifeq ($(GITID),)
GITID := 0
else
......@@ -248,7 +249,16 @@ test: zdtm
# "v" prefix stripped.
head-name := $(shell git tag -l v$(CRIU_VERSION))
ifeq ($(head-name),)
head-name := $(shell git describe)
head-name := $(shell git describe 2>/dev/null)
endif
# If no git tag could describe current commit,
# use pre-defined CRIU_VERSION with GITID (if any).
ifeq ($(head-name),)
ifneq ($(GITID),)
head-name := $(CRIU_VERSION)-$(GITID)
else
head-name := $(CRIU_VERSION)
endif
endif
tar-name := $(shell echo $(head-name) | sed -e 's/^v//g')
criu-$(tar-name).tar.bz2:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment