Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tarantool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
tarantool
Commits
47e82424
Commit
47e82424
authored
9 years ago
by
Roman Tsisyk
Browse files
Options
Downloads
Patches
Plain Diff
Remove hardcoded versions from CMakeLists.txt
parent
2fbe8b6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
CMakeLists.txt
+34
-33
34 additions, 33 deletions
CMakeLists.txt
cmake/rpm.cmake
+15
-21
15 additions, 21 deletions
cmake/rpm.cmake
with
50 additions
and
54 deletions
.gitignore
+
1
−
0
View file @
47e82424
...
...
@@ -44,6 +44,7 @@ doc/man/tarantool.1
doc/man/tarantool_box.1
doc/user/tarantool_user_guide.txt
doc/tnt.ent
rpm/tarantool-1*.spec
extra/rpm.spec
extra/rpm/tarantool.rpm.spec
extra/dist/tarantool.service
...
...
This diff is collapsed.
Click to expand it.
CMakeLists.txt
+
34
−
33
View file @
47e82424
...
...
@@ -125,54 +125,55 @@ add_custom_target(tags COMMAND ${CTAGS} -R -f tags
add_custom_target
(
ctags DEPENDS tags
)
#
#
Define PACKAGE_VERSION -- a string constant with tarantool
version
.
#
Get
version
#
set
(
CPACK_PACKAGE_VERSION_MAJOR
"1"
)
set
(
CPACK_PACKAGE_VERSION_MINOR
"6"
)
set
(
CPACK_PACKAGE_VERSION_PATCH
"8"
)
set
(
PACKAGE_VERSION
""
)
set
(
TARANTOOL_VERSION
""
)
# Try to get version from VERSION file
set
(
VERSION_FILE
"
${
CMAKE_BINARY_DIR
}
/VERSION"
)
if
(
EXISTS
"
${
VERSION_FILE
}
"
)
file
(
STRINGS
"
${
VERSION_FILE
}
"
TARANTOOL_VERSION
)
endif
()
# Get git version only if source directory has .git repository, this
# avoids git to search .git repository in parent
# directories.
#
if
(
EXISTS
"
${
CMAKE_SOURCE_DIR
}
/.git"
)
execute_process
(
COMMAND
${
GIT
}
describe HEAD
COMMAND sed
"s/-/./"
COMMAND sed
"s/-[a-z 0-9]*//"
OUTPUT_VARIABLE PACKAGE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
execute_process
(
COMMAND
${
GIT
}
describe HEAD
OUTPUT_VARIABLE TARANTOOL_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
execute_process
(
COMMAND
${
GIT
}
describe --long HEAD
OUTPUT_VARIABLE TARANTOOL_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY
${
CMAKE_SOURCE_DIR
}
)
if
(
PACKAGE_VERSION STREQUAL
""
)
message
(
FATAL_ERROR
"Failed to retrive git version."
)
if
(
NOT
(
"
${
TARANTOOL_GIT_VERSION
}
"
STREQUAL
"
${
TARANTOOL_VERSION
}
"
))
set
(
TARANTOOL_VERSION
"
${
TARANTOOL_GIT_VERSION
}
"
)
file
(
WRITE
${
VERSION_FILE
}
"
${
TARANTOOL_VERSION
}
\n
"
)
message
(
STATUS
"Generating VERSION file"
)
endif
()
endif
()
set
(
VERSION_FILE
"
${
CMAKE_SOURCE_DIR
}
/VERSION"
)
if
(
NOT TARANTOOL_VERSION
)
message
(
FATAL_ERROR
"Unable to retrive version from git or
${
VERSION_FILE
}
file."
)
endif
()
# Update version file or use it when there is no git
# repository within sources (source tarballs).
#
if
(
PACKAGE_VERSION STREQUAL
""
)
if
(
NOT EXISTS
"
${
VERSION_FILE
}
"
)
message
(
FATAL_ERROR
"Version file
${
VERSION_FILE
}
does not exists."
)
endif
()
message
(
WARNING
"Using version from version file
${
VERSION_FILE
}
"
)
execute_process
(
COMMAND
${
CAT
}
${
VERSION_FILE
}
OUTPUT_VARIABLE PACKAGE_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if
(
PACKAGE_VERSION STREQUAL
""
)
message
(
FATAL_ERROR
"Unable to retrive version from git or
${
VERSION_FILE
}
file."
)
endif
()
else
()
file
(
WRITE
${
VERSION_FILE
}
"
${
PACKAGE_VERSION
}
\n
"
)
endif
()
# Split full version (git describe --long) to get components
#
string
(
REPLACE
"-"
"."
TARANTOOL_VERSION_LIST
${
TARANTOOL_VERSION
}
)
string
(
REPLACE
"."
";"
TARANTOOL_VERSION_LIST
${
TARANTOOL_VERSION_LIST
}
)
LIST
(
GET TARANTOOL_VERSION_LIST 0 CPACK_PACKAGE_VERSION_MAJOR
)
LIST
(
GET TARANTOOL_VERSION_LIST 1 CPACK_PACKAGE_VERSION_MINOR
)
LIST
(
GET TARANTOOL_VERSION_LIST 2 CPACK_PACKAGE_VERSION_PATCH
)
LIST
(
GET TARANTOOL_VERSION_LIST 3 CPACK_PACKAGE_VERSION_COMMIT
)
set
(
PACKAGE_VERSION
"
${
CPACK_PACKAGE_VERSION_MAJOR
}
"
)
set
(
PACKAGE_VERSION
"
${
PACKAGE_VERSION
}
.
${
CPACK_PACKAGE_VERSION_MINOR
}
"
)
set
(
PACKAGE_VERSION
"
${
PACKAGE_VERSION
}
.
${
CPACK_PACKAGE_VERSION_PATCH
}
"
)
set
(
PACKAGE_VERSION
"
${
PACKAGE_VERSION
}
.
${
CPACK_PACKAGE_VERSION_COMMIT
}
"
)
message
(
STATUS
"Tarantool version is
${
TARANTOOL_VERSION
}
(
${
PACKAGE_VERSION
}
)"
)
#
# Specify where to look for include files.
...
...
@@ -400,7 +401,7 @@ configure_file(
message
(
STATUS
""
)
message
(
STATUS
"Tarantool configuration is complete:"
)
message
(
STATUS
""
)
message
(
STATUS
"VERSION:
${
PACKAGE
_VERSION
}
"
)
message
(
STATUS
"VERSION:
${
TARANTOOL
_VERSION
}
"
)
message
(
STATUS
"BUILD:
${
TARANTOOL_BUILD
}
"
)
message
(
STATUS
"C_COMPILER:
${
TARANTOOL_C_COMPILER
}
"
)
message
(
STATUS
"CXX_COMPILER:
${
TARANTOOL_CXX_COMPILER
}
"
)
...
...
This diff is collapsed.
Click to expand it.
cmake/rpm.cmake
+
15
−
21
View file @
47e82424
...
...
@@ -5,22 +5,10 @@ if (RPMBUILD)
find_program
(
CP cp
)
find_program
(
WC wc
)
execute_process
(
COMMAND
${
GIT
}
describe HEAD --abbrev=0
OUTPUT_VARIABLE VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
execute_process
(
COMMAND
${
GIT
}
rev-list --oneline
${
VERSION
}
..
COMMAND
${
WC
}
-l
OUTPUT_VARIABLE RELEASE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set
(
SCL_VERSION
"1.0"
CACHE STRING
""
FORCE
)
set
(
SCL_RELEASE
"1"
CACHE STRING
""
FORCE
)
set
(
SCL_TARANTOOL
"mailru-16"
CACHE STRING
""
FORCE
)
set
(
RPM_PACKAGE_VERSION
${
VERSION
}
CACHE STRING
""
FORCE
)
set
(
RPM_PACKAGE_RELEASE
${
RELEASE
}
CACHE STRING
""
FORCE
)
set
(
RPM_SOURCE_DIRECTORY_NAME
${
CPACK_SOURCE_PACKAGE_FILE_NAME
}
CACHE STRING
""
FORCE
)
set
(
RPM_PACKAGE_SOURCE_FILE_NAME
${
PACKAGE_VERSION
}
.tar.gz
...
...
@@ -28,36 +16,42 @@ if (RPMBUILD)
set
(
RPM_BUILDROOT
"
${
PROJECT_BINARY_DIR
}
/RPM/BUILDROOT"
CACHE STRING
""
FORCE
)
add_custom_command
(
OUTPUT
${
PROJECT_BINARY_DIR
}
/
${
PACKAGE_VERSION
}
.tar.gz
add_custom_command
(
OUTPUT
${
PROJECT_BINARY_DIR
}
/
tarantool-
${
PACKAGE_VERSION
}
.tar.gz
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
COMMAND $
(
MAKE
)
package_source
&& mv `ls *.tar.gz | head -n 1` tarantool-
${
PACKAGE_VERSION
}
.tar.gz
)
COMMAND $
(
MAKE
)
package_source
)
add_custom_command
(
OUTPUT
${
RPM_BUILDROOT
}
COMMAND
${
MKDIR
}
-p
${
RPM_BUILDROOT
}
)
add_custom_target
(
bump_spec
set
(
RPM_SPEC
"
${
PROJECT_BINARY_DIR
}
/rpm/tarantool-
${
PACKAGE_VERSION
}
.spec"
)
add_custom_target
(
rpm_spec
DEPENDS
${
PROJECT_BINARY_DIR
}
/tarantool-
${
PACKAGE_VERSION
}
.tar.gz
COMMAND sed -i -e
"'s/Version:
\\
([ ]*
\\
).*/Version:
${
PACKAGE_VERSION
}
/g'"
rpm/tarantool.spec
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
COMMAND
${
CMAKE_COMMAND
}
-E copy rpm/tarantool.spec
${
RPM_SPEC
}
.tmp
COMMAND sed -i -e
"'s/Version:
\\
([ ]*
\\
).*/Version:
${
PACKAGE_VERSION
}
/g'"
${
RPM_SPEC
}
.tmp
COMMAND
${
CMAKE_COMMAND
}
-E rename
${
RPM_SPEC
}
.tmp
${
RPM_SPEC
}
WORKING_DIRECTORY
${
SOURCE_BINARY_DIR
}
)
add_custom_target
(
rpm_src
DEPENDS
bump
_spec
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--define '_sourcedir ./' --define '_srcrpmdir ./' -bs
${
PROJECT_SOURCE_DIR
}
/rpm/tarantool.spec
DEPENDS
rpm
_spec
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--define '_sourcedir ./' --define '_srcrpmdir ./' -bs
${
RPM_SPEC
}
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
)
# TODO: Targets below are temporary broken
return
()
add_custom_target
(
rpm
DEPENDS rpm_src
DEPENDS
${
RPM_BUILDROOT
}
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--rebuild
${
PROJECT_BINARY_DIR
}
/tarantool-
${
VERSION
}
-
${
RELEASE
}
.src.rpm
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--rebuild
${
PROJECT_BINARY_DIR
}
/tarantool-
${
PACKAGE_VERSION
}
.src.rpm
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
)
add_custom_target
(
rpm_systemd
DEPENDS rpm_src
DEPENDS
${
RPM_BUILDROOT
}
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--with systemd --rebuild
${
PROJECT_BINARY_DIR
}
/tarantool-
${
VERSION
}
-
${
RELEASE
}
.src.rpm
COMMAND
${
RPMBUILD
}
--buildroot
${
RPM_BUILDROOT
}
--with systemd --rebuild
${
PROJECT_BINARY_DIR
}
/tarantool-
${
PACKAGE_VERSION
}
.src.rpm
WORKING_DIRECTORY
${
PROJECT_BINARY_DIR
}
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment