Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (3baed3548466bd930e1f42caacaf97e4eadcca4c)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Jaka Kranjc <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (3baed3548466bd930e1f42caacaf97e4eadcca4c)
  • Date: Thu, 4 Dec 2008 09:58:58 -0600

GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx AT sourcemage.org>:

ChangeLog | 2
usr/sbin/scribe | 2
var/lib/sorcery/modules/dl_handlers/dl_hg | 88 +++++++++++++++++
var/lib/sorcery/modules/libsummon | 2
var/lib/sorcery/modules/url_handlers/url_hg_http | 118
+++++++++++++++++++++++
5 files changed, 210 insertions(+), 2 deletions(-)

New commits:
commit 3baed3548466bd930e1f42caacaf97e4eadcca4c
Author: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx AT sourcemage.org>

url_hg_http, dl_hg, libsummon, scribe: added hg support #14771,
slightly modified patch by Remko van der Vossen

diff --git a/ChangeLog b/ChangeLog
index 75e8eb6..d4f7be7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
* resurrect: also redefine FAILED_LIST
* summon: simplified set_print_type
* alter, libtablet: added the missing version cache support #14934
+ * url_hg_http, dl_hg, libsummon, scribe: added hg support #14771,
+ slightly modified patch by Remko van der Vossen

2008-12-03 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* gaze: improved what/short when dealing with multiple spells #14839
diff --git a/usr/sbin/scribe b/usr/sbin/scribe
index aac01bb..dbd0ab8 100755
--- a/usr/sbin/scribe
+++ b/usr/sbin/scribe
@@ -241,7 +241,7 @@ function scribe_add_update_worker() {
fi

local tree_prefixes="rsync svn svn_http svn_https svn_ssh cvs smgl_tla"
- tree_prefixes="$tree_prefixes dir git git_http"
+ tree_prefixes="$tree_prefixes dir git git_http hg_http"
if list_find "$tree_prefixes" "$prefix"; then
grim_target=$grim_name
else
diff --git a/var/lib/sorcery/modules/dl_handlers/dl_hg
b/var/lib/sorcery/modules/dl_handlers/dl_hg
new file mode 100644
index 0000000..4a94bbd
--- /dev/null
+++ b/var/lib/sorcery/modules/dl_handlers/dl_hg
@@ -0,0 +1,88 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2008 by the Source Mage Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+##=item dl_get_hg <url>
+##
+## Fetch the specified mercurial url.
+##
+## This handler only supports tree downloads.
+##
+#---------------------------------------------------------------------
+function dl_hg_get () {
+ dl_command_check hg || return 254
+
+ local target=$1
+ local url_list=$2
+ local hints=$3
+ local dl_target=$4
+ local dl_type=$5
+ local url rc=0
+
+ [[ $target ]] &&
+ dl_connect || return 255
+
+ for url in $url_list; do
+ local URL HG_ROOT HG_DIRECTORY HG_TAG
+ url_crack "$url" "$hints"
+ if [[ -z $HG_DIRECTORY ]]
+ then
+ HG_DIRECTORY=${target/.hg/}
+ fi
+ if [[ -d $HG_DIRECTORY ]]; then
+ message "${MESSAGE_COLOR}Running hg pull...${DEFAULT_COLOR}"
+ ( cd $HG_DIRECTORY &&
+ echo hg pull $HG_ROOT
+ hg pull $HG_ROOT &&
+ echo hg update $HG_TAG
+ hg update $HG_TAG )
+ rc=$?
+ eval "$dl_target=\"$HG_DIRECTORY\""
+ else
+ message "${MESSAGE_COLOR}Running hg clone...${DEFAULT_COLOR}"
+ echo hg clone $HG_ROOT $HG_DIRECTORY
+ hg clone $HG_ROOT $HG_DIRECTORY &&
+ ( cd $HG_DIRECTORY &&
+ echo hg update $HG_TAG
+ hg update $HG_TAG )
+ rc=$?
+ eval "$dl_target=\"$HG_DIRECTORY\""
+ fi
+ [[ $rc == 0 ]] && break
+ done
+ dl_disconnect
+
+ eval "$dl_type=\"tree\""
+ return $rc
+}
+
+#---------------------------------------------------------------------
+##=back
+##
+##=head1 LICENSE
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------
diff --git a/var/lib/sorcery/modules/libsummon
b/var/lib/sorcery/modules/libsummon
index 5547d99..bc079df 100755
--- a/var/lib/sorcery/modules/libsummon
+++ b/var/lib/sorcery/modules/libsummon
@@ -403,7 +403,7 @@ function unpack_for_update() {

# hard-coded list of url prefixes that generally download trees
local tree_prefixes="cvs dir rsync smgl_tla svn svn_http svn_ssh git"
- tree_prefixes="$tree_prefixes svn_https git_http"
+ tree_prefixes="$tree_prefixes svn_https git_http hg_http"
local prefix=$(url_get_prefix $url_list)
if ! list_find "$hints" file &&
list_find "$hints" tree || list_find "$tree_prefixes" "$prefix" ; then
diff --git a/var/lib/sorcery/modules/url_handlers/url_hg_http
b/var/lib/sorcery/modules/url_handlers/url_hg_http
new file mode 100644
index 0000000..c250557
--- /dev/null
+++ b/var/lib/sorcery/modules/url_handlers/url_hg_http
@@ -0,0 +1,118 @@
+#!/bin/bash
+#---------------------------------------------------------------------
+##
+##=head1 SYNOPSIS
+##
+## Url handler functions for downloading hg http urls
+##
+##=head1 DESCRIPTION
+##
+## This file contains functions for downloading and verifying
+## hg http urls. This file uses the "hg" program.
+##
+##=head1 COPYRIGHT
+##
+## Copyright 2008 by the Source Mage Team
+##
+##=head1 FUNCTIONS
+##
+##=over 4
+##
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+##=item url_hg_http_crack <url>
+##
+## Parse the specified hg http url.
+##
+## @Global URL
+## @Global HG_ROOT
+## @Global HG_DIRECTORY
+## @Global HG_TAG
+##
+#---------------------------------------------------------------------
+function url_hg_http_crack() {
+ URL=$(url_strip_prefix "$1" hg_http)
+ HG_ROOT=$(echo $URL | sed "s#\(^[^/]*[^:]*\):.*#\1#")
+ HG_ROOT=http://$HG_ROOT
+ local HG_DIRECTORY_TAG=$(echo $URL | sed "s#^[^/]*[^:]*\(.*\)#\1#")
+ HG_DIRECTORY=$(echo $HG_DIRECTORY_TAG | cut -d : -f2)
+ local HG_TAGNAME=$(echo $HG_DIRECTORY_TAG | cut -d : -f3)
+ HG_TAG=${HG_TAGNAME:=default}
+}
+
+#---------------------------------------------------------------------
+##=item url_hg_http_bucketize <url>
+##
+## echoes the download handler - hg
+##
+#---------------------------------------------------------------------
+function url_hg_http_bucketize() {
+ echo hg
+}
+
+#---------------------------------------------------------------------
+##=item url_hg_http_verify <url>
+##
+## Verifies the specified hg http url. Returns true if the url exists
+## OR if the url is an empty string.
+##
+#---------------------------------------------------------------------
+function url_hg_http_verify() {
+ local URL HG_ROOT HG_DIRECTORY HG_TAG item
+ url_hg_http_crack $1
+ for item in URL HG_ROOT HG_DIRECTORY HG_TAG ; do
+ if ! [[ ${!item} ]] ; then
+ return 1
+ fi
+ done
+}
+
+#---------------------------------------------------------------------
+##=item url_hg_http_hostname <url>
+##
+## Gets the hostname out of the url
+#---------------------------------------------------------------------
+function url_hg_http_hostname() {
+ echo $1|sed 's:^.*//\([^/]*\).*$:\1:'
+}
+
+#---------------------------------------------------------------------
+##=item url_hg_http_netselect <url>
+##
+## Gets a netselect type output for the url
+##
+#---------------------------------------------------------------------
+function url_hg_http_netselect() {
+ local tmp_hostname url_speed each
+
+ for each in "$@" ; do
+ tmp_hostname=$(url_hg_http_hostname $each)
+ # since we had to pull the url apart to give netselect
+ # something it can understand we'll just pretend like
+ # multiple A records wont exist for this host...
+ url_speed=$(netselect -s 1 $tmp_hostname 2>/dev/null|awk '{print $1}')
+ [[ -n $url_speed ]] && echo "$url_speed $each"
+ done
+}
+
+#---------------------------------------------------------------------
+##=back
+##
+##=head1 LICENSE
+##
+## This software is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This software is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this software; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+#---------------------------------------------------------------------



  • [SM-Commit] GIT changes to master sorcery by Jaka Kranjc (3baed3548466bd930e1f42caacaf97e4eadcca4c), Jaka Kranjc, 12/04/2008

Archive powered by MHonArc 2.6.24.

Top of Page