mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
FS7485: Replace tar/cpio/unzip with bsdtar for extracting/creating packages.
Signed-off-by: Andrew Fyfe <andrew@neptune-one.net>
This commit is contained in:
parent
5a3b595837
commit
24c41f5190
@ -565,7 +565,6 @@ extract_sources() {
|
|||||||
msg "$(gettext "Extracting Sources...")"
|
msg "$(gettext "Extracting Sources...")"
|
||||||
local netfile
|
local netfile
|
||||||
for netfile in "${source[@]}"; do
|
for netfile in "${source[@]}"; do
|
||||||
unziphack=0
|
|
||||||
file=$(strip_url "$netfile")
|
file=$(strip_url "$netfile")
|
||||||
if in_array "$file" ${noextract[@]}; then
|
if in_array "$file" ${noextract[@]}; then
|
||||||
#skip source files in the noextract=() array
|
#skip source files in the noextract=() array
|
||||||
@ -577,14 +576,7 @@ extract_sources() {
|
|||||||
local file_type=$(file -biz "$file")
|
local file_type=$(file -biz "$file")
|
||||||
local cmd=''
|
local cmd=''
|
||||||
case "$file_type" in
|
case "$file_type" in
|
||||||
*application/x-tar*application/x-compress*)
|
*application/x-tar*|*application/x-zip*|*application/x-cpio*)
|
||||||
cmd="tar -xzf $file" ;;
|
|
||||||
*application/x-tar*)
|
|
||||||
cmd="tar -xf $file" ;;
|
|
||||||
*application/x-zip*)
|
|
||||||
unziphack=1
|
|
||||||
cmd="unzip -qqo $file" ;;
|
|
||||||
*application/x-cpio*)
|
|
||||||
cmd="bsdtar -x -f $file" ;;
|
cmd="bsdtar -x -f $file" ;;
|
||||||
*application/x-gzip*)
|
*application/x-gzip*)
|
||||||
cmd="gunzip -d -f $file" ;;
|
cmd="gunzip -d -f $file" ;;
|
||||||
@ -600,12 +592,8 @@ extract_sources() {
|
|||||||
msg2 "$cmd"
|
msg2 "$cmd"
|
||||||
$cmd || ret=$?
|
$cmd || ret=$?
|
||||||
if [ $ret -ne 0 ]; then
|
if [ $ret -ne 0 ]; then
|
||||||
# unzip will return a 1 as a warning, it is not an error
|
error "$(gettext "Failed to extract %s")" "$file"
|
||||||
if [ $unziphack -ne 1 -o $ret -ne 1 ]; then
|
plain "$(gettext "Aborting...")"
|
||||||
error "$(gettext "Failed to extract %s")" "$file"
|
|
||||||
plain "$(gettext "Aborting...")"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -823,7 +811,7 @@ create_package() {
|
|||||||
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
|
||||||
comp_files="$comp_files .PKGINFO .FILELIST"
|
comp_files="$comp_files .PKGINFO .FILELIST"
|
||||||
|
|
||||||
if ! tar -czf "$pkg_file" $comp_files $(ls); then
|
if ! bsdtar -czf "$pkg_file" $comp_files $(ls); then
|
||||||
error "$(gettext "Failed to create package file.")"
|
error "$(gettext "Failed to create package file.")"
|
||||||
exit 1 # TODO: error code
|
exit 1 # TODO: error code
|
||||||
fi
|
fi
|
||||||
@ -914,7 +902,7 @@ create_srcpackage() {
|
|||||||
|
|
||||||
# tar it up
|
# tar it up
|
||||||
msg2 "$(gettext "Compressing source package...")"
|
msg2 "$(gettext "Compressing source package...")"
|
||||||
if ! tar -czf "$pkg_file" $comp_files; then
|
if ! bsdtar -czf "$pkg_file" $comp_files; then
|
||||||
error "$(gettext "Failed to create source package file.")"
|
error "$(gettext "Failed to create source package file.")"
|
||||||
exit 1 # TODO: error code
|
exit 1 # TODO: error code
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user