8 stage_dir="$(pwd)/parted_release-$$"
12 echo "Script for releasing parted."
14 echo "$0 --version VERSION [--key-id KEYID --stage-dir DIR]"
16 echo " --version VERSION The version of parted to be released"
17 echo " --key-id KEYID Your GPG key id. If not given, -s argument"
18 echo " of gpg will be used"
19 echo " --stage-dir The directory that will be used to stage the"
20 echo " release process"
23 # Get all the input values
24 while [ $# -gt 0 ] ; do
32 # The version that is to be released
59 # If its already set, return.
60 if [ "x$key_id" != "x" ] ; then
64 # Maybe the global git config has the key :)
65 key_id=$(git config user.signingkey)
66 if [ "x$key_id" != "x" ] ; then
70 # Lets ask gpg using git config user.email. We will choose the first
71 # one in case of multiple keys with the same email.
72 git_uemail=$(git config user.email)
73 if [ "x$git_uemail" != "x" ] ; then
74 key_id=$(gpg --list-keys --with-colons --fixed-list "$git_uemail" |
77 awk -F ':' '{print $5}' |
79 if [ "x$key_id" != "x" ] ; then
84 # Lets try with the name.
85 git_uname=$(git config user.name)
86 if [ "x$git_uname" != "x" ] ; then
87 key_id=$(gpg --list-keys --with-colons --fixed-list "$git_uname" |
90 awk -F ':' '{print $5}' |
92 if [ "x$key_id" != "x" ] ; then
97 # Don't know where else to look.
98 echo "There was an error finding the key needed to sing the release tag."
99 echo "Please use the --key-id argument when you execute $0 or set the"
100 echo "user.signingkey value in your ~/.gitconfig"
106 git clone git://git.debian.org/git/parted/parted.git || return 1
112 ( git --version ) > /dev/null 2>&1 ||
114 echo "Could not find git. Please install from http://git-scm.com/download."
126 sudo make check RUN_VERY_EXPENSIVE_TESTS=yes RUN_EXPENSIVE_TESTS=yes && \
128 make maintainer-clean && \
130 ) >> $logfile 2>&1 || return 1
136 news_line="* Noteworthy changes in release $v ($date) [stable]"
137 commit_message="version $v\n\n* NEWS: Record release date.\n"
138 sed -e "s/^.*in release.* (????-??-??) .*/$news_line/" -i NEWS && \
139 printf "$commit_message" | git commit NEWS -F - && \
140 git tag -u $key_id -m "parted $v" v$v HEAD && \
144 make major gpg_key_ID=$key_id && \
146 ) >> $logfile 2>&1 || return 1
152 The release process has finished successfully. You are encouraged to follow
154 cat $parted_dir/README-release
161 The process has returned an error please check the $logfile for more
162 information. Also check your global git configuration and network
163 configuration for possible overlooked issues.
168 if [ "x$v" = "x" ] ; then
173 if [ "x$key_id" = "x" ] ; then
178 echo "git is installed..."
180 mkdir -p "$stage_dir" || exit 1
183 echo "Cloning parted (this might take a few minutes)..."
184 _do_git_clone || _do_fail
185 echo "parted cloned..."
187 echo "Sanity checking..."
188 _do_sanity_check || _do_fail
190 echo "Creating the release..."
191 _do_release || _do_fail