[pacman-dev] [PATCH 03/11] makepkg: add function to return download protocol

Dan McGee dpmcgee at gmail.com
Tue Jun 26 21:14:19 EDT 2012


On Tue, Jun 26, 2012 at 6:51 PM, Dave Reisner <d at falconindy.com> wrote:
> On Wed, Jun 27, 2012 at 08:58:09AM +1000, Allan McRae wrote:
>> Extract the download protocol from a source entry.  Returns "local"
>> for local source files.
>>
>> Signed-off-by: Allan McRae <allan at archlinux.org>
>> ---
>>  scripts/makepkg.sh.in | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 4299816..0d87cba 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -222,6 +222,17 @@ get_url() {
>>       printf "%s\n" "${1#*::}"
>>  }
>>
>> +# extract the protocol from a source entry - return "local" for local sources
>> +get_protocol() {
>> +     if [[ $1 = *://* ]]; then
>> +             # strip leading filename
>> +             local proto="${1##*::}"
>> +             printf "%s\n" "${proto%%://*}"
>
> While we're here, should we catch file:// protos and return 'local' as
> well? It would save the end user from having to define file:// as a
> DLAGENT.

Shouldn't we just return "file" instead of make up a "local" protocol,
while we're on this train of thought?

-Dan


More information about the pacman-dev mailing list