/var/lib/sorcery/modules/url_handlers/url_svn_https

     1	#!/bin/bash
     2	#---------------------------------------------------------------------
     3	##
     4	##=head1 SYNOPSIS
     5	##
     6	## Url handler functions for parsing subversion over https urls.
     7	##
     8	##=head1 DESCRIPTION
     9	##
    10	## This file contains functions for parsing svn_https urls.
    11	##
    12	##=head1 SVN HTTP URL Format
    13	##
    14	## The sourcemage specific svn+ssh url is as follows:
    15	## specific format was invented:
    16	##
    17	##      svn_https://SVNURL:DIR_NAME
    18	##
    19	## The above url will download the latest version of the specified
    20	## module (i.e., the HEAD revision). To specify a specific revision,
    21	## the following format can be used:
    22	##
    23	##      svn://SVNURL:DIR_NAME:REVISION_TAG
    24	##
    25	## The SVNURL portion of the url will appear as a normal https url
    26	## sans https:// prefix.
    27	##
    28	## The DIR_NAME will be the tail element of the SOURCE_DIRECTORY.
    29	##
    30	## For more details, see the SVN manual at
    31	## https://svnbook.red-bean.com/svnbook/ch03s04.html
    32	## and url_svn.
    33	##
    34	##=head1 COPYRIGHT
    35	##
    36	## Copyright 2004 by the Source Mage Team
    37	## Copyright 2005 by the Source Mage Team
    38	##
    39	#---------------------------------------------------------------------
    40	
    41	#---------------------------------------------------------------------
    42	##=item url_svn_https_bucketize
    43	## @param url
    44	##
    45	## Outputs svn as that is the dl handler for svn_https:// urls
    46	#---------------------------------------------------------------------
    47	function url_svn_https_bucketize() {
    48	  echo svn
    49	}
    50	
    51	#---------------------------------------------------------------------
    52	##=item url_file_download <url>
    53	##
    54	## Parse the specified svn_https url.
    55	##
    56	## @Global URL
    57	## @Global SVN_ROOT
    58	## @Global SVN_MODULE
    59	## @Global SVN_TAG
    60	##
    61	#---------------------------------------------------------------------
    62	function url_svn_https_crack() {
    63	
    64	  URL=`url_strip_prefix "$1" svn_https`
    65	  SVN_ROOT=https://`echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#"`
    66	  local SVN_MODULE_TAG=`echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#"`
    67	  SVN_MODULE=`echo $SVN_MODULE_TAG | cut -d : -f2`
    68	  local SVN_TAGNAME=`echo $SVN_MODULE_TAG | cut -d : -f3`
    69	  SVN_TAG=${SVN_TAGNAME:=HEAD}
    70	
    71	}
    72	
    73	#---------------------------------------------------------------------
    74	##=item url_svn_https_is_valid <url>
    75	##
    76	## Ensure that all the fields that should be parsed out from a url
    77	## do indeed exist
    78	#---------------------------------------------------------------------
    79	function url_svn_https_is_valid() {
    80	  url_svn_is_valid "$@"
    81	}
    82	
    83	#---------------------------------------------------------------------
    84	##=item url_svn_https_hostname <url>
    85	##
    86	## Get the hostname of the url
    87	##
    88	#---------------------------------------------------------------------
    89	function url_svn_https_hostname() {
    90	  echo $1|sed 's#^svn_https://\([^/:]*\)[/:].*$#\1#'
    91	}
    92	
    93	#---------------------------------------------------------------------
    94	##=item url_svn_https_netselect <url>
    95	##
    96	## Gets a netselect type output for the url
    97	##
    98	#---------------------------------------------------------------------
    99	function url_svn_https_netselect() {
   100	  local tmp_hostname url_speed each
   101	
   102	  for each in "$@" ; do
   103	    tmp_hostname=$(url_svn_https_hostname $each)
   104	    # since we had to pull the url apart to give netselect
   105	    # something it can understand we'll just pretend like
   106	    # multiple A records wont exist for this host...
   107	    url_speed=$(netselect -s 1 $tmp_hostname 2>/dev/null|awk '{print $1}')
   108	    [[ -n $url_speed ]] && echo "$url_speed $each"
   109	  done
   110	}
   111	
   112	#---------------------------------------------------------------------
   113	##=back
   114	##
   115	##=head1 LICENSE
   116	##
   117	## This software is free software; you can redistribute it and/or modify
   118	## it under the terms of the GNU General Public License as published by
   119	## the Free Software Foundation; either version 2 of the License, or
   120	## (at your option) any later version.
   121	##
   122	## This software is distributed in the hope that it will be useful,
   123	## but WITHOUT ANY WARRANTY; without even the implied warranty of
   124	## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   125	## GNU General Public License for more details.
   126	##
   127	## You should have received a copy of the GNU General Public License
   128	## along with this software; if not, write to the Free Software
   129	## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   130	##
   131	#---------------------------------------------------------------------