[parted-devel] [PATCH 3/3] Automate the release process.
Joel Granados
jgranado at redhat.com
Mon Jul 20 19:40:47 UTC 2009
Attached is the next version of this script...
On Sun, Jul 19, 2009 at 05:16:39PM +0200, Joel Granados Moreno wrote:
> * build-aux/parted-release: New file. Automates the part of the release
> process that takes place in the local repository.
> ---
> build-aux/parted-release | 157 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 157 insertions(+), 0 deletions(-)
> create mode 100755 build-aux/parted-release
>
> diff --git a/build-aux/parted-release b/build-aux/parted-release
> new file mode 100755
> index 0000000..01106fc
> --- /dev/null
> +++ b/build-aux/parted-release
> @@ -0,0 +1,157 @@
> +#!/bin/bash
> +
> +v=""
> +user=$(id -u)
> +date=$(date +%F)
> +logfile="release.log"
...
> +
> +echo "Cloning parted & gnulib (this might take a few minutes)..."
> +_do_git_clone || _do_fail
> +echo "parted & gnulib cloned..."
> +
> +echo "Sanitiy checking..."
> +_do_sanity_check || _do_fail
> +
> +echo "Creating the release..."
> +_do_release || _do_fail
> +
> +_do_success
> --
> 1.6.0.6
>
>
> _______________________________________________
> parted-devel mailing list
> parted-devel at lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/parted-devel
--
Joel Andres Granados
Brno, Czech Republic, Red Hat.
-------------- next part --------------
#!/bin/bash
v=""
user=$(id -u)
date=$(date +%F)
logfile="release.log"
parted_dir=""
gnulib_dir=""
key_string=""
key_id=""
cur_dir="$(pwd)"
stage_dir="$(pwd)/parted_release-$$"
usage()
{
echo "Script for releasing parted."
echo
echo "$0 --version VERSION [--key-id KEYID --stage-dir DIR]"
echo
echo " --version VERSION The version of parted to be released"
echo " --key-id KEYID Your GPG key id. If not given, -s argument"
echo " of gpg will be used"
echo " --stage-dir The directory that will be used to stage the"
echo " release process"
}
# Get all the input values
while [ $# -gt 0 ] ; do
case $1 in
--key-id)
key_string="-u $2"
key_id="$2"
shift; shift
;;
# The version that is to be released
--version)
v="$2"
shift; shift
;;
--stage-dir)
stage_dir="$2"
shift; shift
;;
--help)
usage
exit 0
;;
# The default
*)
usage
exit 1
;;
esac
done
if [ "x$v" = "x" ] ; then
usage
exit 1
fi
if [ "x$key_string" = "x" -o "x$key_id" = "x" ] ; then
key_string="-s"
key_id="FIXME: YOUR_KEY"
fi
_do_git_clone()
{
{
git clone -q http://git.debian.org/git/parted/parted.git && \
git clone -q git://git.sv.gnu.org/gnulib
} || return 1
parted_dir="parted"
gnulib_dir="gnulib"
}
_require_git()
{
( git --version ) > /dev/null 2>&1 ||
{
echo "Could not find git. Pls install from http://git-scm.com/download."
exit 1
}
}
_do_sanity_check()
{
pushd $parted_dir
{
./bootstrap --gnulib-srcdir=../gnulib >> ../$logfile 2>&1 && \
./configure >> ../$logfile 2>&1 && \
make >> ../$logfile 2>&1 && \
sudo make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes \
>> ../$logfile 2>&1 && \
sudo chown $user.$user . -R >> ../$logfile 2>&1 && \
make distcheck >> ../$logfile 2>&1 && \
make maintainer-clean >> ../$logfile 2>&1 && \
popd \
return 0
} || {
popd
return 1
}
}
_do_release()
{
pushd $parted_dir
{
# Change the NEWS flie
news_line="* Noteworthy changes in release $v ($date) [stable]"
commit_message="version $v\n\n* NEWS: Record release date.\n"
sed -e "s/^.*in release.* (????-??-??) .*/$news_line/" \
-i NEWS && \
git commit -F <$(printf $commit_message) -a >> ../$logfile 2>&1 && \
git tag $key_string -m "parted $v" v$v HEAD && \
./bootstrap --gnulib-srcdir=../gnulib >> ../$logfile 2>&1 && \
./configure >> ../$logfile 2>&1 && \
make >> ../$logfile 2>&1 && \
make major >> ../$logfile 2>&1 && \
popd \
return 0
} || {
popd
return 1
}
}
_do_success()
{
echo "\
The release process has finished successfully. You are encouraged to follow
these steps:"
cat $parted_dir/README-release
exit 0
}
_do_fail()
{
echo "\
The process has returned an error please check the $logfile for more
information. Also check your global git configuration and network
configuration for possible overlooked issues.
"
exit 1
}
_require_git
echo "git is installed..."
mkdir -p "$stage_dir" || _do_fail
pushd "$stage_dir"
echo "Cloning parted & gnulib (this might take a few minutes)..."
_do_git_clone || $(popd && _do_fail)
echo "parted & gnulib cloned..."
echo "Sanitiy checking..."
_do_sanity_check || $(popd && _do_fail)
echo "Creating the release..."
_do_release || $(popd && _do_fail)
_do_success && popd
More information about the parted-devel
mailing list