Updated Slovenian translation
[banshee.git] / extras / make-release
blob98c55b42e4ae8ca75a7a3c04b674b26790244584
1 #!/bin/bash
3 function preparing_to () {
4 for ((i=10; i > 0; i--)); do
5 printf "\rPreparing to %s in %d ... " "$1" $i
6 sleep 1
7 done
8 printf "\rRunning %s ... \n\n" "$1"
11 function bail () {
12 echo "Error: $@" 1>&2
13 exit 1
16 PACKAGE_INFO=$(./configure -V | head -n1)
17 PACKAGE_NAME=$(echo "$PACKAGE_INFO" | cut -f1 -d' ')
18 PACKAGE_VERSION=$(echo "$PACKAGE_INFO" | cut -f3 -d' ')
19 TAG_NAME="${PACKAGE_VERSION}"
21 RELEASE_TYPE="stable"
22 [[ "x$1" = "x--unstable" ]] && RELEASE_TYPE="unstable"
24 RELEASE_RC_FILE="release-rc"
25 . "$RELEASE_RC_FILE" 2>/dev/null \
26 || bail "Could not load release RC file: '$RELEASE_RC_FILE'"
28 [[ -z "${PACKAGE_NAME}" || -z "${PACKAGE_VERSION}" ]] \
29 && bail "Could not figure out package information. Do you have a configure?"
31 cat <<EOF
32 Release Summary
34 Package: ${PACKAGE_NAME}
35 Version: ${PACKAGE_VERSION}
36 Release: ${RELEASE_TYPE}
38 Release Upload:
39 User: ${WEB_USER}
40 Host: ${WEB_HOST}
41 Path: ${WEB_PATH}
42 DOAP: ${WEB_DOAP_PATH}
44 git tag: ${TAG_NAME}
46 OS X Build Configuration:
47 EOF
49 if [[ -z $OSX_USER ]]; then
50 echo " Disabled"
51 else
52 cat <<EOF
53 User: ${OSX_USER}
54 Host: ${OSX_HOST}
55 Path: ${OSX_BUILD_DIR}
56 git: ${OSX_GIT}
57 EOF
60 echo
61 read -p "Press enter if the configuration is correct..."
62 echo
64 function hook_defined () {
65 type $1 2>/dev/null | grep -q function
68 function run_hook () {
69 hook_defined $1 && $1
72 function distcheck () {
73 preparing_to "make distcheck"
74 make distcheck || bail "distcheck failed"
77 function prepare_upload () {
78 preparing_to "create upload data"
80 rm -rf release-data
81 mkdir release-data || bail "Could not create release directory"
83 find -maxdepth 1 \( \
84 -name \*.zip -o \
85 -name \*.bz2 -o \
86 -name \*.gz -o \
87 -name \*.dmg \
88 \) -exec cp -a {} release-data \;
90 cp -a NEWS release-data/${PACKAGE_NAME}-${PACKAGE_VERSION}.news \
91 || bail "Could not copy NEWS file"
93 (cd release-data && {
94 sha256sum * > ${PACKAGE_NAME}-${PACKAGE_VERSION}.sha256sum \
95 || bail "Could not sha256sum the release files"
96 }) || exit 1
99 function upload_release () {
100 preparing_to "upload release files"
102 scp -r release-data ${WEB_USER}@${WEB_HOST}:${WEB_PATH}/${PACKAGE_VERSION} \
103 || bail "Uploading release failed"
105 ( ssh ${WEB_USER}@${WEB_HOST} rm -f ${WEB_PATH}/LATEST-IS\* &&
106 ssh ${WEB_USER}@${WEB_HOST} ln -s ${PACKAGE_VERSION} \
107 ${WEB_PATH}/LATEST-IS-${PACKAGE_VERSION} ) \
108 || bail "Could not create the LATEST-IS-${PACKAGE_VERSION} link"
110 rm -rf release-data
112 [[ -z "${WEB_DOAP_PATH}" ]] || {
113 scp *.doap ${WEB_USER}@${WEB_HOST}:${WEB_DOAP_PATH} \
114 || bail "Could not upload DOAP file"
118 function tag_release () {
119 preparing_to "tag release as '${TAG_NAME}'"
120 git tag -a -m "${PACKAGE_VERSION} ${RELEASE_TYPE} release" \
121 ${TAG_NAME} || bail "Could not create tag"
122 git push origin ${TAG_NAME} || bail "Failed to push tag to remote"
125 function post_release () {
126 firefox "http://bugzilla.gnome.org/editversions.cgi?action=new&product=banshee&version=${PACKAGE_VERSION}"
129 # Build the OS X binary
130 function osx_run_remote () {
131 ssh ${OSX_USER}@${OSX_HOST} "cd ${OSX_BUILD_DIR}; $@"
134 function osx_build_dmg () {
135 osx_run_remote ${OSX_GIT} pull \
136 || bail "Could not update git clone"
138 scp ${PACKAGE_NAME}-${PACKAGE_VERSION}.tar.bz2 \
139 ${OSX_USER}@${OSX_HOST}:${OSX_BUILD_DIR} \
140 || bail "Could not transfer tarball to OS X build machine"
142 osx_run_remote ./release.sh ${PACKAGE_VERSION} \
143 || bail "OS X build failed"
145 scp ${OSX_USER}@${OSX_HOST}:${OSX_BUILD_DIR}/${PACKAGE_NAME}-${PACKAGE_VERSION}\*.dmg . \
146 || bail "Could not fetch DMG image from OS X build machine"
149 distcheck
150 if [[ -z $OSX_USER ]]; then
151 echo "Skipping OS X build"
152 else
153 osx_build_dmg
155 prepare_upload
156 upload_release
157 tag_release
158 post_release
160 echo
161 echo "Congratulations, you have released ${PACKAGE_VERSION}!"
162 echo