Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   ArchLinux Pacman Development (http://www.linux-archive.org/archlinux-pacman-development/)
-   -   makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used (http://www.linux-archive.org/archlinux-pacman-development/389124-makepkg-place-source-packages-symlinks-build-dir-when-srcpkgdest-used.html)

Eric Bélanger 06-21-2010 11:47 PM

makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
 
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
---
scripts/makepkg.sh.in | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index dbc4047..83d656f 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -159,6 +159,16 @@ clean_up() {
fi
done
done
+
+ # clean up dangling symlinks to source packages
+ for pkg in ${pkgname[@]}; do
+ for file in ${pkg}-*-*-${CARCH}${SRCEXT}; do
+ if [[ -h $file && ! -e $file ]]; then
+ rm -f $file
+ fi
+ done
+ done
+
fi
fi

@@ -1126,6 +1136,16 @@ create_srcpackage() {
error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code
fi
+
+ if (( ! ret )) && [[ "$SRCPKGDEST" != "${startdir}" ]]; then
+ ln -sf "${pkg_file}" "${pkg_file/$SRCPKGDEST/$startdir}"
+ ret=$?
+ fi
+
+ if (( ret )); then
+ warning "$(gettext "Failed to create symlink to source package file.")"
+ fi
+
cd "${startdir}"
rm -rf "${srclinks}"
}
--
1.7.1

Eric Bélanger 06-23-2010 05:33 AM

makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
 
On Tue, Jun 22, 2010 at 11:59 PM, Allan McRae <allan@archlinux.org> wrote:
> On 22/06/10 09:47, Eric Bélanger wrote:
>>
>> Signed-off-by: Eric Bélanger<snowmaniscool@gmail.com>
>> ---
>> *scripts/makepkg.sh.in | * 20 ++++++++++++++++++++
>> *1 files changed, 20 insertions(+), 0 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index dbc4047..83d656f 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -159,6 +159,16 @@ clean_up() {
>> * * * * * * * * * * * * * * * * * * * *fi
>> * * * * * * * * * * * * * * * *done
>> * * * * * * * * * * * *done
>> +
>> + * * * * * * * * * * * # clean up dangling symlinks to source packages
>> + * * * * * * * * * * * for pkg in ${pkgname[@]}; do
>> + * * * * * * * * * * * * * * * for file in ${pkg}-*-*-${CARCH}${SRCEXT};
>> do
>> + * * * * * * * * * * * * * * * * * * * if [[ -h $file&& *! -e $file ]];
>> then
>> + * * * * * * * * * * * * * * * * * * * * * * * rm -f $file
>> + * * * * * * * * * * * * * * * * * * * fi
>> + * * * * * * * * * * * * * * * done
>> + * * * * * * * * * * * done
>> +
>> * * * * * * * *fi
>> * * * *fi
>
>
> I'd prefer just doing something like:
>
> # clean up dangling symlinks to packages
> for pkg in ${pkgname[@]}; do
> *for file in ${pkg}-*-*-${CARCH}${PKGEXT} ${pkg}-*-*-${CARCH}${SRCEXT}; do
> * *if [[ -h $file && ! -e $file ]]; then
>
> i.e. just adding to the previous loop.
>
>
> The rest of the patch is fine.
>
> Allan
>
>

I just sent a fixed patch.

Eric

Eric Bélanger 06-23-2010 05:35 AM

makepkg: Place source packages symlinks in build dir when SRCPKGDEST is used
 
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
---
scripts/makepkg.sh.in | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index dbc4047..0219015 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -153,7 +153,7 @@ clean_up() {

# clean up dangling symlinks to packages
for pkg in ${pkgname[@]}; do
- for file in ${pkg}-*-*-${CARCH}${PKGEXT}; do
+ for file in ${pkg}-*-*-${CARCH}${PKGEXT} ${pkg}-*-*-${CARCH}${SRCEXT}; do
if [[ -h $file && ! -e $file ]]; then
rm -f $file
fi
@@ -1126,6 +1126,16 @@ create_srcpackage() {
error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code
fi
+
+ if (( ! ret )) && [[ "$SRCPKGDEST" != "${startdir}" ]]; then
+ ln -sf "${pkg_file}" "${pkg_file/$SRCPKGDEST/$startdir}"
+ ret=$?
+ fi
+
+ if (( ret )); then
+ warning "$(gettext "Failed to create symlink to source package file.")"
+ fi
+
cd "${startdir}"
rm -rf "${srclinks}"
}
--
1.7.1


All times are GMT. The time now is 01:38 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.