makepkg: fix regression that broke extraction of file:// sources

In commit 9c817b6549 we made these sources
extendable, and heuristically determined the correct extraction
functions to use. But our fallback for protos that didn't have an exact
extract_* function didn't take into account that 'extract_file' matches
an actual proto... so we passed the netfile in while the function
expected a file.

Solution: the function should expect a netfile too, thereby allowing us
to delay an attempted resolution of netfile -> file, to the one case
where it is actually used. This makes us slightly more efficient in the
non-file case, makes our functions a bit more consistent, and makes
file:// extraction work again.

Fixes FS#64648

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
(cherry picked from commit 349c22d043)
This commit is contained in:
Eli Schwartz 2019-11-25 19:07:56 -05:00 committed by Andrew Gregory
parent 41c3b1d78c
commit 6f1a9e6ea8
2 changed files with 3 additions and 3 deletions

View file

@ -75,12 +75,11 @@ extract_sources() {
get_all_sources_for_arch 'all_sources' get_all_sources_for_arch 'all_sources'
for netfile in "${all_sources[@]}"; do for netfile in "${all_sources[@]}"; do
local file=$(get_filename "$netfile")
local proto=$(get_protocol "$netfile") local proto=$(get_protocol "$netfile")
if declare -f extract_$proto > /dev/null; then if declare -f extract_$proto > /dev/null; then
extract_$proto "$netfile" extract_$proto "$netfile"
else else
extract_file "$file" extract_file "$netfile"
fi fi
done done
} }

View file

@ -83,8 +83,9 @@ download_file() {
} }
extract_file() { extract_file() {
local file=$1 local netfile=$1
local file=$(get_filename "$netfile")
local filepath=$(get_filepath "$file") local filepath=$(get_filepath "$file")
rm -f "$srcdir/${file}" rm -f "$srcdir/${file}"
ln -s "$filepath" "$srcdir/" ln -s "$filepath" "$srcdir/"