Patchwork [1,of,6,STABLE] dockerdeb: elimate 'cd' in export command

login
register
mail settings
Submitter Sean Farley
Date April 18, 2016, 5:52 p.m.
Message ID <db33d0e7476c79ac0bc8.1461001928@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/14722/
State Superseded
Headers show

Comments

Sean Farley - April 18, 2016, 5:52 p.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1460914600 25200
#      Sun Apr 17 10:36:40 2016 -0700
# Branch stable
# Node ID db33d0e7476c79ac0bc8048992ec6d24d6062c87
# Parent  97811ff7964710d32cae951df1da8019b46151a2
# EXP-Topic ppa
dockerdeb: elimate 'cd' in export command

This had the unfortunate side effect of causing the environment to have a
newline due to the fact that some 'cd' outputs the result of the directory
change.
Yuya Nishihara - April 19, 2016, 2:39 p.m.
On Mon, 18 Apr 2016 10:52:08 -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean@farley.io>
> # Date 1460914600 25200
> #      Sun Apr 17 10:36:40 2016 -0700
> # Branch stable
> # Node ID db33d0e7476c79ac0bc8048992ec6d24d6062c87
> # Parent  97811ff7964710d32cae951df1da8019b46151a2
> # EXP-Topic ppa
> dockerdeb: elimate 'cd' in export command
> 
> This had the unfortunate side effect of causing the environment to have a
> newline due to the fact that some 'cd' outputs the result of the directory
> change.
> 
> diff --git a/contrib/dockerdeb b/contrib/dockerdeb
> --- a/contrib/dockerdeb
> +++ b/contrib/dockerdeb
> @@ -2,11 +2,11 @@
>  
>  . $(dirname $0)/dockerlib.sh
>  . $(dirname $0)/packagelib.sh
>  
>  BUILDDIR=$(dirname $0)
> -export ROOTDIR=$(cd $BUILDDIR/..; pwd)
> +export ROOTDIR=$(dirname $(readlink -f $BUILDDIR))

IIRC, "readlink -f" is GNU extension. If we have to care for docker on OS X,
we can't use it. If "cd" is the source of the problem,
$(cd $BUILDDIR/.. > /dev/null; pwd) might work.
Sean Farley - April 19, 2016, 5:01 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> On Mon, 18 Apr 2016 10:52:08 -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean@farley.io>
>> # Date 1460914600 25200
>> #      Sun Apr 17 10:36:40 2016 -0700
>> # Branch stable
>> # Node ID db33d0e7476c79ac0bc8048992ec6d24d6062c87
>> # Parent  97811ff7964710d32cae951df1da8019b46151a2
>> # EXP-Topic ppa
>> dockerdeb: elimate 'cd' in export command
>> 
>> This had the unfortunate side effect of causing the environment to have a
>> newline due to the fact that some 'cd' outputs the result of the directory
>> change.
>> 
>> diff --git a/contrib/dockerdeb b/contrib/dockerdeb
>> --- a/contrib/dockerdeb
>> +++ b/contrib/dockerdeb
>> @@ -2,11 +2,11 @@
>>  
>>  . $(dirname $0)/dockerlib.sh
>>  . $(dirname $0)/packagelib.sh
>>  
>>  BUILDDIR=$(dirname $0)
>> -export ROOTDIR=$(cd $BUILDDIR/..; pwd)
>> +export ROOTDIR=$(dirname $(readlink -f $BUILDDIR))
>
> IIRC, "readlink -f" is GNU extension. If we have to care for docker on OS X,
> we can't use it. If "cd" is the source of the problem,
> $(cd $BUILDDIR/.. > /dev/null; pwd) might work.

Argh, you're right. I was thinking this would be run *inside* docker
but, of course, that's not correct. Ok, I'll go with the redirection
method and resend.

Patch

diff --git a/contrib/dockerdeb b/contrib/dockerdeb
--- a/contrib/dockerdeb
+++ b/contrib/dockerdeb
@@ -2,11 +2,11 @@ 
 
 . $(dirname $0)/dockerlib.sh
 . $(dirname $0)/packagelib.sh
 
 BUILDDIR=$(dirname $0)
-export ROOTDIR=$(cd $BUILDDIR/..; pwd)
+export ROOTDIR=$(dirname $(readlink -f $BUILDDIR))
 
 checkdocker
 
 DISTID="$1"
 CODENAME="$2"