1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-22 05:57:43 +03:00

Release scripts: Update create-tarball to include docs and other packaging details.

I've updated the create-tarball script to support command line options,
docs build (or copy and existing build), and to run the packaging update
scripts.

  $ release-scripts/create-tarball --help
  Usage release-scripts/create-tarball [options]
      --help             Print command usage
      --branch <name>    Specify the branch to to create the archive file from
      --copy-docs <dir>  Copy documentation from <dir> rather than building
      --tag <name>       Tag name for release
      --keyid <email>    The GnuPG key ID used to sign the release tag
(This used to be commit 7c96795e5954b6a716beb6f5a30d6c7bb1647717)
This commit is contained in:
Gerald W. Carter 2008-05-27 16:27:21 -05:00
parent a307e90f3f
commit 175909f4e1

View File

@ -1,98 +1,222 @@
#!/bin/bash #!/bin/bash
## option defaults
OPT_BRANCH=""
OPT_DOCSDIR=""
OPT_TAG=""
OPT_KEYID=""
TOPDIR="`dirname $0`/.." TOPDIR="`dirname $0`/.."
VER_H="${TOPDIR}/source/include/version.h"
cd $TOPDIR function exitOnError
{
local _error="$1"
local _msg="$2"
echo -n "Please enter branch to cut tarball from: " if [ ${_error} -eq 0 ]; then
read branch return 0
fi
if [ "x$branch" = "x" ]; then echo "FAILURE: ${_msg}"
echo "You must enter a name! Exiting...." exit ${_error}
exit 1 }
fi
git-checkout $branch ##
if [ $? -ne 0 ]; then ## Print help usage
echo "Invalid branch name! Exiting...." ##
exit 2
fi
VER_H=source/include/version.h function printUsage
(cd source && ./script/mkversion.sh) {
echo "Usage $0 [options]"
echo " --help Print command usage"
echo " --branch <name> Specify the branch to to create the archive file from"
echo " --copy-docs <dir> Copy documentation from <dir> rather than building"
echo " --tag <name> Tag name for release"
echo " --keyid <email> The GnuPG key ID used to sign the release tag"
echo ""
}
if [ ! -f $VER_H ]; then ##
echo "Failed to find $VER_H! Exiting...." ## Parse the command line options
exit 1 ##
fi
version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'` function parseOptions
vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'` {
if [ -n "$vendor_version" ]; then while [ -n "$1" ]; do
version="$version-$vendor_version" case "$1" in
fi --help)
version=`echo $version | sed 's/\"//g'` printUsage
exit 0
;;
--branch)
shift
if [ -z "$1" ]; then
printUsage
return 1
fi
OPT_BRANCH="$1"
shift
;;
--copy-docs)
shift
if [ -z "$1" ]; then
printUsage
return 1
fi
OPT_DOCSDIR="$1"
shift
;;
--tag)
shift
if [ -z "$1" ]; then
printUsage
return 1
fi
OPT_TAG="$1"
shift
;;
--keyid)
shift
if [ -z "$1" ]; then
printUsage
return 1
fi
OPT_KEYID="$1"
shift
;;
*)
printUsage
return 1
;;
esac
done
echo "Creating release tarball for Samba $version" if [ -z "${OPT_BRANCH}" ]; then
echo "You must specify a branch name!"
printUsage
return 1
fi
}
/bin/rm -rf ../samba-${version} ##
git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -) ## Build the dopcumentation (may be a no-op)
##
pushd ../samba-${version} function buildDocs
{
if [ -n "${OPT_DOCSDIR}" ]; then
if [ ! -d "${OPT_DOCSDIR}" ]; then
exitOnError 1 "${OPT_DOCSDIR} does not exist. Please specify the absolute path."
fi
echo "Enter the absolute path to the generated Samba docs directory." mkdir docs
echo -n "Just hit return to exclude the docs from the generate tarball: " exitOnError $? "Failed to create docs directory"
read docsdir
if [ "x$docsdir" != "x" ]; then rsync -av "${OPT_DOCSDIR}"/ docs/
if [ ! -d "$docsdir" ]; then exitOnError $? "Failed top copy docs from ${OPT_DOCSDIR}"
echo "$docsdir does not exist! Exiting...."
exit 1 return 0
fi fi
/bin/rm -rf docs echo "Building documentation. This may take a while. Log file in /tmp/docs-build.log.$$"
mkdir docs
rsync -a --exclude=.svn $docsdir/ docs/
cd docs ${TOPDIR}/release-scripts/build-docs 2> /tmp/docs-build.log.$$
/bin/rm -rf test.pdf Samba4*pdf htmldocs/Samba4* htmldocs/test return $?
/bin/mv manpages-3 manpages
/bin/mv htmldocs/manpages-3 htmldocs/manpages
cd ..
fi
cd source }
./autogen.sh
cd ..
cd ..
tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
gpg --detach-sign --armor samba-${version}.tar
gzip -9 samba-${version}.tar
popd ##
echo -n "Enter tag name (or hit <enter> to skip): " ## Create a release tag
read tagname ##
function createReleaseTag
{
if [ -z "${OPT_TAG}" ]; then
echo "Tagging disabled"
return 0
fi
if [ "x$tagname" != "x" ]; then if [ "x`git-tag -l ${OPT_TAG}`" != "x" ]; then
if [ "x`git-tag -l $tagname`" != "x" ]; then echo -n "Tag exists. Do you wish to overwrite? (y/N): "
echo -n "Tag exists. Do you wish to overwrite? (y/N): " read answer
read answer
if [ "x$answer" != "xy" ]; then if [ "x$answer" != "xy" ]; then
echo "Tag creation aborted." echo "Tag creation aborted."
exit 1 exit 1
fi fi
fi fi
echo -n "Enter the keyid:" if [ -z "${OPT_KEYID}" ]; then
read keyid echo -n "Enter the keyid:"
if [ x"$keyid" = x"" ];then read OPT_KEYID
echo "no keyid" if [ -z "${OPT_KEYID}" ]; then
exit 1 exitOnError 1 "No keyid specified"
fi fi
git-tag -u $keyid ${tagname} fi
fi
echo "Done!" git-tag -u ${OPT_KEYID} ${OPT_TAG}
exit 0 exitOnError $? "Failed to create tag"
return 0
}
##
## Main driver
##
function main
{
parseOptions "$@"
exitOnError $? "Failed to parse options"
cd $TOPDIR
git-checkout ${OPT_BRANCH}
exitOnError $? "Invalid branch name \"${OPT_BRANCH}\""
(cd source && ./script/mkversion.sh)
if [ ! -f $VER_H ]; then
exitOnError 1 "Failed to find ${VER_H}!"
fi
version=`grep SAMBA_VERSION_OFFICIAL_STRING $VER_H | awk '{print $3}'`
vendor_version=`grep SAMBA_VERSION_VENDOR_SUFFIX $VER_H | awk '{print $3}'`
if [ -n "$vendor_version" ]; then
version="$version-$vendor_version"
fi
version=`echo $version | sed 's/\"//g'`
echo "Creating release tarball for Samba $version"
/bin/rm -rf ../samba-${version}
git-archive --format=tar --prefix=samba-${version}/ HEAD | (cd .. && tar xf -)
exitOnError $? "Failed to create release directory tree"
pushd ../samba-${version}
packaging/bin/update-pkginfo ${version} 1 ""
buildDocs
exitOnError $? "Failed to build documentation"
( cd source && ./autogen.sh )
cd ..
tar cf samba-${version}.tar --exclude=.git* --exclude=CVS --exclude=.svn samba-${version}
exitOnError $? "Failed to create tarball from git tree"
gpg --detach-sign --armor samba-${version}.tar
## exitOnError $? "Failed to sign tarball"
gzip -9 samba-${version}.tar
exitOnError $? "Failed to compress archive"
popd
createReleaseTag
exitOnError $? "Failed to create release tag"
return 0
}
main "$@"
exit $?