[CRIU] [PATCH] make: version -- Ensure that .gitid exist vefore read

Cyrill Gorcunov gorcunov at gmail.com
Tue May 5 04:19:29 PDT 2015


On Tue, May 05, 2015 at 01:38:38PM +0300, Pavel Emelyanov wrote:
> Hi,
> 
> On fresh master I have
> 
> $ make tags
> cat: .gitid: No such file or directory
> /bin/sh: line 0: [: =: unary operator expected
>   GEN      tags

If I'm not missing something obvious, this should do the trick.
-------------- next part --------------
>From df83559eb3d5c3a9a805b4f5b3b1073ff6a89149 Mon Sep 17 00:00:00 2001
From: Cyrill Gorcunov <gorcunov at openvz.org>
Date: Tue, 5 May 2015 14:07:33 +0300
Subject: [PATCH] make: version -- Ensure that .gitid exist vefore read

In case if there is no .gitid file we might endup
with build error. Make sure it exist.

Reported-by: Pavel Emelyanov <xemul at parallels.com>
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 scripts/Makefile.version | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.version b/scripts/Makefile.version
index 91d2112a9b0b..8905bd9b63a9 100644
--- a/scripts/Makefile.version
+++ b/scripts/Makefile.version
@@ -7,7 +7,7 @@ GITID := $(shell if [ -d ".git" ]; then git describe; fi)
 ifeq ($(GITID),)
 	GITID := 0
 else
-        GITID_FILE_VALUE := $(shell if [ `cat .gitid` = $(GITID) ]; then echo y; fi)
+        GITID_FILE_VALUE := $(shell if [ -f '.gitid' ]; then if [ `cat .gitid` = $(GITID) ]; then echo y; fi; fi)
         ifneq ($(GITID_FILE_VALUE),y)
                 .PHONY: $(GITID_FILE)
         endif
-- 
2.1.0



More information about the CRIU mailing list