Patchwork [4,of,4] builddeb: read default distribution and codename from lsb_release

login
register
mail settings
Submitter Anton Shestakov
Date Dec. 3, 2015, 12:09 p.m.
Message ID <17345ef3dd8a77492b67.1449144593@neuro>
Download mbox | patch
Permalink /patch/11783/
State Accepted
Headers show

Comments

Anton Shestakov - Dec. 3, 2015, 12:09 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1448446053 -28800
#      Wed Nov 25 18:07:33 2015 +0800
# Node ID 17345ef3dd8a77492b67005edb608c5e2e70649e
# Parent  aeb4042cc8cb47e740d93d9bce817a9c1d290582
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".
Augie Fackler - Dec. 3, 2015, 2:36 p.m.
On Thu, Dec 03, 2015 at 08:09:53PM +0800, Anton Shestakov wrote:
> # HG changeset patch
> # User Anton Shestakov <av6@dwimlabs.net>
> # Date 1448446053 -28800
> #      Wed Nov 25 18:07:33 2015 +0800
> # Node ID 17345ef3dd8a77492b67005edb608c5e2e70649e
> # Parent  aeb4042cc8cb47e740d93d9bce817a9c1d290582
> builddeb: read default distribution and codename from lsb_release

Queued with delight, many thanks!

>
> This makes `make deb` place packages into a more appropriately named directory
> instead of just "debian-unknown".
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -161,8 +161,7 @@ osx:
>       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
> diff --git a/contrib/builddeb b/contrib/builddeb
> --- a/contrib/builddeb
> +++ b/contrib/builddeb
> @@ -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 @@ fi
>  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"
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> https://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -161,8 +161,7 @@  osx:
 	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
diff --git a/contrib/builddeb b/contrib/builddeb
--- a/contrib/builddeb
+++ b/contrib/builddeb
@@ -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 @@  fi
 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"