On Tue, Nov 3, 2009 at 12:00 AM, Eric Bélanger <[email protected]> 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 <[email protected]>
> ---
>  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
From f4993975d82e714ba3c03a6b640185c143b9fa4a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Eric=20B=C3=A9langer?= <[email protected]>
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 <[email protected]>
---
 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



Reply via email to