jim-eventloop for MinGW-w64
[openocd.git] / tools / release.sh
index 21f9f04a87ca91382e34876e3aacf33b84a3c50a..f1ed4a73ada15cfeccfb53e518faf66b273f5d50 100755 (executable)
@@ -75,7 +75,7 @@ do_svn() {
        [ "${RELEASE_DRY_RUN}" ] || svn "$@"
 }
 do_svn_switch() {
-       do_svn switch "$1"
+       do_svn switch "$@"
        package_info_load
 }
 
@@ -97,7 +97,7 @@ package_info_load() {
 
        PACKAGE_VERSION="$(package_info_load_version)"
        [ "${RELEASE_VERSION}" ] || \
-               RELEASE_VERSION=${PACKAGE_VERSION/-in-development/}
+               RELEASE_VERSION=${PACKAGE_VERSION/-dev/}
 
        [ "${PACKAGE_NAME}" -a "${PACKAGE_VERSION}" ] || \
                die "package information is missing from configure script"
@@ -212,19 +212,6 @@ do_build() {
 maybe_build() { [ -f "src/openocd" ] || do_build; }
 do_build_clean() { [ -f Makefile ] && make maintainer-clean >/dev/null; }
 
-maybe_rebuild() {
-       if [ -f "configure" ]; then
-               echo "Re-running autoconf..."
-               autoconf
-               echo "Re-running automake..."
-               automake
-       fi
-       if [ -f "Makefile" ]; then
-               do_configure
-               do_build
-       fi
-}
-
 do_changelog() {
        echo "Updating working copy to HEAD..."
        do_svn update
@@ -262,7 +249,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/
@@ -288,9 +282,10 @@ do_version_usage() {
 usage: $0 version <command>
 Version Commands:
   tag {add|remove} <label>     Add or remove the specified tag.
-  bump {major|minor|micro|rc}  Bump the specified version number;
-                               resets less-significant numbers to zero.
-                              All but 'rc' releases drop that tag.
+  bump {major|minor|micro}     Bump the specified version number, and
+                               reset less-significant numbers to zero.
+  bump tag <label>             Add or bump a versioned tag (e.g. -rcN).
+  bump final <label>           Remove a versioned tag (e.g. -rcN).
 USAGE
 }
 
@@ -312,7 +307,6 @@ do_version_bump_sed() {
                "Bump ${CMD} package version number"
 }
 do_version_bump_major() {
-       has_version_tag 'rc\d' do_version_
        do_version_bump_sed "$((PACKAGE_MAJOR + 1)).0.0"
 }
 do_version_bump_minor() {
@@ -321,15 +315,32 @@ do_version_bump_minor() {
 do_version_bump_micro() {
        do_version_bump_sed "${PACKAGE_MAJOR_AND_MINOR}.$((PACKAGE_MICRO + 1))"
 }
-do_version_bump_rc() {
-       die "patch missing: -rc support is not implemented"
+do_version_bump_tag() {
+       local TAG="$1"
+       [ "${TAG}" ] || die "TAG argument is missing"
+       local TAGS="${PACKAGE_VERSION_TAGS}"
+       if has_version_tag "${TAG}"; then
+               local RC=$(do_version_tag_value "${TAG}")
+               RC=$((${RC} + 1))
+               TAGS=$(echo ${TAGS} | perl -npe "s/-${TAG}[\\d]*/-${TAG}${RC}/")
+       else
+               TAGS="-${TAG}1${PACKAGE_VERSION_TAGS}"
+       fi
+       PACKAGE_VERSION_TAGS="${TAGS}"
+       do_version_bump_sed "${PACKAGE_VERSION_BASE}"
+}
+do_version_bump_final() {
+       local TAG="$1"
+       [ "${TAG}" ] || die "TAG argument is missing"
+       has_version_tag "${TAG}" || die "-${TAG} tag is missing"
+       do_version_tag_remove "${TAG}$(do_version_tag_value "${TAG}")"
 }
 do_version_bump() {
        CMD="$1"
        shift
        case "${CMD}" in
-       major|minor|micro|rc)
-               eval "do_version_bump_${CMD}"
+       major|minor|micro|final|tag)
+               eval "do_version_bump_${CMD}" "$@"
                ;;
        *)
                do_version_usage
@@ -338,18 +349,23 @@ do_version_bump() {
 }
 
 has_version_tag() {
-       test "${PACKAGE_VERSION/-${TAG}/}" != "${PACKAGE_VERSION}"
+       test "${PACKAGE_VERSION/-${1}/}" != "${PACKAGE_VERSION}"
+}
+do_version_tag_value() {
+       local TAG="$1"
+       echo ${PACKAGE_VERSION_TAGS} | perl -ne "/-${TAG}"'(\d+)/ && print $1'
 }
-
 do_version_tag_add() {
        local TAG="$1"
-       has_version_tag && die "error: tag '-${TAG}' exists in '${PACKAGE_VERSION}'"
+       has_version_tag "${TAG}" && \
+               die "error: tag '-${TAG}' exists in '${PACKAGE_VERSION}'"
        do_version_sed "${PACKAGE_VERSION}-${TAG}" \
                "Add '-${TAG}' version tag"
 }
 do_version_tag_remove() {
        local TAG="$1"
-       has_version_tag || die "error: tag '-${TAG}' missing from '${PACKAGE_VERSION}'"
+       has_version_tag "${TAG}" || \
+               die "error: tag '-${TAG}' missing from '${PACKAGE_VERSION}'"
        do_version_sed "${PACKAGE_VERSION/-${TAG}/}" \
                "Remove '-${TAG}' version tag"
 }
@@ -382,13 +398,11 @@ do_version() {
        case "${CMD}" in
        tag|bump)
                do_version_commit "$(eval "do_version_${CMD}" "$@")"
-               maybe_rebuild
                ;;
        commit)
                local MSG="$1"
                [ "${MSG}" ] || die "usage: $0 version commit <message>"
                do_version_commit "${MSG}"
-               maybe_rebuild
                ;;
        *)
                do_version_usage
@@ -413,7 +427,7 @@ do_commit() {
        package_info_load
        svn_setup_load
 
-       [ "${PACKAGE_VERSION/in-development/}" = "${PACKAGE_VERSION}" ] || \
+       [ "${PACKAGE_VERSION/dev/}" = "${PACKAGE_VERSION}" ] || \
                die "'${PACKAGE_NAME}-${PACKAGE_VERSION}' cannot be released"
 
        [ "${PACKAGE_VERSION%.0}" = "${PACKAGE_VERSION}" ] || \
@@ -423,7 +437,7 @@ do_commit() {
 
 
 do_release_step_prep() {
-       do_version tag remove in-development
+       do_version tag remove dev
        # reset RELEASE_VERSION now to allow release version to be detected
        export RELEASE_VERSION=
 }
@@ -433,21 +447,20 @@ do_release_step_branch_bump() {
        local TYPE="$1"
        echo "Bump ${TYPE} version and add tag:"
        do_version_bump ${TYPE}
-       do_version_tag_add in-development
+       do_version_tag_add dev
 }
 do_release_step_branch() {
        do_svn_switch "${PACKAGE_BRANCH}"
        do_version_commit "$(do_release_step_branch_bump micro)"
        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}")"
-
-       [ "${RELEASE_TYPE}" = "micro" ] && return
-
+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}"
 
@@ -472,20 +485,35 @@ 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}"
 }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)