From 0e93231d997410481e41f07ce10aae31576864da Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 29 Mar 2019 11:01:22 +0100 Subject: [PATCH 1/3] Convert do_release.sh obsolete script to a release process documentation --- RELEASING.md | 107 ++++++++++++++++++++++++++++++++++++++++++ scripts/do_release.sh | 106 ----------------------------------------- 2 files changed, 107 insertions(+), 106 deletions(-) create mode 100644 RELEASING.md delete mode 100755 scripts/do_release.sh diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 000000000..39d3773af --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,107 @@ +# Picard release process + +## Ensure git repository tree is clean + +From the local repository: + +### Check out the repo master branch +```bash +git fetch $PICARD_REMOTE && git checkout master +``` + +### Ensure nothing is on the way + +```bash +git reset --hard $PICARD_REMOTE/master && git clean -f -d +``` + +#### Remove old compiled modules + +```bash +find . -type f -name '*.pyc' -exec rm -f {} \; +``` + +### Tag to save the current state + +```bash +git tag "before-release-$PICARD_VERSION" --force +``` + + +### Remove any BOM nasty bytes from files + +This shouldn't be needed, but better to check before releasing + +```bash +git ls-tree --full-tree -r HEAD --name-only |while read f; do sed -i '1s/^\xEF\xBB\xBF//' "$f"; done && git diff --quiet || git commit -a -m 'Remove nasty BOM bytes' +``` + +## Get latest translations from Transifex + +```bash +python setup.py get_po_files && git diff --quiet || git commit -m 'Update .po files' -- po/ +``` + +## Synchronize generated consts + +```bash +python setup.py update_constants && git diff --quiet || git commit -a -m 'Update constants' -- picard/const/*.py +``` + +## Synchronize picard.pot with sources + +python setup.py regen_pot_file && git diff --quiet || git commit -m 'Update pot file' -- po/picard.pot + + +## Update NEWS.txt + +TODO: explain how + + +## Update Picard version + +Edit `picard/__init__.py` and set new version tuple + +Run tests: + +```bash +python setup.py test +``` + +Commit changes! + + +## Tag new version + +```bash +git tag -s "$PICARD_RELEASE_TAG" -m "Release $PICARD_VERSION" +``` + +## Update Picard version to next dev version + +Edit `picard/__init__.py` and set new dev version tuple. + +Run tests: + +```bash +python setup.py test +``` + +Commit changes! + + +## Push new commits and tags to remote + +```bash +git push "$PICARD_REMOTE" master:master +git push "$PICARD_REMOTE" tag "$PICARD_RELEASE_TAG" +``` + +### To revert after push + +``` +git tag -d "release-$PICARD_VERSION" +git reset --hard "before-release-$PICARD_VERSION" +git push "$PICARD_REMOTE" :"$TAG" +git push "$PICARD_REMOTE" "before-release-$PICARD_VERSION":master --force +``` diff --git a/scripts/do_release.sh b/scripts/do_release.sh deleted file mode 100755 index fe651af4f..000000000 --- a/scripts/do_release.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -set -e -#set -x - -# Helper script for the release process - -############################################################################# -# WARNING: you have to know what you are doing before executing this script # -# # -# You have to edit Variables section before anything else # -############################################################################# - -# Better to test on your own remote repo first ! - -# Copy this script outside your repo -#  cp ./scripts/do_release.sh ~ -# edit it: -#  gvim ~/do_release.sh -# run it: -# ~/do_release.sh - -# comment out this line after editing following variables -echo "Copy this script outside the source tree, and modify it !"; exit 1 - -# Variables - -PICARD_REPO_PATH=/home/zas/src/picard_zas -PICARD_REMOTE=origin -PICARD_VERSION="1.3" -PICARD_VERSION_TUPLE="(1, 3, 0, 'final', 0)" -PICARD_NEXT_VERSION="1.4" -PICARD_NEXT_VERSION_TUPLE="(1, 4, 0, 'dev', 1)" -PICARD_RELEASE_TAG="release-$PICARD_VERSION" - - -echo "=== Preparing for $PICARD_VERSION release ===" - -echo "=== Ensure git repository tree is clean ===" - -cd "$PICARD_REPO_PATH" || exit 1 -git fetch $PICARD_REMOTE && git checkout master && git reset --hard $PICARD_REMOTE/master && git clean -f -d -git tag "before-release-$PICARD_VERSION" --force - -echo "=== Remove old compiled modules in case of ===" -find "$PICARD_REPO_PATH" -type f -name '*.pyc' -exec rm -f {} \; - - -echo "=== Remove any BOM nasty bytes from files ===" - -# this shouldn't be needed, but better to check before releasing -git ls-tree --full-tree -r HEAD --name-only |while read f; do sed -i '1s/^\xEF\xBB\xBF//' "$f"; done && git diff --quiet || git commit -a -m 'Remove nasty BOM bytes' - - -echo "=== Get latest translations from Transifex ===" - -python setup.py get_po_files && git diff --quiet || git commit -m 'Update .po files' -- po/ - - -echo "=== Ensure generated consts are in sync with MB server ===" - -python setup.py update_constants && git diff --quiet || git commit -a -m 'Update constants' -- picard/const/attributes.py picard/const/countries.py - - -echo "=== Be sure picard.pot is in sync with sources ===" - -python setup.py regen_pot_file && git diff --quiet || git commit -m 'Update pot file' -- po/picard.pot - - -echo "=== Set date in NEWS.txt ===" - -OLD=$PICARD_VERSION; NEW=$PICARD_NEXT_VERSION; \ -sed -i -e "s/^Version [^ ]\+ - xxxx-xx-xx\s*$/Version $OLD - "$(date +%F -u)"/" -e "1s/^/Version $NEW - xxxx-xx-xx\n\n/" NEWS.txt \ -&& git diff --quiet || git commit -m "Update release date for version $OLD" -- NEWS.txt - - -echo "=== Update Picard version ===" - -sed -i "s/^PICARD_VERSION = \(.*\)$/PICARD_VERSION = $PICARD_VERSION_TUPLE/" picard/__init__.py \ -&& python setup.py test && git diff --quiet || git commit -m "Update version to $PICARD_VERSION" -- picard/__init__.py - - -echo "=== Tag new version ===" - -git tag -s "$PICARD_RELEASE_TAG" -m "Release $PICARD_VERSION" - -echo "=== Update Picard version to next dev ===" - -sed -i "s/^PICARD_VERSION = \(.*\)$/PICARD_VERSION = $PICARD_NEXT_VERSION_TUPLE/" picard/__init__.py \ -&& python setup.py test && git diff --quiet || git commit -m "Update version to $PICARD_NEXT_VERSION dev" -- picard/__init__.py - -echo "=== Push new commits to master branch ===" - -echo "**** TO PUSH ****" -cat <<-EOF -git push "$PICARD_REMOTE" master:master -git push "$PICARD_REMOTE" tag "$PICARD_RELEASE_TAG" -EOF - -echo "**** To revert after push ****" -cat <<-EOF -git tag -d "release-$PICARD_VERSION" -git reset --hard "before-release-$PICARD_VERSION" -git push "$PICARD_REMOTE" :"$TAG" -git push "$PICARD_REMOTE" "before-release-$PICARD_VERSION":master --force -EOF From 53036a190d42e3334a6daa66653cb592bc63bd7f Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 29 Mar 2019 11:08:57 +0100 Subject: [PATCH 2/3] Cleanup --- RELEASING.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 39d3773af..49cba4bb6 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,10 +1,11 @@ # Picard release process -## Ensure git repository tree is clean +## Ensure git repository tree is clean From the local repository: ### Check out the repo master branch + ```bash git fetch $PICARD_REMOTE && git checkout master ``` @@ -21,13 +22,12 @@ git reset --hard $PICARD_REMOTE/master && git clean -f -d find . -type f -name '*.pyc' -exec rm -f {} \; ``` -### Tag to save the current state +### Tag to save the current state ```bash git tag "before-release-$PICARD_VERSION" --force ``` - ### Remove any BOM nasty bytes from files This shouldn't be needed, but better to check before releasing @@ -48,17 +48,17 @@ python setup.py get_po_files && git diff --quiet || git commit -m 'Update .po fi python setup.py update_constants && git diff --quiet || git commit -a -m 'Update constants' -- picard/const/*.py ``` -## Synchronize picard.pot with sources +## Synchronize picard.pot with sources +```bash python setup.py regen_pot_file && git diff --quiet || git commit -m 'Update pot file' -- po/picard.pot - +``` ## Update NEWS.txt TODO: explain how - -## Update Picard version +## Update Picard version Edit `picard/__init__.py` and set new version tuple @@ -99,7 +99,7 @@ git push "$PICARD_REMOTE" tag "$PICARD_RELEASE_TAG" ### To revert after push -``` +```bash git tag -d "release-$PICARD_VERSION" git reset --hard "before-release-$PICARD_VERSION" git push "$PICARD_REMOTE" :"$TAG" From 4de73a6af368026bd391d8f892a6fe77b0d2b29a Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Fri, 29 Mar 2019 12:17:35 +0100 Subject: [PATCH 3/3] Add some details, re-order a bit --- RELEASING.md | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/RELEASING.md b/RELEASING.md index 49cba4bb6..f974f4e84 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -1,5 +1,17 @@ # Picard release process + +## Release preparation (few weeks/days before) + + +### Synchronize picard.pot with sources + +```bash +python setup.py regen_pot_file && git diff --quiet || git commit -m 'Update pot file' -- po/picard.pot +``` + +And push changes to main remote repository, see [po/README.md](po/README.md) for details about translations + ## Ensure git repository tree is clean From the local repository: @@ -16,6 +28,7 @@ git fetch $PICARD_REMOTE && git checkout master git reset --hard $PICARD_REMOTE/master && git clean -f -d ``` + #### Remove old compiled modules ```bash @@ -48,12 +61,6 @@ python setup.py get_po_files && git diff --quiet || git commit -m 'Update .po fi python setup.py update_constants && git diff --quiet || git commit -a -m 'Update constants' -- picard/const/*.py ``` -## Synchronize picard.pot with sources - -```bash -python setup.py regen_pot_file && git diff --quiet || git commit -m 'Update pot file' -- po/picard.pot -``` - ## Update NEWS.txt TODO: explain how @@ -77,6 +84,9 @@ Commit changes! git tag -s "$PICARD_RELEASE_TAG" -m "Release $PICARD_VERSION" ``` +Stable release tags have the following format: `release-#.#.#` +Example: `release-2.1.0` + ## Update Picard version to next dev version Edit `picard/__init__.py` and set new dev version tuple.