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 05-20-2008, 05:51 PM
Sebastian Nowicki
 
Default Replace usage of "cp -s" with the more portable "ln -s"

The "-s" argument does not exist on BSD, and neither does
"--remove-destination". This patch replaces the calls to
"cp -s --remove-destination" with the equivalent "rm -f" and "ln -s"
calls, in order to increase portability.

Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
---
scripts/makepkg.sh.in | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index f56bcda..9da3687 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -435,11 +435,13 @@ download_sources() {
local file=$(strip_url "$netfile")
if [ -f "$startdir/$file" ]; then
msg2 "$(gettext "Found %s in build dir")" "$file"
- cp -s --remove-destination "$startdir/$file" "$srcdir/"
+ rm -f "$srcdir/$file"
+ ln -s "$startdir/$file" "$srcdir/"
continue
elif [ -f "$SRCDEST/$file" ]; then
msg2 "$(gettext "Using cached copy of %s")" "$file"
- cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
+ rm -f "$srcdir/$file"
+ ln -s "$SRCDEST/$file" "$srcdir/"
continue
fi

@@ -464,7 +466,8 @@ download_sources() {
if echo "$dlclient" | grep -q "%o" ; then
mv -f "$SRCDEST/$file.part" "$SRCDEST/$file"
fi
- cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
+ rm -f "$srcdir/$file"
+ ln -s "$SRCDEST/$file" "$srcdir/"
done

popd &>/dev/null
--
1.5.4.5


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-20-2008, 07:33 PM
"Dan McGee"
 
Default Replace usage of "cp -s" with the more portable "ln -s"

On Tue, May 20, 2008 at 12:51 PM, Sebastian Nowicki <sebnow@gmail.com> wrote:
> The "-s" argument does not exist on BSD, and neither does
> "--remove-destination". This patch replaces the calls to
> "cp -s --remove-destination" with the equivalent "rm -f" and "ln -s"
> calls, in order to increase portability.
>
> Signed-off-by: Sebastian Nowicki <sebnow@gmail.com>
> ---
Ahh, I think this is smart as long as we have identical behavior as
before. The one thing I may ask, and do not know if this patch does
since I haven't actually tested it, is can we make the symlinks in
download_sources() relative for files in the build dir? This would
make it easier to move your build directory without breaking
everything.

For example, instead of a symlink looking like this (in src/):
foobar.desktop -> /home/dmcgee/packages/foobar/foobar.desktop
It would be:
foobar.desktop -> ../foobar.desktop

-Dan

> scripts/makepkg.sh.in | 9 ++++++---
> 1 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index f56bcda..9da3687 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -435,11 +435,13 @@ download_sources() {
> local file=$(strip_url "$netfile")
> if [ -f "$startdir/$file" ]; then
> msg2 "$(gettext "Found %s in build dir")" "$file"
> - cp -s --remove-destination "$startdir/$file" "$srcdir/"
> + rm -f "$srcdir/$file"
> + ln -s "$startdir/$file" "$srcdir/"
> continue
> elif [ -f "$SRCDEST/$file" ]; then
> msg2 "$(gettext "Using cached copy of %s")" "$file"
> - cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
> + rm -f "$srcdir/$file"
> + ln -s "$SRCDEST/$file" "$srcdir/"
> continue
> fi
>
> @@ -464,7 +466,8 @@ download_sources() {
> if echo "$dlclient" | grep -q "%o" ; then
> mv -f "$SRCDEST/$file.part" "$SRCDEST/$file"
> fi
> - cp -s --remove-destination "$SRCDEST/$file" "$srcdir/"
> + rm -f "$srcdir/$file"
> + ln -s "$SRCDEST/$file" "$srcdir/"
> done
>
> popd &>/dev/null
> --
> 1.5.4.5
>
>
> _______________________________________________
> pacman-dev mailing list
> pacman-dev@archlinux.org
> http://archlinux.org/mailman/listinfo/pacman-dev
>

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 
Old 05-20-2008, 11:13 PM
Xavier
 
Default Replace usage of "cp -s" with the more portable "ln -s"

On Tue, May 20, 2008 at 9:33 PM, Dan McGee <dpmcgee@gmail.com> wrote:
> Ahh, I think this is smart as long as we have identical behavior as
> before. The one thing I may ask, and do not know if this patch does
> since I haven't actually tested it, is can we make the symlinks in
> download_sources() relative for files in the build dir? This would
> make it easier to move your build directory without breaking
> everything.
>
> For example, instead of a symlink looking like this (in src/):
> foobar.desktop -> /home/dmcgee/packages/foobar/foobar.desktop
> It would be:
> foobar.desktop -> ../foobar.desktop
>

I think that issue is a bit orthogonal. Also it seems to defeat the
recent idea from grabler of having $pkgdir and $srcdir independent,
for putting them somewhere else like in tmpfs or whatever.
In any cases, I think it is better to just take the patch as is. We
can worry about other stuff later.

_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 04:56 AM.

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