diff options
author | Andre Moreira Magalhaes (andrunko) <andre.magalhaes@collabora.co.uk> | 2009-04-16 12:26:06 -0300 |
---|---|---|
committer | Dario Freddi <dario.freddi@collabora.co.uk> | 2010-09-20 17:03:44 +0200 |
commit | 464240db8493ff3e960caade13785c8eff333809 (patch) | |
tree | baea44b686f1d9e62989df9617f0a4bc0e6e87a1 /cmake | |
parent | aa32280e5da32cf8cdbaa285fe60c2778e9447a0 (diff) |
cmake: Improved make dist/distcheck.
- Use git-archive to generate package.
- Removed distcheck.py
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/modules/TelepathyDist.cmake | 20 | ||||
-rw-r--r-- | cmake/modules/distcheck.py | 83 |
2 files changed, 13 insertions, 90 deletions
diff --git a/cmake/modules/TelepathyDist.cmake b/cmake/modules/TelepathyDist.cmake index 3e4ce428..9958447d 100644 --- a/cmake/modules/TelepathyDist.cmake +++ b/cmake/modules/TelepathyDist.cmake @@ -1,10 +1,16 @@ # setup make dist -add_custom_target(clone git clone ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}) -add_custom_target(clean-git rm -rf ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}/.git*) -add_custom_target(dist tar -czf ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}.tar.gz ${PACKAGE_NAME}-${PACKAGE_VERSION}) -add_dependencies(clean-git clone) -add_dependencies(dist clean-git) +add_custom_target(dist cd ${CMAKE_SOURCE_DIR} && + git archive --format=tar --prefix=${PACKAGE_NAME}-${PACKAGE_VERSION}/ HEAD | + gzip > ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}.tar.gz) # setup make distcheck -FIND_FILE(_distcheck_py distcheck.py PATHS ${CMAKE_MODULE_PATH}) -add_custom_target(distcheck ${PYTHON_EXECUTABLE} ${_distcheck_py} ${PACKAGE_NAME} ${PACKAGE_VERSION} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}) +add_custom_target(distcheck cd ${CMAKE_BINARY_DIR} && + rm -rf ${PACKAGE_NAME}-${PACKAGE_VERSION} && + gzip -d ${PACKAGE_NAME}-${PACKAGE_VERSION}.tar.gz && + tar -xf ${PACKAGE_NAME}-${PACKAGE_VERSION}.tar && + cd ${PACKAGE_NAME}-${PACKAGE_VERSION}/ && + cmake . && make && make test && make doxygen-doc && + cd ${CMAKE_BINARY_DIR} && + tar -rf ${PACKAGE_NAME}-${PACKAGE_VERSION}.tar ${PACKAGE_NAME}-${PACKAGE_VERSION}/doc/ && + gzip ${CMAKE_BINARY_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}.tar) +add_dependencies(distcheck dist) diff --git a/cmake/modules/distcheck.py b/cmake/modules/distcheck.py deleted file mode 100644 index 1edc89c7..00000000 --- a/cmake/modules/distcheck.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- - -# Copyright (C) 2009 Collabora Limited <http://www.collabora.co.uk> -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -import os -import re -import shutil -import sys -import tarfile -import subprocess - -project = sys.argv[1] -version = sys.argv[2] -srcDir = sys.argv[3] -buildDir = sys.argv[4] - -tarName = project + '-' + version -distfilesDir = buildDir + "/distfiles" - -try: - os.mkdir( distfilesDir ) -except: - print "Delete " + distfilesDir + " before running distcheck again." - exit( 1 ) - -cloneSrcDir = distfilesDir + "/" + tarName -cloneBuildDir = cloneSrcDir + "_build" - -os.chdir( buildDir ) -subprocess.call( ["git", "clone", srcDir, cloneSrcDir ] ) -os.chdir( cloneSrcDir ) -hashOfTar = subprocess.Popen(["git", "log", "--pretty=oneline", "-n1"], stdout=subprocess.PIPE).communicate()[0].strip() -os.mkdir( cloneBuildDir ) -os.chdir( cloneBuildDir ) - -originalCache = open( buildDir + "/CMakeCache.txt" ) -newCache = open( cloneBuildDir + "/CMakeCache.txt", 'w' ) -reSrcDir = re.compile( srcDir + "$" ) -reBuildDir = re.compile( buildDir + "$" ) -for line in originalCache.xreadlines(): - line = reSrcDir.sub( cloneSrcDir, line ) - newCache.write( reBuildDir.sub( cloneBuildDir, line ) ) -newCache.close() - -if subprocess.call( ["cmake", cloneSrcDir] ) == 0: - if subprocess.call( ["make"] ) == 0: - docStatus = ( subprocess.call( ["make", "doxygen-doc"] ) == 0 ) - shutil.move( cloneBuildDir + "/doc", cloneSrcDir ) - - testStatus = ( subprocess.call( ["make", "test"] ) == 0 ) - - subprocess.call( ["rm", "-rf", cloneSrcDir + "/.git*" ] ) - tarPath = buildDir + "/" + tarName + ".tar.gz" - tar = tarfile.open( tarPath, "w|gz" ) - tar.add( cloneSrcDir ) - tar.close() - print "Tarball " + tarPath + " built." - print "Remember to tag " + hashOfTar - if not docStatus: - print "WARNING: Problem building documentation." - if not testStatus: - print "WARNING: One or more tests failed." - else: - print "Building failed" - exit( 1 ) -else: - print "CMake failed" - exit( 1 ) |