[aur-general] Appending prefix with fileuri to filename in source array
I'm currently messing around with local kernel PKGBUILDs containing a lot git format-patches from many different sources. I could always source them locally, find very tricky conditions to patch them in order, or bulk rename them; but I was wondering if it was possible to download and append a prefix without manually copying the whole filename from the uri. Basically from this: "${_prefix}0001-PATCH.patch::${_uripath}/0001-PATCH.patch" to something like this "${_prefix}#URI::${_uripath}/0001-PATCH.patch" I'm not too sure how to approach this or whether this is possible, but I am curious nonetheless. Many thanks, Tom Nguyen
On 08/16/2017 03:25 PM, Tom Nguyen via aur-general wrote:
I'm currently messing around with local kernel PKGBUILDs containing a lot git format-patches from many different sources. I could always source them locally, find very tricky conditions to patch them in order, or bulk rename them; but I was wondering if it was possible to download and append a prefix without manually copying the whole filename from the uri.
Basically from this:
"${_prefix}0001-PATCH.patch::${_uripath}/0001-PATCH.patch"
to something like this
"${_prefix}#URI::${_uripath}/0001-PATCH.patch"
I'm not too sure how to approach this or whether this is possible, but I am curious nonetheless.
Well, I suppose you *could* do e.g. source=("${_uripath1}/0001-PATCH.patch" "${_uripath2}/0002-PATCH.patch" "${_uripath3}/0003-PATCH.patch") newsource=() for _src in "${source[@]}"; do _file="${_src##*//}" _file="${_file//\//_}" newsource+=("$_file::$_src") done source=("${newsource[@]}") But I don't think it is usually worth attempting to automate this. It's a lot easier in basically every respect to just bite the bullet and rename them manually. Or rely on the order of the source array itself. TBH I am still not entirely sure what you are trying to accomplish. -- Eli Schwartz
participants (2)
-
Eli Schwartz
-
Tom Nguyen