From 36413aa856a7cace1851679c1398403b30417e80 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 8 Jan 2012 21:48:04 +1000 Subject: makepkg: simplify source archive generation Simplify the source tarball generation by unifying the handling of local and remote files. This also allows local files to be found in $SRCDEST (FS#26580) and makepkg will abort on missing local source files (only possible to trigger in combination with --skipinteg). Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 7cf4844d..d25582f3 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1334,11 +1334,9 @@ create_srcpackage() { local file for file in "${source[@]}"; do - if [[ -f $file ]]; then - msg2 "$(gettext "Adding %s...")" "$file" - ln -s "${startdir}/$file" "$srclinks/$pkgbase" - elif (( SOURCEONLY == 2 )); then - local absfile=$(get_filepath "$file") || missing_source_file "$file" + if [[ "$file" == $(get_filename "$file") ]] || (( SOURCEONLY == 2 )); then + local absfile + absfile=$(get_filepath "$file") || missing_source_file "$file" msg2 "$(gettext "Adding %s...")" "${absfile##*/}" ln -s "$absfile" "$srclinks/$pkgbase" fi -- cgit v1.2.3-54-g00ecf From 2b38f4eab7684e0f1e78b0b10953bf28915e963a Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 8 Jan 2012 21:54:35 +1000 Subject: makepkg: fix missing source file detection Declaring the variable as local on the same line as the assignment results in result of the assignment being returned rather than the result of the function on the righthand side of the assignment. Declaring the variable as local on a separate line means the result of the function on the r.h.s. is returned and our error function will be invoked if necessary (although it is practically impossible to ever trigger it...). Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index d25582f3..a700d9d0 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -624,7 +624,8 @@ generate_checksums() { local netfile for netfile in "${source[@]}"; do - local file="$(get_filepath "$netfile")" || missing_source_file "$netfile" + local file + file="$(get_filepath "$netfile")" || missing_source_file "$netfile" local sum="$(openssl dgst -${integ} "$file")" sum=${sum##* } (( ct )) && echo -n "$indent" -- cgit v1.2.3-54-g00ecf From 73d0d743bda5367fcab2453bbe21c15e481150c2 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 8 Jan 2012 23:57:48 +1000 Subject: makepkg: abort on missing download agent makepkg would not abort on a missing download agent due to the output variable being declared local on the same line as the function call in the assignment. That would result in strange output such as: ==> Retrieving Sources... ==> ERROR: There is no agent set up to handle foo URLs. Check /etc/makepkg.conf. Aborting... -> Downloading foobaz... /home/arch/code/pacman/scripts/makepkg: line 401: foo://foobaz: No such file or directory ==> ERROR: Failure while downloading foobaz Aborting... Signed-off-by: Allan McRae Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index a700d9d0..797b8d78 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -551,7 +551,8 @@ download_sources() { fi # find the client we should use for this URL - local dlclient=$(get_downloadclient "$url") || exit $? + local dlclient + dlclient=$(get_downloadclient "$url") || exit $? msg2 "$(gettext "Downloading %s...")" "$file" # fix flyspray bug #3289 -- cgit v1.2.3-54-g00ecf