FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 06-26-2012, 11:51 PM
Dave Reisner
 
Default makepkg: add function to return download protocol

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@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
" "${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
" "${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.

> + else
> + printf "%s
" local
> + fi
> +}
> +
> get_downloadclient() {
> # $1 = URL with valid protocol prefix
> local url=$1
> --
> 1.7.11.1
>
>
 
Old 06-27-2012, 01:14 AM
Dan McGee
 
Default makepkg: add function to return download protocol

On Tue, Jun 26, 2012 at 6:51 PM, Dave Reisner <d@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@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
" "${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
" "${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
 
Old 06-27-2012, 02:18 AM
Allan McRae
 
Default makepkg: add function to return download protocol

On 27/06/12 11:14, Dan McGee wrote:
> On Tue, Jun 26, 2012 at 6:51 PM, Dave Reisner <d@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@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
" "${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
" "${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?
>

Hmm.... this could be interesting...

local assumes that the file is in $startdir. I guess file:// could be
used to specify files anywhere on your system, but that really does not
make a portable PKGBUILD.

I'm tempted to say all local files must be in $startdir and so no
support of file:// is needed.

Allan
 
Old 07-12-2012, 03:01 PM
Thomas Bächler
 
Default makepkg: add function to return download protocol

Am 27.06.2012 04:18, schrieb Allan McRae:
> Hmm.... this could be interesting...
>
> local assumes that the file is in $startdir. I guess file:// could be
> used to specify files anywhere on your system, but that really does not
> make a portable PKGBUILD.
>
> I'm tempted to say all local files must be in $startdir and so no
> support of file:// is needed.

Imagine you have a bunch of PKGBUILDs with mirror=... in them and use
$mirror a lot in source=(). Then you get a local mirror and mass-replace
mirror= with a file:// URL in all of them.

I say this is useful.
 

Thread Tools




All times are GMT. The time now is 09:19 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org