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>
This commit is contained in:
Gerald Combs 2018-04-16 11:39:27 -07:00 committed by Anders Broman
parent 5e7cd2dfc6
commit c8cf127375
3 changed files with 20 additions and 25 deletions

View File

@ -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."
)

View File

@ -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}")

View File

@ -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