File: 01-remove-dependency-on-git-command.patch

package info (click to toggle)
libcorkipset 1.1.1%2Bgit20171111.6842a63-2.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 864 kB
  • sloc: ansic: 5,252; python: 432; sh: 59; makefile: 21
file content (58 lines) | stat: -rw-r--r-- 2,055 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From: Roger Shimizu <rogershimizu@gmail.com>
Date: Thu, 19 May 2016 22:43:54 +0900
Subject: remove dependency on git command

Get version from $ENV{DEB_VERSION_UPSTREAM}, which is from debian/rules,
instead of "git describe" command.
---
 CMakeLists.txt | 27 +++------------------------
 1 file changed, 3 insertions(+), 24 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9baea7f..8beff72 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,20 +21,12 @@ include(GNUInstallDirs)
 #-----------------------------------------------------------------------
 # Retrieve the current version number
 
-execute_process(
-    COMMAND git describe
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    RESULT_VARIABLE VERSION_RESULT
-    OUTPUT_VARIABLE VERSION
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-if(VERSION_RESULT)
-    message(FATAL_ERROR
-            "Cannot determine version number: " ${VERSION_RESULT})
-endif(VERSION_RESULT)
+set(VERSION $ENV{DEB_VERSION_UPSTREAM})
 message(STATUS "Current version: " ${VERSION})
 
 string(REGEX REPLACE "-.*" "-dev" BASE_VERSION "${VERSION}")
+string(REGEX REPLACE "\\+git.*" "-dev" BASE_VERSION "${BASE_VERSION}")
+message(STATUS "Base version: " ${BASE_VERSION})
 
 if(BASE_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-dev)?$")
     set(VERSION_MAJOR "${CMAKE_MATCH_1}")
@@ -44,19 +36,6 @@ else(BASE_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-dev)?$")
     message(FATAL_ERROR "Invalid version number: ${VERSION}")
 endif(BASE_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)(-dev)?$")
 
-execute_process(
-    COMMAND git rev-parse HEAD
-    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
-    RESULT_VARIABLE GIT_SHA1_RESULT
-    OUTPUT_VARIABLE GIT_SHA1
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-)
-if(GIT_SHA1_RESULT)
-    message(FATAL_ERROR
-            "Cannot determine git commit: " ${GIT_SHA1_RESULT})
-endif(GIT_SHA1_RESULT)
-message(STATUS "Current revision: " ${GIT_SHA1})
-
 #-----------------------------------------------------------------------
 # Set some options