Hi,

I've written a guide to creating stable snapshots, and a
script to help with the cherry-picking (both attached).

If you feel they are appropriate to be in the gnulib tree, feel free.
If so, would you prefer the guide in another format, eg texinfo?. If
not, well, they are now in the list archive and at:

http://erislabs.net/ianb/projects/gnulib/STABLE-HOWTO.html

http://erislabs.net/ianb/projects/gnulib/stable-cherry-pick

cheers,

Ian.

-- 
Ian Beckwith - i...@erislabs.net - http://erislabs.net/ianb/
GPG fingerprint: AF6C C0F1 1E74 424B BCD5  4814 40EC C154 A8BA C1EA
Listening to: Tom Waits - Bone Machine - Whistle Down the Wind
                 How to make a gnulib stable snapshot
                 ------------------------------------

by Ian Beckwith <i...@erislabs.net>
Last Update: Tue Apr 24 2010
Latest Version: http://erislabs.net/projects/gnulib/STABLE-HOWTO.html

BRANCHES

   * upstream - tracks git://git.savannah.gnu.org/gnulib.git
   * stable   - the stable snapshot we produce, based on upstream
   * master   - the debian branch, based on stable (optional)

PROCEDURE

   * if you don't already have a repository:

     + clone the gnulib repo:
         $ git clone git://git.savannah.gnu.org/gnulib.git
         $ git branch -m master upstream

     + then either import the existing stable repo:
         $ git remote add erislabs git://erislabs.net/gnulib.git
         $ git fetch erislabs
         $ git branch stable erislabs/stable

     + or, if that isn't possible, start from scratch:
         $ git branch stable upstream

   * update upstream branch:
         $ git checkout upstream
         $ git pull

   * tag the current upstream HEAD for later use:
         $ git tag snapshot-start upstream

   * run the test suite:
         $ git checkout upstream
         $ ./gnulib-tool --create-megatestdir --with-tests  --dir=t 2>&1 | tee 
create.out
         $ cd t
         $ ./do-autobuild 2>&1 | tee ../build.out
         $ cd ..

   * find failing tests with:
         $ grep -L rc=0 t/logs/*

   * report any issues to bug-gnulib@gnu.org

   * merge the current upstream version into the stable branch:
         $ git checkout stable
         $ git merge upstream

   * resolve conflicts
         $ git checkout upstream <all conflicting paths except NEWS.stable>
         $ git commit -a

   * wait a week or so

   * update upstream branch:
         $ git checkout upstream
         $ git pull

   * create list of commits to review:
         $ git log --oneline --reverse --topo-order snapshot-start..upstream > 
../stable.log

   * return to the stable branch
         $ git checkout stable

   * prepare NEWS.stable for new release.

     + add new header

     + add __NEXTCOMMITMARKER__ tag where you want commits to be logged

   * for each commit in ../stable.log:

     + review each commit in ../stable.log:
         $ git show commitid

     + if you want to cherry-pick that commit:
         $ stable-cherry-pick commitid
       (stable-cherry-pick source: 
http://erislabs.net/ianb/projects/gnulib/stable-cherry-pick)

     + if the cherry-pick fails:

       * resolve the conflict and commit, making a note of the new commitid

       * fill in the new commitid in NEWS.stable, then commit

   * remove __NEXTCOMMIT__ marker from NEWS.stable, commit

   * test (see above). If testsuite fails, check whether bug exists
     in upstream branch, report to bug-gnu...@gnu.org.

   * remove the temporary snapshot-start tag
          $ git tag -d snapshot-start

   * tag the new release
          $ git tag stable/yymmdd

   * create and upload tarball:
          $ git archive --format=tar --prefix=gnulib-yymmdd-stable/ 
stable/yymmdd | gzip -9 > ../gnulib-yymmdd-stable.tar.gz

   * push changes to stable git repository

   * mail announcement to bug-gnulib@gnu.org
#!/bin/sh
# stable-cherry-pick -- Cherry-pick commits into current branch and
#   log them to NEWS.stable. See STABLE-HOWTO for more info,
#   also at http://erislabs.net/projects/gnulib/STABLE-HOWTO.html

# Copyright (C) 2009-2010 Free Software Foundation, Inc.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Written by Ian Beckwith <i...@erislabs.net> 20091114

PROGNAME="$(basename "$0")"
NEXTCOMMITMARKER="__NEXTCOMMITMARKER__"
NEWS="NEWS.stable"
TMP="$NEWS.tmp"

warn ()
{
    echo "$PROGNAME: $1"
    shift
    while [ $# -gt 0 ]; do
        echo " $1"
        shift
    done
}

fail ()
{
    warn "$@"
    exit 1
}

if [ $# -ne 1 ]; then
    echo "usage: $PROGNAME COMMIT-ID"
    echo " cherry-picks COMMIT-ID into current branch and logs it to $NEWS"
    exit 1
fi

COMMIT="$1"
git show "$COMMIT" > /dev/null 2>&1
if [ $? -ne 0 ];then
    fail "commit $COMMIT not found"
fi

SHORTCOMMIT="$(git log -1 --format=%h "$COMMIT")"
SUBJECT="$(git log -1 --format=%s "$COMMIT")"
CHERRYOUT="$(git cherry-pick -x "$COMMIT")"
CHERRYRES=$?
echo "$CHERRYOUT"
if [ $CHERRYRES -ne 0 ];then
     warn "cherry-pick failed, logging without new commit-id." \
          "Resolve conflicts, commit then add new commit-id to ${NEWS}."
     CHERRYSHORTCOMMIT=""
else
    CHERRYFULLCOMMIT=$(echo "$CHERRYOUT" | grep '^\[[^ ]\+ [a-fA-F0-9]\+\] ' 
|sed 's/^\[[^ ]\+ \([a-fA-F0-9]\+\)\].*/\1/;')
    CHERRYSHORTCOMMIT="$(git log -1 --format=%h "$CHERRYFULLCOMMIT")"
fi

MESSAGE="[$SHORTCOMMIT]->[$CHERRYSHORTCOMMIT] $SUBJECT"
echo "    * $MESSAGE"

if [ ! -f "$NEWS" ]; then
    fail "$NEWS not found, not logging"
fi

if ! grep -q "$NEXTCOMMITMARKER" "$NEWS"; then
    fail "commit marker $NEXTCOMMITMARKER not found in ${NEWS}, not logging"
fi

sed "/$NEXTCOMMITMARKER/Q" < "$NEWS" > "$TMP"

echo "    * $MESSAGE" >> "$TMP"

sed -n  "/$NEXTCOMMITMARKER/,\$p" < "$NEWS" >> "$TMP"

mv "$TMP" "$NEWS"

if [ $? -ne 0 ]; then
    fail "failed to rename $TMP to $NEWS"
fi

# If cherry-pick succeeded, commit changes to $NEWS
if [ -n "$CHERRYSHORTCOMMIT" ]; then
    git add "$NEWS"
    git commit -m "$NEWS: log cherry-pick $MESSAGE"
fi

Attachment: signature.asc
Description: Digital signature

Reply via email to