summaryrefslogtreecommitdiff
path: root/abuild.in
diff options
context:
space:
mode:
authorMatt Smith <mcs@darkregion.net>2010-12-28 20:22:17 -0600
committerNatanael Copa <ncopa@alpinelinux.org>2010-12-30 20:33:02 +0000
commit3386818e53b69e147626e3133ffdb6a93de7d85e (patch)
treef157588477d51664964636a17a9c2d9d55db6d4b /abuild.in
parentd4973fad4e1ff2cda477d0abc51f1776e96b79c9 (diff)
downloadabuild-3386818e53b69e147626e3133ffdb6a93de7d85e.tar.gz
abuild-3386818e53b69e147626e3133ffdb6a93de7d85e.tar.bz2
abuild-3386818e53b69e147626e3133ffdb6a93de7d85e.tar.xz
abuild-3386818e53b69e147626e3133ffdb6a93de7d85e.zip
abuild: created 'saveas-*://' URI support
'saveas-*://' URI support has been created for use with the source= line of APKBUILD files. It allows for a remote source file to be saved with an arbitrary filename. This is useful in situations where the last component of the URI is not the preferred filename. Here's how it works. Say we have the following URI: http://oss.example.org/?get=software&ver=1.0 Both Busybox Wget and GNU Wget will save this with the filename: ?get=software&ver=1.0 To get around this, we could use cURL to save the file using the filename in the HTTP response headers: $ curl -JO "http://oss.example.org/?get=software&ver=1.0" Or we could use this 'saveas' hack. Essentially, the original URI is converted to read: saveas-http://oss.example.org/?get=software&ver=1.0/software-1.0.tar.gz In the download process, the 'saveas-' portion is removed, and the file is downloaded from the original URI, but is saved with the filename being the last component of the URI. In this case, it will be saved as 'software-1.0.tar.gz'. It is designed so that it works with any protocol supported by abuild. For example: saveas-ftp://oss.example.org/?get=software&ver=1.0/software-1.0.tar.gz Check it out and let me know what you think. Thanks, Matt
Diffstat (limited to 'abuild.in')
-rwxr-xr-xabuild.in11
1 files changed, 9 insertions, 2 deletions
diff --git a/abuild.in b/abuild.in
index a56a56c..ec40612 100755
--- a/abuild.in
+++ b/abuild.in
@@ -179,7 +179,14 @@ uri_fetch() {
# we need GNU wget for this
case "$uri" in
- https://*) opts="--no-check-certificate";;
+ *https://*) opts="--no-check-certificate";;
+ esac
+
+ # fix saveas-*://* URIs
+ case "$uri" in
+ # remove 'saveas-' from beginning and
+ # '/filename' from end of URI
+ saveas-*://*) uri="${uri:7:$(expr ${#uri} - 7 - ${#d} - 1)}";;
esac
mkdir -p "$SRCDEST"
@@ -194,7 +201,7 @@ uri_fetch() {
is_remote() {
case "$1" in
- http://*|ftp://*|https://*)
+ http://*|ftp://*|https://*|saveas-*://*)
return 0;;
esac
return 1