builddeb: read default distribution and codename from lsb_release
authorAnton Shestakov <av6@dwimlabs.net>
Wed, 25 Nov 2015 18:07:33 +0800
changeset 27212 ef9301ce6046
parent 27211 a624bae2aebf
child 27213 ccae1588117f
builddeb: read default distribution and codename from lsb_release This makes `make deb` place packages into a more appropriately named directory instead of just "debian-unknown".
Makefile
contrib/builddeb
--- a/Makefile	Wed Nov 25 15:26:03 2015 +0800
+++ b/Makefile	Wed Nov 25 18:07:33 2015 +0800
@@ -161,8 +161,7 @@
 	rm -rf dist/mercurial-*.mpkg
 
 deb:
-	mkdir -p packages/debian-unknown
-	contrib/builddeb --distid debian --codename unknown
+	contrib/builddeb
 
 docker-debian-jessie:
 	mkdir -p packages/debian-jessie
--- a/contrib/builddeb	Wed Nov 25 15:26:03 2015 +0800
+++ b/contrib/builddeb	Wed Nov 25 18:07:33 2015 +0800
@@ -8,8 +8,8 @@
 
 BUILD=1
 CLEANUP=1
-DISTID=debian
-CODENAME=jessie
+DISTID=`(lsb_release -is 2> /dev/null | tr '[:upper:]' '[:lower:]') || echo debian`
+CODENAME=`lsb_release -cs 2> /dev/null || echo unknown`
 while [ "$1" ]; do
     case "$1" in
     --distid )
@@ -84,6 +84,7 @@
 if [ "$CLEANUP" ] ; then
     echo
     OUTPUTDIR=${OUTPUTDIR:=packages/$DISTID-$CODENAME}
+    mkdir -p "$OUTPUTDIR"
     find ../mercurial*.deb ../mercurial_*.build ../mercurial_*.changes \
           -type f -newer $control -print0 | \
       xargs -Inarf -0 mv narf "$OUTPUTDIR"