aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-04-16 11:39:27 -0700
committerAnders Broman <a.broman58@gmail.com>2018-04-17 03:43:38 +0000
commitc8cf127375a1f785fbbcd4d63070a51c306a2c58 (patch)
tree35c9650e2cb81043931e4e4e8231e9206690ceb5
parent5e7cd2dfc6634fcdb005eef5ba3a7c3852b20a9a (diff)
Add a destination directory flag to git-export-release.
Add a destination directory flag to git-export-release.sh. Use it to replace the current "dist" target. Use it in the RPM section to avoid a symlink. Change-Id: I30ae76b3ab1a995d232e748b79aa37440f90f854 Reviewed-on: https://code.wireshark.org/review/26974 Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
-rw-r--r--CMakeLists.txt21
-rw-r--r--cmake/modules/Dist.cmake11
-rwxr-xr-xtools/git-export-release.sh13
3 files changed, 20 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6c4275..063027c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1106,13 +1106,10 @@ endforeach()
include( UseWinLibs )
# dist target that prepares source dir
+# XXX Duplicated in the RPM section below.
add_custom_target(dist
- COMMAND "${CMAKE_COMMAND}"
- -DPROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
- -DGIT_EXECUTABLE="${GIT_EXECUTABLE}"
- -DWS_SOURCE_DIR="${WS_SOURCE_DIR}"
- -P "${CMAKE_SOURCE_DIR}/cmake/modules/Dist.cmake"
- COMMAND "${CMAKE_MAKE_PROGRAM}" package_source
+ COMMAND ./tools/git-export-release.sh -d "${CMAKE_BINARY_DIR}"
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
@@ -2943,24 +2940,24 @@ if(RPMBUILD_EXECUTABLE)
string(REPLACE "-" "_" RPM_VERSION "${RPM_TARBALL_VERSION}")
configure_file(packaging/rpm/wireshark.spec.in ${CMAKE_BINARY_DIR}/packaging/rpm/SPECS/wireshark.spec)
+ # XXX Replace with the "dist" target?
set(_export_tarball "${CPACK_PACKAGE_NAME}-${RPM_TARBALL_VERSION}.tar.xz")
add_custom_command(
- OUTPUT "${CMAKE_SOURCE_DIR}/${_export_tarball}"
- COMMAND ./tools/git-export-release.sh "${_git_description}"
+ OUTPUT "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}"
+ COMMAND ./tools/git-export-release.sh
+ -d "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES"
+ "${_git_description}"
# XXX Add an option to git-export-release.sh to write to a
# specific directory so that we can get rid of `ln` below.
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_custom_target(rpm-package
- COMMAND ${CMAKE_COMMAND} -E create_symlink
- "${CMAKE_SOURCE_DIR}/${_export_tarball}"
- "SOURCES/${_export_tarball}"
COMMAND ${RPMBUILD_EXECUTABLE}
--define "_topdir ${CMAKE_BINARY_DIR}/packaging/rpm"
--define "_prefix ${CMAKE_INSTALL_PREFIX}"
${_rpmbuild_with_args}
--clean -ba SPECS/wireshark.spec
- DEPENDS "${CMAKE_SOURCE_DIR}/${_export_tarball}"
+ DEPENDS "${CMAKE_BINARY_DIR}/packaging/rpm/SOURCES/${_export_tarball}"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/packaging/rpm"
COMMENT "Create a tarball from the current git commit."
)
diff --git a/cmake/modules/Dist.cmake b/cmake/modules/Dist.cmake
deleted file mode 100644
index 7c0b3bb..0000000
--- a/cmake/modules/Dist.cmake
+++ /dev/null
@@ -1,11 +0,0 @@
-message("Copying source files from ${PROJECT_SOURCE_DIR} to ${WS_SOURCE_DIR}")
-
-# create destination dir
-file(MAKE_DIRECTORY "${WS_SOURCE_DIR}")
-
-# Copy all files in the state *as known by git*, respecting export-ignore in .gitattributes
-execute_process(COMMAND "${GIT_EXECUTABLE}" checkout-index -a -f --prefix "${WS_SOURCE_DIR}/" WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}")
-
-# Generate the version.conf and put it in brand new source dir
-execute_process(COMMAND "${GIT_EXECUTABLE}" describe WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" OUTPUT_VARIABLE GIT_DESCRIBE)
-file(WRITE "${WS_SOURCE_DIR}/version.conf" "git_description=${GIT_DESCRIBE}")
diff --git a/tools/git-export-release.sh b/tools/git-export-release.sh
index eb670db..4abd8ba 100755
--- a/tools/git-export-release.sh
+++ b/tools/git-export-release.sh
@@ -12,7 +12,16 @@
set -e
-# First paremeter, if set, is a git commit, like v1.12.0-rc1 or 54819e5699f
+DESTDIR=.
+
+while getopts "d:" OPTCHAR ; do
+ case $OPTCHAR in
+ d) DESTDIR=$OPTARG ;;
+ esac
+done
+shift $(($OPTIND - 1))
+
+# The remaining parameter, if set, is a git commit, like v1.12.0-rc1 or 54819e5699f
# By default HEAD is used.
# Note, that filtering takes place base on the _exported_ version's
# .gitattributes files thus archives generated from older commits will contain
@@ -59,7 +68,7 @@ fi
echo "Creating wireshark-$VERSION.tar.xz"
-git archive --prefix=wireshark-${VERSION}/ ${COMMIT} | xz > wireshark-${VERSION}.tar.xz
+git archive --prefix=wireshark-${VERSION}/ ${COMMIT} | xz > ${DESTDIR}/wireshark-${VERSION}.tar.xz
if [ "$STASH_POP" == "True" ] ; then
git stash pop