packaging: move builddeb into contrib/packaging/
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 12 May 2018 10:31:34 -0700
changeset 38048 64b086f0ebb5
parent 38047 ea70512b1ad6
child 38049 c1a028d15005
packaging: move builddeb into contrib/packaging/ Differential Revision: https://phab.mercurial-scm.org/D3544
Makefile
contrib/builddeb
contrib/packaging/builddeb
contrib/packaging/dockerdeb
--- a/Makefile	Sat May 12 10:28:00 2018 -0700
+++ b/Makefile	Sat May 12 10:31:34 2018 -0700
@@ -204,10 +204,10 @@
 	  "$${OUTPUTDIR:-dist/}"/Mercurial-"$${HGVER}"-macosx"$${OSXVER}".pkg
 
 deb:
-	contrib/builddeb
+	contrib/packaging/builddeb
 
 ppa:
-	contrib/builddeb --source-only
+	contrib/packaging/builddeb --source-only
 
 contrib/packaging/docker/debian-%: contrib/packaging/docker/debian.template
 	sed "s/__CODENAME__/$*/" $< > $@
--- a/contrib/builddeb	Sat May 12 10:28:00 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#!/bin/sh -e
-#
-# Build a Mercurial debian package from the current repo
-#
-# Tested on Jessie (stable as of original script authoring.)
-
-. $(dirname $0)/packaging/packagelib.sh
-
-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
-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
-
-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
-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
-        echo "Error! debian control directory already exists!"
-        exit 1
-    fi
-
-    cp -r "$PWD"/contrib/debian debian
-
-    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"
-    "$PWD/hg" archive $SRCFILE
-    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"
-    find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
-          ../mercurial*.dsc ../mercurial*.gz \
-          -type f -newer $control -print0 2>/dev/null | \
-      xargs -Inarf -0 mv narf "$OUTPUTDIR"
-    echo "Built packages for $debver:"
-    find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
-fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/builddeb	Sat May 12 10:31:34 2018 -0700
@@ -0,0 +1,104 @@
+#!/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
+DISTID=`(lsb_release -is 2> /dev/null | tr '[:upper:]' '[:lower:]') || echo debian`
+CODENAME=`lsb_release -cs 2> /dev/null || echo unknown`
+DEBFLAGS=-b
+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
+
+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
+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
+        echo "Error! debian control directory already exists!"
+        exit 1
+    fi
+
+    cp -r "$PWD"/contrib/debian debian
+
+    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"
+    "$PWD/hg" archive $SRCFILE
+    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"
+    find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
+          ../mercurial*.dsc ../mercurial*.gz \
+          -type f -newer $control -print0 2>/dev/null | \
+      xargs -Inarf -0 mv narf "$OUTPUTDIR"
+    echo "Built packages for $debver:"
+    find "$OUTPUTDIR" -type f -newer $control -name '*.deb'
+fi
--- a/contrib/packaging/dockerdeb	Sat May 12 10:28:00 2018 -0700
+++ b/contrib/packaging/dockerdeb	Sat May 12 10:31:34 2018 -0700
@@ -27,8 +27,8 @@
             sh -c "cd /mnt/$dn && make clean && make local"
 fi
 $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
-  sh -c "cd /mnt/$dn && DEB_BUILD_OPTIONS='${DEB_BUILD_OPTIONS:=}' contrib/builddeb --build --distid $DISTID --codename $CODENAME $@"
-contrib/builddeb --cleanup --distid $DISTID --codename $CODENAME
+  sh -c "cd /mnt/$dn && DEB_BUILD_OPTIONS='${DEB_BUILD_OPTIONS:=}' contrib/packaging/builddeb --build --distid $DISTID --codename $CODENAME $@"
+contrib/packaging/builddeb --cleanup --distid $DISTID --codename $CODENAME
 if [ $(uname) = "Darwin" ] ; then
     $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
             sh -c "cd /mnt/$dn && make clean"