1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-10 11:35:00 -05:00

makepkg: create tar file for bogus PKGEXT

If PKGEXT is not one of the recognized tar*'s, create_package() would
create an empty package file and fail, since bsdtar on the left side of
the pipe returns 141 on SIGPIPE (broken pipe).

This patch changes the behavior for an invalid PKGEXT. A warning is
printed on stderr, and a tar file is created. Also retire the obsolete
$EXT variable.

Add the obligatory comment why we don't use bsdtar's compression.
Finally, fix mixed-tab-space indentation.

Signed-off-by: lolilolicon <lolilolicon@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
lolilolicon 2011-10-01 15:31:00 +08:00 committed by Dan McGee
parent c4d6688694
commit 94bc64ae1b

View File

@ -1256,17 +1256,6 @@ create_package() {
# tar it up # tar it up
msg2 "$(gettext "Compressing package...")" msg2 "$(gettext "Compressing package...")"
local EXT
case "$PKGEXT" in
*tar.gz) EXT=${PKGEXT%.gz} ;;
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
*tar.xz) EXT=${PKGEXT%.xz} ;;
*tar.Z) EXT=${PKGEXT%.Z} ;;
*tar) EXT=${PKGEXT} ;;
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
local fullver=$(get_full_version) local fullver=$(get_full_version)
local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}" local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}"
local ret=0 local ret=0
@ -1279,13 +1268,18 @@ create_package() {
shopt -s nullglob shopt -s nullglob
# TODO: Maybe this can be set globally for robustness # TODO: Maybe this can be set globally for robustness
shopt -s -o pipefail shopt -s -o pipefail
# bsdtar's gzip compression always saves the time stamp, making one
# archive created using the same command line distinct from another.
# Disable bsdtar compression and use gzip -n for now.
bsdtar -cf - $comp_files * | bsdtar -cf - $comp_files * |
case "$PKGEXT" in case "$PKGEXT" in
*tar.gz) gzip -c -f -n ;; *tar.gz) gzip -c -f -n ;;
*tar.bz2) bzip2 -c -f ;; *tar.bz2) bzip2 -c -f ;;
*tar.xz) xz -c -z - ;; *tar.xz) xz -c -z - ;;
*tar.Z) compress -c -f ;; *tar.Z) compress -c -f ;;
*tar) cat ;; *tar) cat ;;
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT"; cat ;;
esac > "${pkg_file}" || ret=$? esac > "${pkg_file}" || ret=$?
shopt -u nullglob shopt -u nullglob