FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 02-01-2011, 11:22 AM
Esa Määttä
 
Default Remove existing pkg/ dir only if it's not empty.

This allows symbolic linking of the pkg directory. Without this patch the
symbolic link to an another directory would be removed as existing pkg/
directory.

Signed-off-by: Esa Määttä <esa.maatta@iki.fi>
---
scripts/makepkg.sh.in | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index b1b1b75..bd2739b 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2056,8 +2056,8 @@ if (( NOBUILD )); then
msg "$(gettext "Sources are ready.")"
exit 0 #E_OK
else
- # check for existing pkg directory; don't remove if we are repackaging
- if [[ -d $pkgdir ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
+ # check for existing non empty pkg directory; don't remove if we are repackaging
+ if [[ -n $(ls -A "$pkgdir" 2>/dev/null) ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
msg "$(gettext "Removing existing pkg/ directory...")"
rm -rf "$pkgdir"
fi
--
1.7.4
 
Old 02-01-2011, 02:54 PM
Dan McGee
 
Default Remove existing pkg/ dir only if it's not empty.

On Tue, Feb 1, 2011 at 6:22 AM, Esa Määttä <esa.maatta@iki.fi> wrote:
> This allows symbolic linking of the pkg directory. Without this patch the
> symbolic link to an another directory would be removed as existing pkg/
> directory.
>
> Signed-off-by: Esa Määttä <esa.maatta@iki.fi>
> ---
> *scripts/makepkg.sh.in | * *4 ++--
> *1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index b1b1b75..bd2739b 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -2056,8 +2056,8 @@ if (( NOBUILD )); then
> * * * *msg "$(gettext "Sources are ready.")"
> * * * *exit 0 #E_OK
> *else
> - * * * # check for existing pkg directory; don't remove if we are repackaging
> - * * * if [[ -d $pkgdir ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
> + * * * # check for existing non empty pkg directory; don't remove if we are repackaging
> + * * * if [[ -n $(ls -A "$pkgdir" 2>/dev/null) ]] && (( ! REPKG || PKGFUNC || SPLITPKG )); then
Please read `man 1 test` and figure out what you are actually trying
to check for, I'm sure ls invocation is not required. And on that
note:

$ mkdir test
$ ln -s test linktest
$ [[ -d test ]] && echo "true"
true
$ [[ -d linktest ]] && echo "true"
true

Or maybe I'm just not understanding at all the "why" behind your
patch? Whether it is a symlink or not, we shouldn't be treating it any
differently.

> * * * * * * * *msg "$(gettext "Removing existing pkg/ directory...")"
> * * * * * * * *rm -rf "$pkgdir"
> * * * *fi
> --
> 1.7.4
 

Thread Tools




All times are GMT. The time now is 05:12 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org