[PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When DESTDIR is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@...>
---
 scripts/makepkg.sh.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 92b0454..dc9124b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1000,6 +1000,8 @@ create_package() {
  "$PKGEXT" ; EXT=$PKGEXT ;;
  esac
  local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
+ local pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
 
  local ret=0
 
@@ -1018,6 +1020,10 @@ create_package() {
  ret=$?
  fi
 
+ if [ $ret -eq 0 ]; then
+ [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}" "${pkglinks_name}" && ret=$?
+ fi
+
  if [ $ret -ne 0 ]; then
  error "$(gettext "Failed to create package file.")"
  exit 1 # TODO: error code
--
1.6.5.2



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 12:00 AM, Eric Bélanger <snowmaniscool@...> wrote:

> When DESTDIR is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.
>
> Signed-off-by: Eric Bélanger <snowmaniscool@...>
> ---
>  scripts/makepkg.sh.in |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..dc9124b 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1000,6 +1000,8 @@ create_package() {
>                "$PKGEXT" ; EXT=$PKGEXT ;;
>        esac
>        local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> +       local pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
> +       local pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>
>        local ret=0
>
> @@ -1018,6 +1020,10 @@ create_package() {
>                ret=$?
>        fi
>
> +       if [ $ret -eq 0 ]; then
> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}" "${pkglinks_name}" && ret=$?
> +       fi
> +
>        if [ $ret -ne 0 ]; then
>                error "$(gettext "Failed to create package file.")"
>                exit 1 # TODO: error code
> --
> 1.6.5.2
>
>
Of course, I meant PKGDEST instead of DESTDIR. ;) I've attached a new
patch with fixed commit message.

Eric

[0001-makepkg-Place-packages-symlinks-in-build-dir-when-PK.patch]

From f4993975d82e714ba3c03a6b640185c143b9fa4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20B=C3=A9langer?= <snowmaniscool@...>
Date: Mon, 2 Nov 2009 23:31:15 -0500
Subject: [PATCH] makepkg: Place packages symlinks in build dir when PKGDEST is used
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When PKGDEST is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@...>
---
 scripts/makepkg.sh.in |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 92b0454..dc9124b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1000,6 +1000,8 @@ create_package() {
  "$PKGEXT" ; EXT=$PKGEXT ;;
  esac
  local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
+ local pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
 
  local ret=0
 
@@ -1018,6 +1020,10 @@ create_package() {
  ret=$?
  fi
 
+ if [ $ret -eq 0 ]; then
+ [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}" "${pkglinks_name}" && ret=$?
+ fi
+
  if [ $ret -ne 0 ]; then
  error "$(gettext "Failed to create package file.")"
  exit 1 # TODO: error code
--
1.6.5.2





Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Dan McGee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...> wrote:
> When DESTDIR is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.

This seems really reasonable. It gets a +1 from me for the idea; I
didn't test the code or anything though.

> Signed-off-by: Eric Bélanger <snowmaniscool@...>
> ---
>  scripts/makepkg.sh.in |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..dc9124b 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1000,6 +1000,8 @@ create_package() {
>                "$PKGEXT" ; EXT=$PKGEXT ;;
>        esac
>        local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> +       local pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
> +       local pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
Since we repeat the same
"${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
times, we should really pull that into a local variable and then set
the three others as necessary.

>
>        local ret=0
>
> @@ -1018,6 +1020,10 @@ create_package() {
>                ret=$?
>        fi
>
> +       if [ $ret -eq 0 ]; then
> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}" "${pkglinks_name}" && ret=$?
Will this work with err traps? I thought you need to be explicit with
the if; then; fi blocks.

> +       fi
> +
>        if [ $ret -ne 0 ]; then
>                error "$(gettext "Failed to create package file.")"
>                exit 1 # TODO: error code
> --
> 1.6.5.2


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dan McGee wrote:

> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...> wrote:
>  
>> When DESTDIR is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.
>>    
>
> This seems really reasonable. It gets a +1 from me for the idea; I
> didn't test the code or anything though.
>
>  
>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>> ---
>>  scripts/makepkg.sh.in |    6 ++++++
>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 92b0454..dc9124b 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1000,6 +1000,8 @@ create_package() {
>>                "$PKGEXT" ; EXT=$PKGEXT ;;
>>        esac
>>        local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>> +       local pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>> +       local pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>    
> Since we repeat the same
> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
> times, we should really pull that into a local variable and then set
> the three others as necessary.
>  

On the gpg branch, there is (going to be...) a patch creating "tar_file"
(=current pkg_file)  and pkg_file (pkglinks_target here).  I think we
can get away with just those two varabiles...  see below.

>  
>>        local ret=0
>>
>> @@ -1018,6 +1020,10 @@ create_package() {
>>                ret=$?
>>        fi
>>
>> +       if [ $ret -eq 0 ]; then
>> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}" "${pkglinks_name}" && ret=$?
>>    
> Will this work with err traps? I thought you need to be explicit with
> the if; then; fi blocks.
>  

How about testing if $PKGDEST is the same as $startdir and then make the
symlink using
ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}


>  
>> +       fi
>> +
>>        if [ $ret -ne 0 ]; then
>>                error "$(gettext "Failed to create package file.")"
>>                exit 1 # TODO: error code
>> --
>> 1.6.5.2
>>    
>
>  



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:

> Dan McGee wrote:
>>
>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>> wrote:
>>
>>>
>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>> directory.  This combines the convenience of a global package cache with the
>>> ease of having a package (i.e. a symlink) in the build directory for testing
>>> and installation purpose.
>>>
>>
>> This seems really reasonable. It gets a +1 from me for the idea; I
>> didn't test the code or anything though.
>>
>>
>>>
>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>> ---
>>>  scripts/makepkg.sh.in |    6 ++++++
>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index 92b0454..dc9124b 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>               "$PKGEXT" ; EXT=$PKGEXT ;;
>>>       esac
>>>       local
>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>> +       local
>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>> +       local
>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>
>>
>> Since we repeat the same
>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>> times, we should really pull that into a local variable and then set
>> the three others as necessary.
>>
Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
new variables. See new patch (inline and attached).

>
> On the gpg branch, there is (going to be...) a patch creating "tar_file"
> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
> get away with just those two varabiles...  see below.
>
>>
>>>
>>>       local ret=0
>>>
>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>               ret=$?
>>>       fi
>>>
>>> +       if [ $ret -eq 0 ]; then
>>> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}"
>>> "${pkglinks_name}" && ret=$?
>>>
>>
>> Will this work with err traps? I thought you need to be explicit with
>> the if; then; fi blocks.
>>
I don't really know how err traps works but I've made the if statement
explicit as it seemed that's what you prefered.

>
> How about testing if $PKGDEST is the same as $startdir and then make the
> symlink using
> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>

Thanks. I did that in my new patch.  I also added the -f option to ln.
 So if you switch to undefined PKGDEST to defined PKGDEST, the package
in the build directory will be overwritten by the symlink instead of
having the ln error out.

Eric

=======================
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 92b0454..e2b28c1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1000,6 +1000,7 @@ create_package() {
  "$PKGEXT" ; EXT=$PKGEXT ;;
  esac
  local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"

  local ret=0

@@ -1018,6 +1019,13 @@ create_package() {
  ret=$?
  fi

+ if [ $ret -eq 0 ]; then
+ if [ "$PKGDEST" != "${startdir}" ]; then
+ ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
+ fi
+ ret=$?
+ fi
+
  if [ $ret -ne 0 ]; then
  error "$(gettext "Failed to create package file.")"
  exit 1 # TODO: error code
--
1.6.5.2

[0001-makepkg-Place-packages-symlinks-in-build-dir-when-PK.patch]

From 86d0a94b582b04c3234f2dde97e2d4704b0da364 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20B=C3=A9langer?= <snowmaniscool@...>
Date: Mon, 2 Nov 2009 23:31:15 -0500
Subject: [PATCH] makepkg: Place packages symlinks in build dir when PKGDEST is used
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

When PKGDEST is used, symlinks to the packages will be put in the build directory.  This combines the convenience of a global package cache with the ease of having a package (i.e. a symlink) in the build directory for testing and installation purpose.

Signed-off-by: Eric Bélanger <snowmaniscool@...>
---
 scripts/makepkg.sh.in |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 92b0454..e2b28c1 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1000,6 +1000,7 @@ create_package() {
  "$PKGEXT" ; EXT=$PKGEXT ;;
  esac
  local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
 
  local ret=0
 
@@ -1018,6 +1019,13 @@ create_package() {
  ret=$?
  fi
 
+ if [ $ret -eq 0 ]; then
+ if [ "$PKGDEST" != "${startdir}" ]; then
+ ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
+ fi
+ ret=$?
+ fi
+
  if [ $ret -ne 0 ]; then
  error "$(gettext "Failed to create package file.")"
  exit 1 # TODO: error code
--
1.6.5.2





Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Ray Rashif :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

2009/11/3 Eric Bélanger <snowmaniscool@...>

> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
> > Dan McGee wrote:
> >>
> >> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...
> >
> >> wrote:
> >>
> >>>
> >>> When DESTDIR is used, symlinks to the packages will be put in the build
> >>> directory.  This combines the convenience of a global package cache
> with the
> >>> ease of having a package (i.e. a symlink) in the build directory for
> testing
> >>> and installation purpose.
> >>>
> >>
> >> This seems really reasonable. It gets a +1 from me for the idea; I
> >> didn't test the code or anything though.
> >>
> >>
> >>>
> >>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
> >>> ---
> >>>  scripts/makepkg.sh.in |    6 ++++++
> >>>  1 files changed, 6 insertions(+), 0 deletions(-)
> >>>
> >>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> >>> index 92b0454..dc9124b 100644
> >>> --- a/scripts/makepkg.sh.in
> >>> +++ b/scripts/makepkg.sh.in
> >>> @@ -1000,6 +1000,8 @@ create_package() {
> >>>               "$PKGEXT" ; EXT=$PKGEXT ;;
> >>>       esac
> >>>       local
> >>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> >>> +       local
> >>>
> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
> >>> +       local
> >>>
> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
> >>>
> >>
> >> Since we repeat the same
> >> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
> >> times, we should really pull that into a local variable and then set
> >> the three others as necessary.
> >>
>
> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
> new variables. See new patch (inline and attached).
>
> >
> > On the gpg branch, there is (going to be...) a patch creating "tar_file"
> > (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
> > get away with just those two varabiles...  see below.
> >
> >>
> >>>
> >>>       local ret=0
> >>>
> >>> @@ -1018,6 +1020,10 @@ create_package() {
> >>>               ret=$?
> >>>       fi
> >>>
> >>> +       if [ $ret -eq 0 ]; then
> >>> +               [ ! -f "${pkglinks_name}" ] && ln -s
> "${pkglinks_target}"
> >>> "${pkglinks_name}" && ret=$?
> >>>
> >>
> >> Will this work with err traps? I thought you need to be explicit with
> >> the if; then; fi blocks.
> >>
>
> I don't really know how err traps works but I've made the if statement
> explicit as it seemed that's what you prefered.
>
> >
> > How about testing if $PKGDEST is the same as $startdir and then make the
> > symlink using
> > ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
> >
>
> Thanks. I did that in my new patch.  I also added the -f option to ln.
>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
> in the build directory will be overwritten by the symlink instead of
> having the ln error out.
>
> Eric
>
> =======================
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..e2b28c1 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1000,6 +1000,7 @@ create_package() {
>                 "$PKGEXT" ; EXT=$PKGEXT ;;
>        esac
>        local
> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> +       local
> pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>
>        local ret=0
>
> @@ -1018,6 +1019,13 @@ create_package() {
>                 ret=$?
>        fi
>
> +       if [ $ret -eq 0 ]; then
> +               if [ "$PKGDEST" != "${startdir}" ]; then
> +                       ln -sf "${pkg_file/$EXT/$PKGEXT}"
> "$pkglinks_target"
> +               fi
> +               ret=$?
> +       fi
> +
>        if [ $ret -ne 0 ]; then
>                error "$(gettext "Failed to create package file.")"
>                exit 1 # TODO: error code
> --
> 1.6.5.2
>
>
>
>
This is really convenient, but would it not be good if the symlink(s) are
removed upon --clean?


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Cedric Staniewski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Bélanger wrote:

> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>> Dan McGee wrote:
>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>> wrote:
>>>
>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>> directory.  This combines the convenience of a global package cache with the
>>>> ease of having a package (i.e. a symlink) in the build directory for testing
>>>> and installation purpose.
>>>>
>>> This seems really reasonable. It gets a +1 from me for the idea; I
>>> didn't test the code or anything though.
>>>
>>>
>>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>>> ---
>>>>  scripts/makepkg.sh.in |    6 ++++++
>>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>> index 92b0454..dc9124b 100644
>>>> --- a/scripts/makepkg.sh.in
>>>> +++ b/scripts/makepkg.sh.in
>>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>>               "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>       esac
>>>>       local
>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>> +       local
>>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>> +       local
>>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>
>>> Since we repeat the same
>>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>>> times, we should really pull that into a local variable and then set
>>> the three others as necessary.
>>>
>
> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
> new variables. See new patch (inline and attached).
>
>> On the gpg branch, there is (going to be...) a patch creating "tar_file"
>> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
>> get away with just those two varabiles...  see below.
>>
>>>>       local ret=0
>>>>
>>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>>               ret=$?
>>>>       fi
>>>>
>>>> +       if [ $ret -eq 0 ]; then
>>>> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}"
>>>> "${pkglinks_name}" && ret=$?
>>>>
>>> Will this work with err traps? I thought you need to be explicit with
>>> the if; then; fi blocks.
>>>
>
> I don't really know how err traps works but I've made the if statement
> explicit as it seemed that's what you prefered.
>
>> How about testing if $PKGDEST is the same as $startdir and then make the
>> symlink using
>> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>>
>
> Thanks. I did that in my new patch.  I also added the -f option to ln.
>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
> in the build directory will be overwritten by the symlink instead of
> having the ln error out.
>
> Eric
>
> =======================
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..e2b28c1 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1000,6 +1000,7 @@ create_package() {
>   "$PKGEXT" ; EXT=$PKGEXT ;;
>   esac
>   local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> + local pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>
>   local ret=0
>
> @@ -1018,6 +1019,13 @@ create_package() {
>   ret=$?
>   fi
>
> + if [ $ret -eq 0 ]; then
> + if [ "$PKGDEST" != "${startdir}" ]; then
> + ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
> + fi
> + ret=$?
> + fi
> +


I really like your idea of having a symlink to the package. Regarding the patch, I think we should stick with the "new" coding style and also merge the two if statements; could look like this:

if (( ! ret )) && [[ $PKGDEST != $startdir ]]; then
        ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
        ret=$?
fi


>   if [ $ret -ne 0 ]; then
>   error "$(gettext "Failed to create package file.")"
>   exit 1 # TODO: error code
>
>
> ------------------------------------------------------------------------
>
>



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Bélanger wrote:

> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>  
>> Dan McGee wrote:
>>    
>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>> wrote:
>>>
>>>      
>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>> directory.  This combines the convenience of a global package cache with the
>>>> ease of having a package (i.e. a symlink) in the build directory for testing
>>>> and installation purpose.
>>>>
>>>>        
>>> This seems really reasonable. It gets a +1 from me for the idea; I
>>> didn't test the code or anything though.
>>>
>>>
>>>      
>>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>>> ---
>>>>  scripts/makepkg.sh.in |    6 ++++++
>>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>>
>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>> index 92b0454..dc9124b 100644
>>>> --- a/scripts/makepkg.sh.in
>>>> +++ b/scripts/makepkg.sh.in
>>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>>               "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>       esac
>>>>       local
>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>> +       local
>>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>> +       local
>>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>
>>>>        
>>> Since we repeat the same
>>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>>> times, we should really pull that into a local variable and then set
>>> the three others as necessary.
>>>
>>>      
>
> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
> new variables. See new patch (inline and attached).
>
>  
>> On the gpg branch, there is (going to be...) a patch creating "tar_file"
>> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
>> get away with just those two varabiles...  see below.
>>
>>    
>>>>       local ret=0
>>>>
>>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>>               ret=$?
>>>>       fi
>>>>
>>>> +       if [ $ret -eq 0 ]; then
>>>> +               [ ! -f "${pkglinks_name}" ] && ln -s "${pkglinks_target}"
>>>> "${pkglinks_name}" && ret=$?
>>>>
>>>>        
>>> Will this work with err traps? I thought you need to be explicit with
>>> the if; then; fi blocks.
>>>
>>>      
>
> I don't really know how err traps works but I've made the if statement
> explicit as it seemed that's what you prefered.
>
>  
>> How about testing if $PKGDEST is the same as $startdir and then make the
>> symlink using
>> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>>
>>    
>
> Thanks. I did that in my new patch.  I also added the -f option to ln.
>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
> in the build directory will be overwritten by the symlink instead of
> having the ln error out.
>
> Eric
>
> =======================
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 92b0454..e2b28c1 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1000,6 +1000,7 @@ create_package() {
>   "$PKGEXT" ; EXT=$PKGEXT ;;
>   esac
>   local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> + local pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>  

I'll clarify an earlier comment.  For the proposed patches for the
package signing work, there is some lines like

tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"

(or at least there will be once Dan adjusts those patches...)  So I would prefer to keep just these two variables as that is all that is needed and the symlink becomes:

ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"


>   local ret=0
>
> @@ -1018,6 +1019,13 @@ create_package() {
>   ret=$?
>   fi
>
> + if [ $ret -eq 0 ]; then
> + if [ "$PKGDEST" != "${startdir}" ]; then
> + ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
> + fi
> + ret=$?
> + fi
> +
>   if [ $ret -ne 0 ]; then
>   error "$(gettext "Failed to create package file.")"
>   exit 1 # TODO: error code
>  
> ------------------------------------------------------------------------
>
>



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 3:13 AM, Ray Rashif <schivmeister@...> wrote:

> 2009/11/3 Eric Bélanger <snowmaniscool@...>
>
>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>> > Dan McGee wrote:
>> >>
>> >> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...
>> >
>> >> wrote:
>> >>
>> >>>
>> >>> When DESTDIR is used, symlinks to the packages will be put in the build
>> >>> directory.  This combines the convenience of a global package cache
>> with the
>> >>> ease of having a package (i.e. a symlink) in the build directory for
>> testing
>> >>> and installation purpose.
>> >>>
>> >>
>> >> This seems really reasonable. It gets a +1 from me for the idea; I
>> >> didn't test the code or anything though.
>> >>
>> >>
>> >>>
>> >>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>> >>> ---
>> >>>  scripts/makepkg.sh.in |    6 ++++++
>> >>>  1 files changed, 6 insertions(+), 0 deletions(-)
>> >>>
>> >>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> >>> index 92b0454..dc9124b 100644
>> >>> --- a/scripts/makepkg.sh.in
>> >>> +++ b/scripts/makepkg.sh.in
>> >>> @@ -1000,6 +1000,8 @@ create_package() {
>> >>>               "$PKGEXT" ; EXT=$PKGEXT ;;
>> >>>       esac
>> >>>       local
>> >>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>> >>> +       local
>> >>>
>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>> >>> +       local
>> >>>
>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>> >>>
>> >>
>> >> Since we repeat the same
>> >> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>> >> times, we should really pull that into a local variable and then set
>> >> the three others as necessary.
>> >>
>>
>> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
>> new variables. See new patch (inline and attached).
>>
>> >
>> > On the gpg branch, there is (going to be...) a patch creating "tar_file"
>> > (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
>> > get away with just those two varabiles...  see below.
>> >
>> >>
>> >>>
>> >>>       local ret=0
>> >>>
>> >>> @@ -1018,6 +1020,10 @@ create_package() {
>> >>>               ret=$?
>> >>>       fi
>> >>>
>> >>> +       if [ $ret -eq 0 ]; then
>> >>> +               [ ! -f "${pkglinks_name}" ] && ln -s
>> "${pkglinks_target}"
>> >>> "${pkglinks_name}" && ret=$?
>> >>>
>> >>
>> >> Will this work with err traps? I thought you need to be explicit with
>> >> the if; then; fi blocks.
>> >>
>>
>> I don't really know how err traps works but I've made the if statement
>> explicit as it seemed that's what you prefered.
>>
>> >
>> > How about testing if $PKGDEST is the same as $startdir and then make the
>> > symlink using
>> > ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>> >
>>
>> Thanks. I did that in my new patch.  I also added the -f option to ln.
>>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
>> in the build directory will be overwritten by the symlink instead of
>> having the ln error out.
>>
>> Eric
>>
>> =======================
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 92b0454..e2b28c1 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1000,6 +1000,7 @@ create_package() {
>>                 "$PKGEXT" ; EXT=$PKGEXT ;;
>>        esac
>>        local
>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>> +       local
>> pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>
>>        local ret=0
>>
>> @@ -1018,6 +1019,13 @@ create_package() {
>>                 ret=$?
>>        fi
>>
>> +       if [ $ret -eq 0 ]; then
>> +               if [ "$PKGDEST" != "${startdir}" ]; then
>> +                       ln -sf "${pkg_file/$EXT/$PKGEXT}"
>> "$pkglinks_target"
>> +               fi
>> +               ret=$?
>> +       fi
>> +
>>        if [ $ret -ne 0 ]; then
>>                error "$(gettext "Failed to create package file.")"
>>                exit 1 # TODO: error code
>> --
>> 1.6.5.2
>>
>>
>>
>>
> This is really convenient, but would it not be good if the symlink(s) are
> removed upon --clean?
>
>

Sure, that can be easily done.


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 7:26 AM, Cedric Staniewski <cedric@...> wrote:

> Eric Bélanger wrote:
>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>>> Dan McGee wrote:
>>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>>> wrote:
>>>>
>>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>>> directory.  This combines the convenience of a global package cache with the
>>>>> ease of having a package (i.e. a symlink) in the build directory for testing
>>>>> and installation purpose.
>>>>>

> I really like your idea of having a symlink to the package. Regarding the patch, I think we should stick with the "new" coding style and also merge the two if statements; could look like this:
>
> if (( ! ret )) && [[ $PKGDEST != $startdir ]]; then
>        ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
>        ret=$?
> fi
>

I was just following the current style of the function I was working
in. Allan, Dan: is the above coding style OK with you?


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Bélanger wrote:

> On Tue, Nov 3, 2009 at 7:26 AM, Cedric Staniewski <cedric@...> wrote:
>  
>> Eric Bélanger wrote:
>>    
>>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>>>      
>>>> Dan McGee wrote:
>>>>        
>>>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>>>> wrote:
>>>>>
>>>>>          
>>>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>>>> directory.  This combines the convenience of a global package cache with the
>>>>>> ease of having a package (i.e. a symlink) in the build directory for testing
>>>>>> and installation purpose.
>>>>>>
>>>>>>            
>
>  
>> I really like your idea of having a symlink to the package. Regarding the patch, I think we should stick with the "new" coding style and also merge the two if statements; could look like this:
>>
>> if (( ! ret )) && [[ $PKGDEST != $startdir ]]; then
>>        ln -sf "${pkg_file/$EXT/$PKGEXT}" "$pkglinks_target"
>>        ret=$?
>> fi
>>
>>    
>
> I was just following the current style of the function I was working
> in. Allan, Dan: is the above coding style OK with you?
>  

Yes, there is going to be a massive patch integrated at some stage that
converts [ style tests to [[ style tests.  All patches waiting for
makepkg are currently sitting on my working branch and I will rebase
them and adjusts any tests to this style before they go into the main
git repo.  This just saves me work.

I really should check how that patch is progressing...

Allan



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 7:36 AM, Allan McRae <allan@...> wrote:

> Eric Bélanger wrote:
>>
>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>>
>>>
>>> Dan McGee wrote:
>>>
>>>>
>>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>>> wrote:
>>>>
>>>>
>>>>>
>>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>>> directory.  This combines the convenience of a global package cache
>>>>> with the
>>>>> ease of having a package (i.e. a symlink) in the build directory for
>>>>> testing
>>>>> and installation purpose.
>>>>>
>>>>>
>>>>
>>>> This seems really reasonable. It gets a +1 from me for the idea; I
>>>> didn't test the code or anything though.
>>>>
>>>>
>>>>
>>>>>
>>>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>>>> ---
>>>>>  scripts/makepkg.sh.in |    6 ++++++
>>>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>>>
>>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>>> index 92b0454..dc9124b 100644
>>>>> --- a/scripts/makepkg.sh.in
>>>>> +++ b/scripts/makepkg.sh.in
>>>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>>>              "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>>      esac
>>>>>      local
>>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>>> +       local
>>>>>
>>>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>> +       local
>>>>>
>>>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>>
>>>>>
>>>>
>>>> Since we repeat the same
>>>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>>>> times, we should really pull that into a local variable and then set
>>>> the three others as necessary.
>>>>
>>>>
>>
>> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
>> new variables. See new patch (inline and attached).
>>
>>
>>>
>>> On the gpg branch, there is (going to be...) a patch creating "tar_file"
>>> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
>>> get away with just those two varabiles...  see below.
>>>
>>>
>>>>>
>>>>>      local ret=0
>>>>>
>>>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>>>              ret=$?
>>>>>      fi
>>>>>
>>>>> +       if [ $ret -eq 0 ]; then
>>>>> +               [ ! -f "${pkglinks_name}" ] && ln -s
>>>>> "${pkglinks_target}"
>>>>> "${pkglinks_name}" && ret=$?
>>>>>
>>>>>
>>>>
>>>> Will this work with err traps? I thought you need to be explicit with
>>>> the if; then; fi blocks.
>>>>
>>>>
>>
>> I don't really know how err traps works but I've made the if statement
>> explicit as it seemed that's what you prefered.
>>
>>
>>>
>>> How about testing if $PKGDEST is the same as $startdir and then make the
>>> symlink using
>>> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>>>
>>>
>>
>> Thanks. I did that in my new patch.  I also added the -f option to ln.
>>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
>> in the build directory will be overwritten by the symlink instead of
>> having the ln error out.
>>
>> Eric
>>
>> =======================
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 92b0454..e2b28c1 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1000,6 +1000,7 @@ create_package() {
>>                "$PKGEXT" ; EXT=$PKGEXT ;;
>>        esac
>>        local
>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>> +       local
>> pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>
>
> I'll clarify an earlier comment.  For the proposed patches for the package
> signing work, there is some lines like
>
> tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>
> (or at least there will be once Dan adjusts those patches...)  So I would
> prefer to keep just these two variables as that is all that is needed and
> the symlink becomes:
>
> ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
>

OK.  But you do realize that the current pkg_file is different than
your new pkg_file (it's in fact your  tar_file).  So I'll need to
rename the references of pkg_file to tar_file.



>
>>        local ret=0
>>
>> @@ -1018,6 +1019,13 @@ create_package() {
>>                ret=$?
>>        fi
>>
>> +       if [ $ret -eq 0 ]; then
>> +               if [ "$PKGDEST" != "${startdir}" ]; then
>> +                       ln -sf "${pkg_file/$EXT/$PKGEXT}"
>> "$pkglinks_target"
>> +               fi
>> +               ret=$?
>> +       fi
>> +
>>        if [ $ret -ne 0 ]; then
>>                error "$(gettext "Failed to create package file.")"
>>                exit 1 # TODO: error code
>>  ------------------------------------------------------------------------
>>
>>
>
>
>


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Bélanger wrote:

> On Tue, Nov 3, 2009 at 7:36 AM, Allan McRae <allan@...> wrote:
>  
>> Eric Bélanger wrote:
>>    
>>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...> wrote:
>>>
>>>      
>>>> Dan McGee wrote:
>>>>
>>>>        
>>>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger <snowmaniscool@...>
>>>>> wrote:
>>>>>
>>>>>
>>>>>          
>>>>>> When DESTDIR is used, symlinks to the packages will be put in the build
>>>>>> directory.  This combines the convenience of a global package cache
>>>>>> with the
>>>>>> ease of having a package (i.e. a symlink) in the build directory for
>>>>>> testing
>>>>>> and installation purpose.
>>>>>>
>>>>>>
>>>>>>            
>>>>> This seems really reasonable. It gets a +1 from me for the idea; I
>>>>> didn't test the code or anything though.
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>>>>> ---
>>>>>>  scripts/makepkg.sh.in |    6 ++++++
>>>>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>>>>
>>>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>>>> index 92b0454..dc9124b 100644
>>>>>> --- a/scripts/makepkg.sh.in
>>>>>> +++ b/scripts/makepkg.sh.in
>>>>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>>>>              "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>>>      esac
>>>>>>      local
>>>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>>>> +       local
>>>>>>
>>>>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>>> +       local
>>>>>>
>>>>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>>>
>>>>>>
>>>>>>            
>>>>> Since we repeat the same
>>>>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>>>>> times, we should really pull that into a local variable and then set
>>>>> the three others as necessary.
>>>>>
>>>>>
>>>>>          
>>> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
>>> new variables. See new patch (inline and attached).
>>>
>>>
>>>      
>>>> On the gpg branch, there is (going to be...) a patch creating "tar_file"
>>>> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think we can
>>>> get away with just those two varabiles...  see below.
>>>>
>>>>
>>>>        
>>>>>>      local ret=0
>>>>>>
>>>>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>>>>              ret=$?
>>>>>>      fi
>>>>>>
>>>>>> +       if [ $ret -eq 0 ]; then
>>>>>> +               [ ! -f "${pkglinks_name}" ] && ln -s
>>>>>> "${pkglinks_target}"
>>>>>> "${pkglinks_name}" && ret=$?
>>>>>>
>>>>>>
>>>>>>            
>>>>> Will this work with err traps? I thought you need to be explicit with
>>>>> the if; then; fi blocks.
>>>>>
>>>>>
>>>>>          
>>> I don't really know how err traps works but I've made the if statement
>>> explicit as it seemed that's what you prefered.
>>>
>>>
>>>      
>>>> How about testing if $PKGDEST is the same as $startdir and then make the
>>>> symlink using
>>>> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>>>>
>>>>
>>>>        
>>> Thanks. I did that in my new patch.  I also added the -f option to ln.
>>>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
>>> in the build directory will be overwritten by the symlink instead of
>>> having the ln error out.
>>>
>>> Eric
>>>
>>> =======================
>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>> index 92b0454..e2b28c1 100644
>>> --- a/scripts/makepkg.sh.in
>>> +++ b/scripts/makepkg.sh.in
>>> @@ -1000,6 +1000,7 @@ create_package() {
>>>                "$PKGEXT" ; EXT=$PKGEXT ;;
>>>        esac
>>>        local
>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>> +       local
>>> pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>
>>>      
>> I'll clarify an earlier comment.  For the proposed patches for the package
>> signing work, there is some lines like
>>
>> tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>
>> (or at least there will be once Dan adjusts those patches...)  So I would
>> prefer to keep just these two variables as that is all that is needed and
>> the symlink becomes:
>>
>> ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
>>
>>    
>
> OK.  But you do realize that the current pkg_file is different than
> your new pkg_file (it's in fact your  tar_file).  So I'll need to
> rename the references of pkg_file to tar_file.

Yes, that is a bit more in depth than just the quick change...   How
about, I make a quick patch changing pkg_file to tar_file (as it points
to the tar file...) and adding the new pkg_file (that points to the pkg
file...) as the base for your patch and the gpg patch changes.  I can do
that first thing tomorrow morning (12pm here)

Allan



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Allan McRae wrote:

> Eric Bélanger wrote:
>> On Tue, Nov 3, 2009 at 7:36 AM, Allan McRae <allan@...> wrote:
>>  
>>> Eric Bélanger wrote:
>>>    
>>>> On Tue, Nov 3, 2009 at 12:59 AM, Allan McRae <allan@...>
>>>> wrote:
>>>>
>>>>      
>>>>> Dan McGee wrote:
>>>>>
>>>>>        
>>>>>> On Mon, Nov 2, 2009 at 11:00 PM, Eric Bélanger
>>>>>> <snowmaniscool@...>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> When DESTDIR is used, symlinks to the packages will be put in
>>>>>>> the build
>>>>>>> directory.  This combines the convenience of a global package cache
>>>>>>> with the
>>>>>>> ease of having a package (i.e. a symlink) in the build directory
>>>>>>> for
>>>>>>> testing
>>>>>>> and installation purpose.
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>> This seems really reasonable. It gets a +1 from me for the idea; I
>>>>>> didn't test the code or anything though.
>>>>>>
>>>>>>
>>>>>>
>>>>>>          
>>>>>>> Signed-off-by: Eric Bélanger <snowmaniscool@...>
>>>>>>> ---
>>>>>>>  scripts/makepkg.sh.in |    6 ++++++
>>>>>>>  1 files changed, 6 insertions(+), 0 deletions(-)
>>>>>>>
>>>>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>>>>> index 92b0454..dc9124b 100644
>>>>>>> --- a/scripts/makepkg.sh.in
>>>>>>> +++ b/scripts/makepkg.sh.in
>>>>>>> @@ -1000,6 +1000,8 @@ create_package() {
>>>>>>>              "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>>>>      esac
>>>>>>>      local
>>>>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>>>>>
>>>>>>> +       local
>>>>>>>
>>>>>>> pkglinks_name="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>>>>
>>>>>>> +       local
>>>>>>>
>>>>>>> pkglinks_target="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>> Since we repeat the same
>>>>>> "${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}" part three
>>>>>> times, we should really pull that into a local variable and then set
>>>>>> the three others as necessary.
>>>>>>
>>>>>>
>>>>>>          
>>>> Actually it was repeated twice (EXT vs. PKGEXT).  I removed one of my
>>>> new variables. See new patch (inline and attached).
>>>>
>>>>
>>>>      
>>>>> On the gpg branch, there is (going to be...) a patch creating
>>>>> "tar_file"
>>>>> (=current pkg_file)  and pkg_file (pkglinks_target here).  I think
>>>>> we can
>>>>> get away with just those two varabiles...  see below.
>>>>>
>>>>>
>>>>>        
>>>>>>>      local ret=0
>>>>>>>
>>>>>>> @@ -1018,6 +1020,10 @@ create_package() {
>>>>>>>              ret=$?
>>>>>>>      fi
>>>>>>>
>>>>>>> +       if [ $ret -eq 0 ]; then
>>>>>>> +               [ ! -f "${pkglinks_name}" ] && ln -s
>>>>>>> "${pkglinks_target}"
>>>>>>> "${pkglinks_name}" && ret=$?
>>>>>>>
>>>>>>>
>>>>>>>            
>>>>>> Will this work with err traps? I thought you need to be explicit
>>>>>> with
>>>>>> the if; then; fi blocks.
>>>>>>
>>>>>>
>>>>>>          
>>>> I don't really know how err traps works but I've made the if statement
>>>> explicit as it seemed that's what you prefered.
>>>>
>>>>
>>>>      
>>>>> How about testing if $PKGDEST is the same as $startdir and then
>>>>> make the
>>>>> symlink using
>>>>> ln -s ${pkg_file} ${pkgfile/$PKGDEST/$startdir/}
>>>>>
>>>>>
>>>>>        
>>>> Thanks. I did that in my new patch.  I also added the -f option to ln.
>>>>  So if you switch to undefined PKGDEST to defined PKGDEST, the package
>>>> in the build directory will be overwritten by the symlink instead of
>>>> having the ln error out.
>>>>
>>>> Eric
>>>>
>>>> =======================
>>>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>>>> index 92b0454..e2b28c1 100644
>>>> --- a/scripts/makepkg.sh.in
>>>> +++ b/scripts/makepkg.sh.in
>>>> @@ -1000,6 +1000,7 @@ create_package() {
>>>>                "$PKGEXT" ; EXT=$PKGEXT ;;
>>>>        esac
>>>>        local
>>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>>> +       local
>>>> pkglinks_target="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>>
>>>>
>>>>      
>>> I'll clarify an earlier comment.  For the proposed patches for the
>>> package
>>> signing work, there is some lines like
>>>
>>> tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
>>> pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
>>>
>>>
>>> (or at least there will be once Dan adjusts those patches...)  So I
>>> would
>>> prefer to keep just these two variables as that is all that is
>>> needed and
>>> the symlink becomes:
>>>
>>> ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
>>>
>>>    
>>
>> OK.  But you do realize that the current pkg_file is different than
>> your new pkg_file (it's in fact your  tar_file).  So I'll need to
>> rename the references of pkg_file to tar_file.
>
> Yes, that is a bit more in depth than just the quick change...   How
> about, I make a quick patch changing pkg_file to tar_file (as it
> points to the tar file...) and adding the new pkg_file (that points to
> the pkg file...) as the base for your patch and the gpg patch
> changes.  I can do that first thing tomorrow morning (12pm here)

In fact, looking at this, you only need to change pkg_file to tar_file
in four places so I am sure you can handle this.

Allan



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 9:20 AM, Allan McRae <allan@...> wrote:

> Allan McRae wrote:
>>
>> Eric Bélanger wrote:
>>> OK.  But you do realize that the current pkg_file is different than
>>> your new pkg_file (it's in fact your  tar_file).  So I'll need to
>>> rename the references of pkg_file to tar_file.
>>
>> Yes, that is a bit more in depth than just the quick change...   How
>> about, I make a quick patch changing pkg_file to tar_file (as it points to
>> the tar file...) and adding the new pkg_file (that points to the pkg
>> file...) as the base for your patch and the gpg patch changes.  I can do
>> that first thing tomorrow morning (12pm here)
>
> In fact, looking at this, you only need to change pkg_file to tar_file in
> four places so I am sure you can handle this.
>
> Allan
>

Yes, I'll do the change. Don't worry about it. I just wanted to make
sure we were on the same page.

Eric


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Dan McGee :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 8:31 AM, Eric Bélanger <snowmaniscool@...> wrote:

> On Tue, Nov 3, 2009 at 9:20 AM, Allan McRae <allan@...> wrote:
>> Allan McRae wrote:
>>>
>>> Eric Bélanger wrote:
>>>> OK.  But you do realize that the current pkg_file is different than
>>>> your new pkg_file (it's in fact your  tar_file).  So I'll need to
>>>> rename the references of pkg_file to tar_file.
>>>
>>> Yes, that is a bit more in depth than just the quick change...   How
>>> about, I make a quick patch changing pkg_file to tar_file (as it points to
>>> the tar file...) and adding the new pkg_file (that points to the pkg
>>> file...) as the base for your patch and the gpg patch changes.  I can do
>>> that first thing tomorrow morning (12pm here)
>>
>> In fact, looking at this, you only need to change pkg_file to tar_file in
>> four places so I am sure you can handle this.
>>
>> Allan
>>
>
> Yes, I'll do the change. Don't worry about it. I just wanted to make
> sure we were on the same page.

Do I need to do anything? :P

-Dan


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 8:55 AM, Eric Bélanger <snowmaniscool@...> wrote:

> On Tue, Nov 3, 2009 at 3:13 AM, Ray Rashif <schivmeister@...> wrote:
>> 2009/11/3 Eric Bélanger <snowmaniscool@...>
>>
>>>
>> This is really convenient, but would it not be good if the symlink(s) are
>> removed upon --clean?
>>
>>
>
> Sure, that can be easily done.
>

I'm not sure if removing the symlinks if --clean is used is a good
idea after all.  After a successful build, you would probably want to
have the package's symlink to be still there so you can test/install
the package.


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Allan McRae-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Eric Bélanger wrote:

> On Tue, Nov 3, 2009 at 8:55 AM, Eric Bélanger <snowmaniscool@...> wrote:
>  
>> On Tue, Nov 3, 2009 at 3:13 AM, Ray Rashif <schivmeister@...> wrote:
>>    
>>> 2009/11/3 Eric Bélanger <snowmaniscool@...>
>>>
>>>      
>>> This is really convenient, but would it not be good if the symlink(s) are
>>> removed upon --clean?
>>>
>>>
>>>      
>> Sure, that can be easily done.
>>
>>    
>
> I'm not sure if removing the symlinks if --clean is used is a good
> idea after all.  After a successful build, you would probably want to
> have the package's symlink to be still there so you can test/install
> the package.
>  

I agree that keeping the current symlink is good, but then do you have
to remove old symlinks manually?  I think this is a situation with no
best answer, but removing symlinks on --clean may be the better one.

And here is another thought I just had.  Do we want to error out if the
symlinnk creation fails but the building of the package is successful?  
Or jsut print a warning?

Allan



Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 6:46 PM, Allan McRae <allan@...> wrote:

> Eric Bélanger wrote:
>>
>> On Tue, Nov 3, 2009 at 8:55 AM, Eric Bélanger <snowmaniscool@...>
>> wrote:
>>
>>>
>>> On Tue, Nov 3, 2009 at 3:13 AM, Ray Rashif <schivmeister@...>
>>> wrote:
>>>
>>>>
>>>> 2009/11/3 Eric Bélanger <snowmaniscool@...>
>>>>
>>>>      This is really convenient, but would it not be good if the
>>>> symlink(s) are
>>>> removed upon --clean?
>>>>
>>>>
>>>>
>>>
>>> Sure, that can be easily done.
>>>
>>>
>>
>> I'm not sure if removing the symlinks if --clean is used is a good
>> idea after all.  After a successful build, you would probably want to
>> have the package's symlink to be still there so you can test/install
>> the package.
>>
>
> I agree that keeping the current symlink is good, but then do you have to
> remove old symlinks manually?  I think this is a situation with no best
> answer, but removing symlinks on --clean may be the better one.

I've haven't thought about old symlinks. I'll remove them on --clean.

>
> And here is another thought I just had.  Do we want to error out if the
> symlinnk creation fails but the building of the package is successful?  Or
> jsut print a warning?
>

Maybe a warning would be better.


Re: [PATCH] makepkg: Place packages symlinks in build dir when DESTDIR is used

by Eric Bélanger-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 3, 2009 at 7:34 PM, Eric Bélanger <snowmaniscool@...> wrote:

> On Tue, Nov 3, 2009 at 6:46 PM, Allan McRae <allan@...> wrote:
>> Eric Bélanger wrote:
>>>
>>> On Tue, Nov 3, 2009 at 8:55 AM, Eric Bélanger <snowmaniscool@...>
>>> wrote:
>>>
>>>>
>>>> On Tue, Nov 3, 2009 at 3:13 AM, Ray Rashif <schivmeister@...>
>>>> wrote:
>>>>
>>>>>
>>>>> 2009/11/3 Eric Bélanger <snowmaniscool@...>
>>>>>
>>>>>      This is really convenient, but would it not be good if the
>>>>> symlink(s) are
>>>>> removed upon --clean?
>>>>>
>>>>>
>>>>>
>>>>
>>>> Sure, that can be easily done.
>>>>
>>>>
>>>
>>> I'm not sure if removing the symlinks if --clean is used is a good
>>> idea after all.  After a successful build, you would probably want to
>>> have the package's symlink to be still there so you can test/install
>>> the package.
>>>
>>
>> I agree that keeping the current symlink is good, but then do you have to
>> remove old symlinks manually?  I think this is a situation with no best
>> answer, but removing symlinks on --clean may be the better one.
>
> I've haven't thought about old symlinks. I'll remove them on --clean.
>
>>
>> And here is another thought I just had.  Do we want to error out if the
>> symlinnk creation fails but the building of the package is successful?  Or
>> jsut print a warning?
>>
>
> Maybe a warning would be better.
>

I added a warning. BTW, should the tar_file and pkg_file be local
variables?  I'll submit anew patch once I get an answer.

< Prev | 1 - 2 | Next >