summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Bélanger <snowmaniscool@gmail.com>2009-11-02 23:31:15 -0500
committerDan McGee <dan@archlinux.org>2009-11-30 21:12:27 -0600
commit93862bd7cb91129cece07391c00ab9e6f81111d0 (patch)
tree2efc2927ac0316b09f083e4fda5c6ec52f2a3889
parent6c8f817040acb74bbf696e75a302280d5f07c98a (diff)
downloadpacman-93862bd7cb91129cece07391c00ab9e6f81111d0.tar.xz
makepkg: Place packages symlinks in build dir when PKGDEST is used
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@gmail.com> [Allan: add comment documenting clean-up addition] Signed-off-by: Allan McRae <allan@archlinux.org> Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--scripts/makepkg.sh.in29
1 files changed, 24 insertions, 5 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 1d9d8f13..b4366a56 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -148,6 +148,15 @@ clean_up() {
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-package_${pkg}.log"*
done
fi
+
+ # clean up dangling symlinks to packages
+ for pkg in ${pkgname[@]}; do
+ for file in ${pkg}-*-*-${CARCH}${PKGEXT}; do
+ if [[ -h $file && ! -e $file ]]; then
+ rm -f $file
+ fi
+ done
+ done
fi
fi
@@ -1002,21 +1011,22 @@ create_package() {
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
- local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
local ret=0
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
- bsdtar -cf - $comp_files * > "$pkg_file" || ret=$?
+ bsdtar -cf - $comp_files * > "$tar_file" || ret=$?
shopt -u nullglob
if (( ! ret )); then
case "$PKGEXT" in
- *tar.gz) gzip -f -n "$pkg_file" ;;
- *tar.bz2) bzip2 -f "$pkg_file" ;;
- *tar.xz) xz -z -f "$pkg_file" ;;
+ *tar.gz) gzip -f -n "$tar_file" ;;
+ *tar.bz2) bzip2 -f "$tar_file" ;;
+ *tar.xz) xz -z -f "$tar_file" ;;
esac
ret=$?
fi
@@ -1025,6 +1035,15 @@ create_package() {
error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code
fi
+
+ if (( ! ret )) && [[ "$PKGDEST" != "${startdir}" ]]; then
+ ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}"
+ ret=$?
+ fi
+
+ if (( ret )); then
+ warning "$(gettext "Failed to create symlink to package file.")"
+ fi
}
create_srcpackage() {