mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-12 04:15:06 -05:00
Link non-vcs sources into $srcdir during extraction
The separation between downloading and extracting for non-vsc sources was incomplete due to symlinks being made in $srcdir during the download stage. Have download_{local,file} just ensure the presence of the files in $startdir or $SRCDEST (downloading if needed) and then have extract_file symlink these files into $srcdir. Also replace "continue" with "return" in extract_file to make it clearer what is happening. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
d5ff21c221
commit
2f7e92ad04
@ -320,8 +320,6 @@ download_local() {
|
|||||||
|
|
||||||
if [[ -n "$filepath" ]]; then
|
if [[ -n "$filepath" ]]; then
|
||||||
msg2 "$(gettext "Found %s")" "${filepath##*/}"
|
msg2 "$(gettext "Found %s")" "${filepath##*/}"
|
||||||
rm -f "$srcdir/${filepath##*/}"
|
|
||||||
ln -s "$filepath" "$srcdir/"
|
|
||||||
else
|
else
|
||||||
local filename=$(get_filename "$netfile")
|
local filename=$(get_filename "$netfile")
|
||||||
error "$(gettext "%s was not found in the build directory and is not a URL.")" "$filename"
|
error "$(gettext "%s was not found in the build directory and is not a URL.")" "$filename"
|
||||||
@ -335,8 +333,6 @@ download_file() {
|
|||||||
local filepath=$(get_filepath "$netfile")
|
local filepath=$(get_filepath "$netfile")
|
||||||
if [[ -n "$filepath" ]]; then
|
if [[ -n "$filepath" ]]; then
|
||||||
msg2 "$(gettext "Found %s")" "${filepath##*/}"
|
msg2 "$(gettext "Found %s")" "${filepath##*/}"
|
||||||
rm -f "$srcdir/${filepath##*/}"
|
|
||||||
ln -s "$filepath" "$srcdir/"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -384,13 +380,15 @@ download_file() {
|
|||||||
if [[ $dlfile != "$filename" ]]; then
|
if [[ $dlfile != "$filename" ]]; then
|
||||||
mv -f "$SRCDEST/$dlfile" "$SRCDEST/$filename"
|
mv -f "$SRCDEST/$dlfile" "$SRCDEST/$filename"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f "$srcdir/$filename"
|
|
||||||
ln -s "$SRCDEST/$filename" "$srcdir/"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_file() {
|
extract_file() {
|
||||||
local file=$1
|
local file=$1
|
||||||
|
|
||||||
|
local filepath=$(get_filepath "$file")
|
||||||
|
rm -f "$srcdir/${file}"
|
||||||
|
ln -s "$filepath" "$srcdir/"
|
||||||
|
|
||||||
# do not rely on extension for file type
|
# do not rely on extension for file type
|
||||||
local file_type=$(file -bizL "$file")
|
local file_type=$(file -bizL "$file")
|
||||||
local ext=${file##*.}
|
local ext=${file##*.}
|
||||||
@ -401,24 +399,24 @@ extract_file() {
|
|||||||
*application/x-gzip*)
|
*application/x-gzip*)
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
gz|z|Z) cmd="gzip" ;;
|
gz|z|Z) cmd="gzip" ;;
|
||||||
*) continue;;
|
*) return;;
|
||||||
esac ;;
|
esac ;;
|
||||||
*application/x-bzip*)
|
*application/x-bzip*)
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
bz2|bz) cmd="bzip2" ;;
|
bz2|bz) cmd="bzip2" ;;
|
||||||
*) continue;;
|
*) return;;
|
||||||
esac ;;
|
esac ;;
|
||||||
*application/x-xz*)
|
*application/x-xz*)
|
||||||
case "$ext" in
|
case "$ext" in
|
||||||
xz) cmd="xz" ;;
|
xz) cmd="xz" ;;
|
||||||
*) continue;;
|
*) return;;
|
||||||
esac ;;
|
esac ;;
|
||||||
*)
|
*)
|
||||||
# See if bsdtar can recognize the file
|
# See if bsdtar can recognize the file
|
||||||
if bsdtar -tf "$file" -q '*' &>/dev/null; then
|
if bsdtar -tf "$file" -q '*' &>/dev/null; then
|
||||||
cmd="bsdtar"
|
cmd="bsdtar"
|
||||||
else
|
else
|
||||||
continue
|
return
|
||||||
fi ;;
|
fi ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user