view contrib/builddeb @ 26593:c60dfcc0abf2

cvsps: fix computation of parent revisions when log caching is on cvsps computes the parent revisions of log entries by walking the cvs log sorted by (rcs, revision) and by iteratively maintaining a 'versions' dictionary which maps a (rcs, branch) pair onto the last revision seen for that pair. When log caching is on and a log cache exists, cvsps fails to set the parent revisions of new log entries because it does not iterate over the log cache in the parents computation. A complication is that a file rcs can change (move to/from the attic), with respect to its value in the log cache, if the file is removed/added back. This patch adds an iteration over the log cache to update the rcs of cached log entries, if changed, and to properly populate the 'versions' dictionary.
author Emanuele Giaquinta <emanuele.giaquinta@gmail.com>
date Wed, 07 Oct 2015 11:33:52 +0300
parents 7f49efcaa9b4
children 6474b64045fb
line wrap: on
line source

#!/bin/sh -e
#
# Build a Mercurial debian package from the current repo
#
# Tested on Jessie (stable as of original script authoring.)

. $(dirname $0)/packagelib.sh

BUILD=1
CLEANUP=1
DEBVERSION=jessie
while [ "$1" ]; do
    case "$1" in
    --release )
        shift
        DEBVERSION="$1"
        shift
        ;;
    --cleanup )
        shift
        BUILD=
        ;;
    --build )
        shift
        CLEANUP=
        ;;
    --debbuilddir )
        shift
        DEBBUILDDIR="$1"
        shift
        ;;
    * )
        echo "Invalid parameter $1!" 1>&2
        exit 1
        ;;
    esac
done

trap "if [ '$CLEANUP' ] ; then rm -r '$PWD/debian' ; fi" EXIT

set -u

if [ ! -d .hg ]; then
    echo 'You are not inside a Mercurial repository!' 1>&2
    exit 1
fi

gethgversion

control=debian/control
changelog=debian/changelog

if [ "$BUILD" ]; then
    if [ -d debian ] ; then
        echo "Error! debian control directory already exists!"
        exit 1
    fi

    cp -r $PWD/contrib/debian debian
    chmod -R 0755 debian

    # This looks like sed -i, but sed -i behaves just differently enough
    # between BSD and GNU sed that I gave up and did the dumb thing.
    sed "s/__VERSION__/$version/" < $changelog > $changelog.tmp
    date=$(date --rfc-2822)
    sed "s/__DATE__/$date/" < $changelog.tmp > $changelog
    rm $changelog.tmp

    debuild -us -uc -b
    if [ $? != 0 ]; then
        echo 'debuild failed!'
        exit 1
    fi

fi
if [ "$CLEANUP" ] ; then
    echo
    OUTPUTDIR=${OUTPUTDIR:=packages/debian-$DEBVERSION}
    find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
          -type f -newer $control -print0 | \
      xargs -Inarf -0 mv narf "$OUTPUTDIR"
    echo "Built packages for $version-$release:"
    find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
fi