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

login
register
mail settings
Submitter Sean Farley
Date April 17, 2016, 6:14 p.m.
Message ID <b7fb0360f172f06477a0.1460916855@laptop.local>
Download mbox | patch
Permalink /patch/14714/
State Changes Requested
Delegated to: Yuya Nishihara
Headers show

Comments

Sean Farley - April 17, 2016, 6:14 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 b7fb0360f172f06477a07bf510aca176109c0cba
# Parent  e442b628bfe6485d57ab4f10f941b89e96f04b05
# 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 18, 2016, 1:13 p.m.
On Sun, 17 Apr 2016 11:14:15 -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 b7fb0360f172f06477a07bf510aca176109c0cba
> # Parent  e442b628bfe6485d57ab4f10f941b89e96f04b05
> # 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 $BUILDDIR)

It won't work if you do

  $ cd contrib
  $ ./dockerdeb
Sean Farley - April 18, 2016, 5:30 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> On Sun, 17 Apr 2016 11:14:15 -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 b7fb0360f172f06477a07bf510aca176109c0cba
>> # Parent  e442b628bfe6485d57ab4f10f941b89e96f04b05
>> # 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 $BUILDDIR)
>
> It won't work if you do
>
>   $ cd contrib
>   $ ./dockerdeb

Drats. Should I use readlink or something else?
Sean Farley - April 18, 2016, 5:35 p.m.
Sean Farley <sean@farley.io> writes:

> Yuya Nishihara <yuya@tcha.org> writes:
>
>> On Sun, 17 Apr 2016 11:14:15 -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 b7fb0360f172f06477a07bf510aca176109c0cba
>>> # Parent  e442b628bfe6485d57ab4f10f941b89e96f04b05
>>> # 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 $BUILDDIR)
>>
>> It won't work if you do
>>
>>   $ cd contrib
>>   $ ./dockerdeb
>
> Drats. Should I use readlink or something else?

Actually, running './dockerdeb' doesn't work even if this is fixed:

Sending build context to Docker daemon 2.048 kB
Step 1 : FROM debian:jessie
 ---> 47af6ca8a14a
Step 2 : RUN apt-get update && apt-get install -y   build-essential   debhelper   dh-python   devscripts   python   python-all-dev   python-docutils   zip   unzip
 ---> Using cache
 ---> dcf0bd200ff5
Step 3 : RUN groupadd build -g 20 -o
 ---> Using cache
 ---> 2732bd966929
Step 4 : RUN useradd build -u 501 -g build -o
 ---> Using cache
 ---> ca7708e15727
Successfully built ca7708e15727
sh: 1: contrib/builddeb: not found

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 $BUILDDIR)
 
 checkdocker
 
 DISTID="$1"
 CODENAME="$2"