##// END OF EJS Templates
contrib: add a hint if the Windows dependency MSI is already installed...
contrib: add a hint if the Windows dependency MSI is already installed In the past, I've gotten confused when the script failed on seemingly random python installs (and thus the py3.8 install was commented out from the last time this happened to me, which has been reverted here). This particular error code means the package was already installed. For python, it means the major and minor version are the same, but the micro version may differ. In practice, ignoring the python installation failure will cause the pip installation that happens next to fail, because python.exe for that version is somewhere else on the system. This could probably be fixed by running py.exe with the major and minor version, but that is skipped during the install for some reason. I didn't feel like over complicating this though, and at least there's a better hint when the problem occurs. Differential Revision: https://phab.mercurial-scm.org/D12560

File last commit:

r43624:4caf8884 stable
r49955:246ee748 default
Show More
builddeb
115 lines | 2.6 KiB | text/plain | TextLexer
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 #!/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
Gregory Szorc
packaging: make packaging scripts less reliant on pwd...
r38033 ROOTDIR=$(cd $(dirname $0)/../.. > /dev/null; pwd)
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 BUILD=1
CLEANUP=1
DISTID=`(lsb_release -is 2> /dev/null | tr '[:upper:]' '[:lower:]') || echo debian`
CODENAME=`lsb_release -cs 2> /dev/null || echo unknown`
DEBFLAGS=-b
muxator
packaging: blindly factor out trap's cleanup function in builddeb...
r40140
cleanup() {
muxator
packaging: cleanup() did not read the value of $CLEANUP...
r40142 if [ "$CLEANUP" ]; then
muxator
packaging: "make deb" no longer fails...
r40143 rm -r "$ROOTDIR/debian";
muxator
packaging: blindly factor out trap's cleanup function in builddeb...
r40140 fi
}
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 while [ "$1" ]; do
case "$1" in
--distid )
shift
DISTID="$1"
shift
;;
--codename )
shift
CODENAME="$1"
shift
;;
--cleanup )
shift
BUILD=
;;
--build )
shift
CLEANUP=
;;
--source-only )
shift
DEBFLAGS=-S
;;
* )
echo "Invalid parameter $1!" 1>&2
exit 1
;;
esac
done
muxator
packaging: "make deb" no longer fails...
r40143 cd "$ROOTDIR"
muxator
packaging: blindly factor out trap's cleanup function in builddeb...
r40140 trap 'cleanup' EXIT
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026
set -u
if [ ! -d .hg ]; then
muxator
packaging: print more specific error messages when builddeb fails
r40138 printf "You are inside %s, which is not the root of a Mercurial repository\n" $(pwd) 1>&2
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 exit 1
fi
gethgversion
debver="$version"
if [ -n "$type" ] ; then
debver="$debver~$type"
fi
if [ -n "$distance" ] ; then
debver="$debver+$distance-$CODENAME-$node"
elif [ "$DEBFLAGS" = "-S" ] ; then
# for building a ppa (--source-only) for a release (distance == 0), we need
# to version the distroseries so that we can upload to launchpad
debver="$debver~${CODENAME}1"
fi
control=debian/control
changelog=debian/changelog
if [ "$BUILD" ]; then
if [ -d debian ] ; then
muxator
packaging: print more specific error messages when builddeb fails
r40138 printf "Error! debian control directory already exists at %s/debian\n" $(pwd)
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 exit 1
fi
Gregory Szorc
packaging: make packaging scripts less reliant on pwd...
r38033 cp -r "$ROOTDIR"/contrib/packaging/debian debian
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026
sed -i.tmp "s/__VERSION__/$debver/" $changelog
sed -i.tmp "s/__DATE__/$(date --rfc-2822)/" $changelog
sed -i.tmp "s/__CODENAME__/$CODENAME/" $changelog
rm $changelog.tmp
# remove the node from the version string
SRCFILE="mercurial_$(echo $debver | sed "s,-$node,,").orig.tar.gz"
Gregory Szorc
packaging: make packaging scripts less reliant on pwd...
r38033 "$ROOTDIR/hg" archive $SRCFILE
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 mv $SRCFILE ..
debuild -us -uc -i -I $DEBFLAGS
if [ $? != 0 ]; then
echo 'debuild failed!'
exit 1
fi
fi
if [ "$CLEANUP" ] ; then
echo
OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
mkdir -p "$OUTPUTDIR"
Denis Laxalde
packaging: also move Debian .buildinfo file in output directory
r43624 find ../mercurial*.deb ../mercurial_*.build* ../mercurial_*.changes \
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 ../mercurial*.dsc ../mercurial*.gz \
-type f -newer $control -print0 2>/dev/null | \
xargs -Inarf -0 mv narf "$OUTPUTDIR"
echo "Built packages for $debver:"
Denis Laxalde
packaging: fix path where .deb files are looked for...
r43617 find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
Gregory Szorc
packaging: move builddeb into contrib/packaging/...
r38026 fi