Add workaround to release script to update source code URL keyword.
[fw/openocd] / tools / release.sh
index 583cd20c075828c628f0ef7cc09ee31390121460..c6ab64fe7c824ba564628be2b8d2c5f5eaca5796 100755 (executable)
@@ -74,6 +74,10 @@ do_svn() {
        do_svn_echo "$@"
        [ "${RELEASE_DRY_RUN}" ] || svn "$@"
 }
+do_svn_switch() {
+       do_svn switch "$@"
+       package_info_load
+}
 
 
 package_info_load_name() {
@@ -258,7 +262,14 @@ do_stage() {
        echo "Staging package archives:"
        mkdir -p archives
        for EXT in tar.gz tar.bz2 zip; do
-               mv -v "${PACKAGE_RELEASE}.${EXT}" archives/
+               local FILE="${PACKAGE_RELEASE}.${EXT}"
+               # create archive signatures
+               for HASH in md5 sha1; do
+                       echo "sign: ${FILE}.${HASH}"
+                       ${HASH}sum "${FILE}" > "archives/${FILE}.${HASH}"
+               done
+               # save archive
+               mv -v "${FILE}" archives/
        done
        cp -a NEWS archives/
        cp -a ChangeLog archives/
@@ -432,18 +443,17 @@ do_release_step_branch_bump() {
        do_version_tag_add in-development
 }
 do_release_step_branch() {
-       do_svn switch "${PACKAGE_BRANCH}"
-       package_info_load
+       do_svn_switch "${PACKAGE_BRANCH}"
        do_version_commit "$(do_release_step_branch_bump micro)"
-       do_svn switch "${SVN_URL}"
-       package_info_load
+       do_svn_switch "${SVN_URL}"
 }
-do_release_step_bump() {
-       # major and minor releases require branch version update too
-       [ "${RELEASE_TYPE}" = "micro" ] || do_release_step_branch
-       # bump the current tree version as required.
-       do_version_commit "$(do_release_step_branch_bump "${RELEASE_TYPE}")"
-
+do_release_step_news_msg() {
+       cat <<MSG
+Archive released NEWS file: NEWS -> NEWS-${RELEASE_VERSION}
+Create new NEWS file from relesse script template.
+MSG
+}
+do_release_step_news() {
        # archive NEWS and create new one from template
        do_svn move "NEWS" "NEWS-${RELEASE_VERSION}"
 
@@ -468,20 +478,36 @@ For more information about contributing test reports, bug fixes, or new
 features and device support, please read the new Developer Manual (or
 the BUGS and PATCHES files in the source archive).
 NEWS
+       do_svn add NEWS
 
-       MSG=<<MSG
-Archive released NEWS file: NEWS -> NEWS-${RELEASE_VERSION}
-Create new NEWS file from relesse script template.
-MSG
+       local MSG="$(do_release_step_news_msg)"
        do_svn commit -m "${MSG}" NEWS NEWS-${RELEASE_VERSION}
 }
+do_release_step_bump() {
+       # major and minor releases require branch version update too
+       [ "${RELEASE_TYPE}" = "micro" ] || do_release_step_branch
+       # bump the current tree version as required.
+       do_version_commit "$(do_release_step_branch_bump "${RELEASE_TYPE}")"
+
+       [ "${RELEASE_TYPE}" = "micro" ] || do_release_step_news
+}
 do_release_step_package() {
        local A=${PACKAGE_TAG}
        local B=${A/https/http}
        local PACKAGE_BUILD=${B/${USER}@/}
-       do_svn switch "${PACKAGE_BUILD}"
+
+       do_svn_switch "${PACKAGE_TAG}"
+       do_svn_switch --relocate "${PACKAGE_TAG}" "${PACKAGE_BUILD}"
+
+       # required to force SVN to update the in-source URL keyword
+       [ "${RELEASE_DRY_RUN}" ] || rm -v -f src/openocd.c
+       do_svn revert src/openocd.c
+
        do_stage
        do_clean
+
+       do_svn_switch --relocate "${PACKAGE_BUILD}" "${PACKAGE_TAG}"
+       do_svn_switch "${SVN_URL}"
 }
 
 do_release_step_1() { do_release_step_prep; }