summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Ball <nullspoon@oper.io>2017-06-29 23:41:42 -0600
committerAaron Ball <nullspoon@oper.io>2017-06-29 23:41:42 -0600
commit712c602b87f41f6f0e33a495ec39a943adcc966b (patch)
tree2218758d2ba2ebdfbbae2a699f505fa7d7bc678b
parenta224d4e77ec027718a37dea8b1503fe6f512611d (diff)
downloadportimg-712c602b87f41f6f0e33a495ec39a943adcc966b.tar.gz
portimg-712c602b87f41f6f0e33a495ec39a943adcc966b.tar.xz
libport:Added port_download_src function
This function is to superceed the pkg_download_src function, as that one is a bit of a misnomer. This one is also simpler and, per the name, it now only performs one task: downloading source files. The superceeded function pkg_download_src also handled extraction into the temporary packaging location, which was an overstep.
-rw-r--r--lib/port.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/port.sh b/lib/port.sh
index 0797e57..dd7a484 100644
--- a/lib/port.sh
+++ b/lib/port.sh
@@ -44,3 +44,33 @@ function download_src {
curl -L -s -k -o "${destdir}/${localname}" "${uri}"
}
+
+#
+# Downloads the list of source files to the specified port directory. If the
+# file is local, it is skipped (with a friendly info message).
+#
+# @param _src Array reference of sources (from the Pkgfile)
+#
+function port_download_src {
+ local _ref_src="${1:-}"
+
+ # Download from Pkgfile src spec
+ for file in ${!_ref_src}; do
+ if [ -f "${file}" ]; then
+ # If the source file exists locally, just copy from here
+ linfo "File ${file} exists locally."
+ continue
+ else
+ # The "file" is probably a uri that couldn't be resolved locally, so we
+ # get the basename and see if that exists locally.
+ if [ -f $(basename ${file}) ]; then
+ linfo "Source '${file}' already downloaded"
+ else
+ linfo "Downloading ${file}"
+ download_src "${file}" "./"
+ fi
+ fi
+ done
+}
+
+

Generated by cgit