[aur-general] Appending prefix with fileuri to filename in source array

Eli Schwartz eschwartz at archlinux.org
Wed Aug 16 22:21:13 UTC 2017


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/aur-general/attachments/20170816/09dc2d5b/attachment.asc>


More information about the aur-general mailing list