[SM-Commit] GIT changes to master quill by Jaka Kranjc (9b19e353961fed535397f792dea73ec82f7431a7)

Jaka Kranjc scm at sourcemage.org
Fri Sep 14 05:01:00 EDT 2007


GIT changes to master quill by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 todo                                                |    2 
 usr/bin/quill                                       |    2 
 var/lib/quill/ChangeLog                             |    6 +
 var/lib/quill/modules/libcopy                       |    1 
 var/lib/quill/modules/libfreshmeatxml               |   94 ------------------
 var/lib/quill/modules/libfsfdirectory               |   49 ---------
 var/lib/quill/modules/libgna                        |    7 -
 var/lib/quill/modules/libhackagedb                  |  104 --------------------
 var/lib/quill/modules/libperlcpan                   |   97 ------------------
 var/lib/quill/modules/librubyraa                    |   59 -----------
 var/lib/quill/modules/libsavane                     |   62 -----------
 var/lib/quill/modules/libsavannah                   |    7 -
 var/lib/quill/modules/site_handlers/libfreshmeatxml |   94 ++++++++++++++++++
 var/lib/quill/modules/site_handlers/libfsfdirectory |   49 +++++++++
 var/lib/quill/modules/site_handlers/libgna          |    7 +
 var/lib/quill/modules/site_handlers/libhackagedb    |  104 ++++++++++++++++++++
 var/lib/quill/modules/site_handlers/libperlcpan     |   97 ++++++++++++++++++
 var/lib/quill/modules/site_handlers/librubyraa      |   59 +++++++++++
 var/lib/quill/modules/site_handlers/libsavane       |   62 +++++++++++
 var/lib/quill/modules/site_handlers/libsavannah     |    7 +
 var/lib/quill/version                               |    2 
 21 files changed, 490 insertions(+), 481 deletions(-)

New commits:
commit 9b19e353961fed535397f792dea73ec82f7431a7
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    	* libcore: added a sanity check to quill_final_put_in_grimoire
    	* quill: source the site handlers from their new home
    	* lib*: moved site handlers to modules/site_handlers

diff --git a/todo b/todo
index c73917d..5c376c8 100644
--- a/todo
+++ b/todo
@@ -15,6 +15,7 @@ new menu choices
 update mode:
   * plug other linters at the end of the update and move them all in liblint
   * add mirror support for SOURCE_URLs when adding new sources
+  * investigate the bash mirror url index mismatch when it was converted to gpg
 
 improvements in the standard mode:
   * handle bad entries and ^C better
@@ -28,6 +29,7 @@ documentation:
 
 modules:
   * a try-all switch with some basic apriori module reckognition support
+  * extract the common code
 
 overall:
   * Improve scripting support to make it possible to write alternate interfaces for it
diff --git a/usr/bin/quill b/usr/bin/quill
index 5bb57d9..cd26c07 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -142,7 +142,7 @@ done
 unset -f message
 . /etc/sorcery/config
 EDITOR=${EDITOR:-nano}
-for i in /var/lib/quill/modules/lib*
+for i in /var/lib/quill/modules/lib* /var/lib/quill/modules/site_handlers/*
 do
   . $i
 done
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 4f10eed..242f44f 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,9 @@
+2007-09-14 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
+	* libcore: added a sanity check to quill_final_put_in_grimoire
+	* quill: source the site handlers from their new home
+	* lib*: moved site handlers to modules/site_handlers
+	* version: 0.2.9-rc2
+
 2007-09-13 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* libdesktop: fixed the Version field of the desktop entry (spec version)
 	  fixed a punctuation error
diff --git a/var/lib/quill/modules/libcopy b/var/lib/quill/modules/libcopy
index 87fa965..4b96d92 100644
--- a/var/lib/quill/modules/libcopy
+++ b/var/lib/quill/modules/libcopy
@@ -197,6 +197,7 @@ function quill_final_put_in_grimoire() {
     mkdir -p $quill_grim_name/$quill_sect_name/$SPELL_NAME || return 1
 
     # we wipe it first, so we can handle any files that we deleted before
+    [[ "$quill_grim_name/$quill_sect_name/$SPELL_NAME" == "//" ]] && return 1
     rm -r "$quill_grim_name/$quill_sect_name/$SPELL_NAME" || return 1
     rm -f "$QUILL_SPELL_DIR/$SPELL_NAME/DETAILS.orig"
 
diff --git a/var/lib/quill/modules/libfreshmeatxml b/var/lib/quill/modules/libfreshmeatxml
deleted file mode 100644
index a217754..0000000
--- a/var/lib/quill/modules/libfreshmeatxml
+++ /dev/null
@@ -1,94 +0,0 @@
-#---
-## @Synopsis libfreshmeatxml
-#---
-
-##
-## @Globals none
-function quill_fmxml_grab_from_xml() {
-  xml_grep --text_only "${1}" "${2}"
-}
-
-##
-## @Globals SPELL_NAME FRESHMEAT_XML_URL FRESHMEAT_PROJECT_URL SPELL_DESC_NAME
-## @Globals FRESHMEAT_PROJECT_FILE FRESHMEAT_FILE QUILL_TMP_DIR SPELL_SRC_URL
-## @Globals SPELL_SRC_URL SPELL_LICENSE SPELL_SHORT_DESCRIPTION
-function quill_fmxml_core() {
-  # so it is set even if we end prematurely, useful when adding spells
-  # gets properly overwritten later on
-  SPELL_NAME="$1"
-
-  # if the argument looks like a url then use that, otherwise
-  # assume the argument is the name of the spell and construct a
-  # url for where we think freshmeat.net stores their xml data
-  if grep -q "http://" <<< "${1}" ; then
-    FRESHMEAT_XML_URL="$1"
-  else
-    FRESHMEAT_XML_URL="http://freshmeat.net/projects-xml/${1}/${1}.xml"
-    FRESHMEAT_PROJECT_URL="http://freshmeat.net/projects/${1}/"
-  fi
-
-  # check if we already have the xml file, if we dont, download it
-  FRESHMEAT_FILE="${QUILL_TMP_DIR}/${1}.xml"
-  FRESHMEAT_PROJECT_FILE="${QUILL_TMP_DIR}/${1}.fm"
-  if [[ ! -e ${FRESHMEAT_PROJECT_FILE} ]]; then
-    message -n "Attempting to retrieve project page ... "
-    wget -q -Uquill -O ${FRESHMEAT_PROJECT_FILE} "${FRESHMEAT_PROJECT_URL}" ||
-      { error_msg "Error: unable to fetch project page" && return 1; }
-    tr "\r" " " < ${FRESHMEAT_PROJECT_FILE} > ${FRESHMEAT_PROJECT_FILE}.tmp
-    mv ${FRESHMEAT_PROJECT_FILE}.tmp ${FRESHMEAT_PROJECT_FILE}
-    message "Done"
-  fi
-
-  if [[ ! -e ${FRESHMEAT_FILE} ]]; then
-    message -n "Attempting to retrieve project XML page ... "
-    wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" ||
-      { error_msg "Error: unable to fetch project XML page" && return 1; }
-    message "Done"
-  fi
-
-  # check that the project was found - exsists
-  local not_found='Error: project not found.'
-  if grep -q "$not_found" "$FRESHMEAT_FILE"; then
-    error_msg "$not_found"
-    rm "$FRESHMEAT_FILE"
-    return 1
-  fi
-
-  # fill in variables from xml file
-  SPELL_NAME=$(quill_fmxml_grab_from_xml projectname_short ${FRESHMEAT_FILE} |tr 'A-Z' 'a-z')
-  SPELL_NAME="${SPELL_NAME:-$1}"
-  SPELL_DESC_NAME="${SPELL_NAME}"
-  local tmp_url
-  for each in url_bz2 url_tgz url_zip; do
-    tmp_url="$(quill_fmxml_grab_from_xml $each ${FRESHMEAT_FILE})"
-    if [[ $tmp_url ]] ; then
-      SPELL_SRC_URL="$(grep "$each" ${FRESHMEAT_PROJECT_FILE} | grep -v "\<img\ src\>" | sed -e "s: *<a href.*\">\(.*\)</a><br>:\1:")"
-      break
-    fi
-  done
-  SPELL_URL="$(grep "url_homepage" ${FRESHMEAT_PROJECT_FILE} | grep -v "\<img\ src\>" | sed -e "s: *<a href.*\">\(.*\)</a><br>:\1:")"
-  SPELL_LICENSE="$(quill_fmxml_grab_from_xml license ${FRESHMEAT_FILE})"
-  if grep -q "(.*)" <<< "${SPELL_LICENSE}"; then
-    SPELL_LICENSE="$(awk '{print $NF}' <<< "$SPELL_LICENSE" | tr -d '()')"
-  fi
-  SPELL_SHORT_DESCRIPTION="$(quill_fmxml_grab_from_xml desc_short ${FRESHMEAT_FILE}|sed 's/\r//g')"
-  quill_fmxml_grab_from_xml desc_full ${FRESHMEAT_FILE} |fmt > ${QUILL_TMP_DIR}/${SPELL_NAME}
-}
-#---
-##
-## 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/quill/modules/libfsfdirectory b/var/lib/quill/modules/libfsfdirectory
deleted file mode 100644
index e3b89eb..0000000
--- a/var/lib/quill/modules/libfsfdirectory
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-## FSF/UNESCO directory module
-#
-
-function quill_fsf_get_deps(){
-  local data
-  local file
-  file="${2}"
-  data="${1}"
-  cat $file | \
-  grep "$data" | \
-  sed -e "s:.*<tr><td valign=\"top\">$data</td><td>\(.*\)</td></tr>.*:\1:g" |\
-  sed -e "s:</td></tr>.*::g"
-}
-##
-## @Globals SPELL_NAME SPELL_LICENSE SPELL_URL
-## @Globals QUILL_TMP_DIR
-function quill_fsf_core(){
-  local project
-  local fsf_project_file
-
-  # so it is set even if we end prematurely, useful when adding spells
-  # gets properly overwritten later on
-  SPELL_NAME="$1"
-  project="$2"
-  fsf_project_file=${QUILL_TMP_DIR}/${project}.fsf
-  if [[ ! -e ${fsf_project_file} ]]; then
-    message "Attempting to retrieve project page..."
-    wget -q -O $fsf_project_file \
-         http://directory.fsf.org/$project.html || \
-         (error_msg "Error: unable to fetch project page" && \
-         return 1)
-  fi
-  SPELL_SRC_URL="$(cat $fsf_project_file| grep "Source tarball" | sed -e 's:.*<tr><td valign=\"top\">Source tarball</td><td><a href=[^\"]*\"\([^\"]*\)\"[^\"]*>.*</a></td>.*:\1:g')"
-  SPELL_SHORT_DESCRIPTION="$(cat $fsf_project_file | grep "</p><h3>" | sed -e 's:.*</p><h3>\(.*\)</h3>.*:\1:')"
-  SPELL_DEPENDENCIES="$(quill_fsf_get_deps "Source languages" "$fsf_project_file") $(quill_fsf_get_deps "Build prerequisites" "$fsf_project_file") $(quill_fsf_get_deps "Use requirements" "$fsf_project_file"))"
-  SPELL_OPTIONAL_DEPENDENCIES="$(quill_fsf_get_deps "Weak prerequisites" "$fsf_project_file")"
-  SPELL_LICENSE="$(cat $fsf_project_file| grep "Licensed under" | sed -e 's:.*<tr><td>\(Licensed under .*\)\.</td></tr> *.*:\1:' -e 's:<tr><td>This.*::' -e 's:\.</td></tr>::')"
-  SPELL_URL="$(cat $fsf_project_file| grep "Web page" | sed -e 's:.*<tr><td valign=\"top\">Web page</td><td><a href=[^\"]*\"\([^\"]*\)\"[^\"]*>.*</a></td>.*:\1:g')"
-  cat $fsf_project_file | \
-  sed -e 's:<body bgcolor="white">:>INDEX<:' | \
-  sed -n '/INDEX/,/All_Packages_in_Directory/ p' | \
-  sed -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" | \
-  sed '/Obtaining/d' | \
-  sed '/INDEX/d' | \
-  sed 's:Top &gt;.* &gt;::g' > \
-      ${QUILL_TMP_DIR}/${SPELL_NAME}
-
-}
diff --git a/var/lib/quill/modules/libgna b/var/lib/quill/modules/libgna
deleted file mode 100644
index 5805702..0000000
--- a/var/lib/quill/modules/libgna
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-## Gna! module
-#
-
-function quill_gna_core(){
-  quill_savane_core "${1}" "https://gna.org/projects"
-}
diff --git a/var/lib/quill/modules/libhackagedb b/var/lib/quill/modules/libhackagedb
deleted file mode 100644
index 39d912d..0000000
--- a/var/lib/quill/modules/libhackagedb
+++ /dev/null
@@ -1,104 +0,0 @@
-#---
-## Haskell HackageDB module
-#---
-
-
-#---
-## @Globals none
-#---
-function quill_hdb_get_files(){
-  local package
-  local package_page
-  local cabal_file
-  local cabal_file_path
-
-  package="$1"
-  package_page="$2"
-  cabal_file="$3"
-
-  if [[ ! -e $package_page ]] ; then
-    message "Attempting to retrieve package page..."
-    wget -q -O $package_page \
-         http://hackage.haskell.org/cgi-bin/hackage-scripts/package/${package}/ || \
-         { error_msg "Error: unable to fetch package page";
-           return 1; }
-  else
-    message "Using cached package page..."
-  fi
-  if [[ ! -e $cabal_file ]] ; then
-    cabal_file_path=$(egrep -o "/packages/archive/${package}/.+/${package}\.cabal" $package_page)
-    message "Attempting to retrieve cabal file..."
-    wget -q -O ${cabal_file}.tmp \
-         http://hackage.haskell.org${cabal_file_path} || \
-         { error_msg "Error: unable to fetch cabal file";
-           return 1; }
-    cat ${cabal_file}.tmp | tr '\t' ' ' > $cabal_file
-    rm ${cabal_file}.tmp
-  else
-    message "Using cached cabal file..."
-  fi
-}
-
-#---
-## @Globals none
-#---
-function quill_hdb_get_info(){
-  local info
-  local package_page
-  local cabal_file
-  local desc_here
-  local possible_line
-
-  info="$1"
-  file="$2"
-
-  if [[ "$info" == "src" ]] ; then
-    echo "http://hackage.haskell.org$(egrep -o "/packages/archive/${package}/.+/${package}-.+\.tar.gz" $file)"
-  elif [[ "$info" == "description" ]] ; then
-    cat $file | while IFS="" ; read line ; do
-      if grep -i -q "^description:" <<< "$line" ; then
-        possible_line=$(sed -e "s/^description: *\(.*\)/\1/" <<< $line)
-        if [[ -n "$possible_line" ]] ; then
-          echo $possible_line
-        fi
-        desc_here=True
-      elif [[ -n "$desc_here" ]] && egrep -q "^[[:alpha:]|-]+:" <<< "$line" ; then
-        break
-      elif [[ -n "$desc_here" ]] ; then
-        echo ${line} | sed -e "s/^ *\.\?//"
-      fi
-    done
-  elif [[ "$info" == "build-depends" ]] ; then
-    grep -i "${info}:" $file | sed -e "s/${info}: *\(.*\)/\1/" | \
-    sed -e "s/\([^><=]\+\)[><=]\+[0-9.]\+/\1/g" | tr -d ',' | \
-    sed -e "s/^base \+\| \+base \+\| \+base$/ /" | \
-    sed -e "s/^unix \+\| \+unix \+\| \+unix$/ /"
-  else
-    grep -i "${info}:" $file | sed -e "s/${info}: *\(.*\)/\1/"
-  fi
-}
-
-#---
-## @Globals SPELL_NAME QUILL_TMP_DIR SPELL_LICENSE
-## @Globals SPELL_SHORT_DESCRIPTION SPELL_DESC_NAME
-## @Globals SPELL_URL SPELL_SRC_URL SPELL_DEPENDENCIES
-#---
-function quill_hdb_core(){
-  local package
-  local package_page
-  local cabal_file
-
-  SPELL_NAME="$1"
-  package="$2"
-
-  package_page=${QUILL_TMP_DIR}/${package}.hdb
-  cabal_file=${QUILL_TMP_DIR}/${package}.cabal
-  quill_hdb_get_files "$package" "$package_page" "$cabal_file" || return 1
-  SPELL_LICENSE="$(quill_hdb_get_info  "license" "$cabal_file")"
-  SPELL_SHORT_DESCRIPTION="$(quill_hdb_get_info  "synopsis" "$cabal_file")"
-  SPELL_DESC_NAME=${SPELL_NAME}.desc
-  quill_hdb_get_info "description" "$cabal_file" > ${QUILL_TMP_DIR}/${SPELL_DESC_NAME}
-  SPELL_URL="$(quill_hdb_get_info  "homepage" "$cabal_file")"
-  SPELL_SRC_URL="$(quill_hdb_get_info "src" "$package_page")"
-  SPELL_DEPENDENCIES="ghc "$(quill_hdb_get_info "build-depends" "$cabal_file")
-}
diff --git a/var/lib/quill/modules/libperlcpan b/var/lib/quill/modules/libperlcpan
deleted file mode 100644
index d473c03..0000000
--- a/var/lib/quill/modules/libperlcpan
+++ /dev/null
@@ -1,97 +0,0 @@
-#---
-## @Synopsis Perl-cpan module to generate spells from perl-cpan metadata
-#---
-
-##
-## @Globals QUILL_TMP_DIR
-function quill_get_manifests()
-{
-  # unless someone knows a better way to check files creation time
-  # this shoud work quite well
-  # basicaly update if the files are over a day old
-  if [[ ! -f $QUILL_TMP_DIR/02packages.details.txt.gz ]] ||
-     [[ ! -f $QUILL_TMP_DIR/03modlist.data.gz ]] ||
-     [[ ! "$(find ${QUILL_TMP_DIR}/02packages.details.txt.gz -ctime 0)" == "${QUILL_TMP_DIR}/02packages.details.txt.gz" ]] ||
-     [[ ! "$(find ${QUILL_TMP_DIR}/03modlist.data.gz -ctime 0)" == "${QUILL_TMP_DIR}/03modlist.data.gz" ]]
-  then
-    cd $QUILL_TMP_DIR
-    message -n "Retrieving 02packages.details.txt.gz ... "
-    wget -q \
-         -O 02packages.details.txt.gz \
-         ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz ||
-         (error_msg "Error: unable to fetch 02packages.details.txt.gz" && return 1)
-    message "done."
-
-    message -n "Retrieving 03modlist.data.gz ... "
-    wget -q \
-         -O 03modlist.data.gz \
-         ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz ||
-         (error_msg "Error: unable to fetch 03modlist.data.gz" && return 1)
-    message "done."
-  fi
-}
-
-##
-## @Globals QUILL_CPAN_INFO QUILL_CPAN_METADATA
-function quill_get_cpan_meta(){
-  eval QUILL_CPAN_INFO="( $(zgrep -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz | head -n1) )"
-#  zgrep -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz | head -n1
-  eval QUILL_CPAN_METADATA="( $(zgrep -w -B1 -A9 -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz | tr -d "[]" | sed 's:,$::g' ) )"
-#  zgrep -w -B1 -A9 -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz | tr -d "[]" | sed 's:,$::g'
-}
-
-##
-## @Globals QUILL_TMP_DIR SPELL_NAME SPELL_SRC_URL SPELL_VERSION SPELL_LICENSE
-## @Globals SPELL_SHORT_DESCRIPTION SPELL_URL SPELL_DEPENDENCIES BUILDISON
-## @Globals DEPENDSISON QUILL_CPAN_INFO QUILL_CPAN_METADATA
-function quill_cpan_core()
-{
-  # so it is set even if we end prematurely, useful when adding spells
-  # gets properly overwritten later on
-  SPELL_NAME="$2"
-
-  quill_get_manifests || return 1
-  if zgrep -q -w -E "^$SPELL_NAME" $QUILL_TMP_DIR/02packages.details.txt.gz ||
-     zgrep -q -w -E "^'$SPELL_NAME'" $QUILL_TMP_DIR/03modlist.data.gz
-  then
-    quill_get_cpan_meta $SPELL_NAME
-    SPELL_NAME="$(sed -e 's/::/-/g' <<< "$SPELL_NAME")"
-    SPELL_SRC_URL="http://www.cpan.org/authors/id/${QUILL_CPAN_INFO[2]}"
-    SPELL_VERSION="${QUILL_CPAN_INFO[1]}"
-    SPELL_SHORT_DESCRIPTION="${QUILL_CPAN_METADATA[6]}"
-    SPELL_LICENSE="ART"
-    SPELL_URL="http://search.cpan.org/~${QUILL_CPAN_METADATA[7]}/${SPELL_NAME}/"
-    local description
-    description="${QUILL_CPAN_METADATA[6]}"
-    SPELL_NAME="${1//::/-}" # the lower case target wasn't manipulated yet
-    echo $description > ${QUILL_TMP_DIR}/${SPELL_NAME}
-    BUILDISON="BUILD, "
-    touch ${QUILL_TMP_DIR}/${SPELL_NAME}-BUILD
-    echo "default_build_perl" > ${QUILL_TMP_DIR}/${SPELL_NAME}-BUILD
-    DEPENDSISON="DEPENDS, "
-    SPELL_DEPENDENCIES="perl"
-  else
-    error_msg "Error: unable to find such a CPAN module"
-    return 1
-  fi
-
-}
-
-#---
-##
-## 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/quill/modules/librubyraa b/var/lib/quill/modules/librubyraa
deleted file mode 100644
index f76ee82..0000000
--- a/var/lib/quill/modules/librubyraa
+++ /dev/null
@@ -1,59 +0,0 @@
-#
-## Ruby RAA module
-#
-
-##
-## @Globals none
-function quill_raa_get_info(){
-  local info
-  local raa_project_file
-  info="${1}"
-  raa_project_file="${2}"
-  grep "${info}:" $raa_project_file | sed -e "s/ *${info}: *\(.*\)/\1/"
-}
-
-##
-## @Globals SPELL_NAME SPELL_SHORT_DESCRIPTION SPELL_LICENSE SPELL_URL
-## @Globals SPELL_SRC_URL SPELL_DEPENDENCIES DEPENDSISON QUILL_TMP_DIR
-function quill_raa_core(){
-  local project
-  local desc
-  local line
-  local raa_project_file
-
-  # so it is set even if we end prematurely, useful when adding spells
-  # gets properly overwritten later on
-  SPELL_NAME="$1"
-  project="$SPELL_NAME"
-  raa_project_file=${QUILL_TMP_DIR}/${project}.raa
-  if [[ ! -e ${raa_project_file} ]]; then
-    message "Attempting to retrieve project page..."
-    wget -q -O $raa_project_file.tmp \
-         http://raa.ruby-lang.org/project/$project/ || \
-         (error_msg "Error: unable to fetch project page" && \
-         return 1)
-    sed -e "s:<a href=\"\(.*\)\".*:\1:g" \
-        -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" \
-        $raa_project_file.tmp | \
-        sed -e ":pot /:\s*$/{ N; s/\n//g; t pot}; /:$/{ b pot}" \
-        -e "/^$/d" > $raa_project_file
-    if $(head -n3 $raa_project_file | grep -q "RAA - Search") ; then
-      error_msg "Error: project not found"
-      return 1
-    fi
-  fi
-  SPELL_SHORT_DESCRIPTION="$(quill_raa_get_info "Short description" "$raa_project_file" )"
-  SPELL_LICENSE="$(quill_raa_get_info "License" "$raa_project_file" )"
-  SPELL_URL="$(quill_raa_get_info "Homepage" "$raa_project_file")"
-  SPELL_SRC_URL="$(quill_raa_get_info "Download" "$raa_project_file")"
-  SPELL_NAME="$project"
-  sed -n '/Description:/,/Edit this project/ p' \
-      $raa_project_file > ${QUILL_TMP_DIR}/${SPELL_NAME}
-  sed -i \
-      -e '1s/.*Description: *\(.*\)/\1/' \
-      -e "/.*Edit this project.*/d" \
-      ${QUILL_TMP_DIR}/${SPELL_NAME}
-  DEPENDSISON="DEPENDS, "
-  SPELL_DEPENDENCIES="ruby"
-
-}
diff --git a/var/lib/quill/modules/libsavane b/var/lib/quill/modules/libsavane
deleted file mode 100644
index d6c7bb7..0000000
--- a/var/lib/quill/modules/libsavane
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-## Generic savane module
-#
-
-##
-## @Globals SPELL_NAME SPELL_LICENSE SPELL_URL
-## @Globals QUILL_TMP_DIR
-function quill_savane_core(){
-  local project
-  local project_url
-  local savane_project_file
-
-  # so it is set even if we end prematurely, useful when adding spells
-  # gets properly overwritten later on
-  SPELL_NAME="$1"
-  project_url="${2:-$1}"
-  project="$SPELL_NAME"
-  if grep -q "^http://.*" <<< $SPELL_NAME; then
-    message "Unknown site, please file a bug for it..."
-    message "Attempting to figure out the project from the url..."
-    project=""
-    project="$(echo "$project_url" | sed -e 's:http.*/\(.*\)$:\1:')"
-    project_url="$(echo $project_url | sed -e 's:\(http.*\)/.*$:\1:')"
-    if [[ $project == "" ]]; then
-      project=$(echo "$project_url" | sed -e 's:http.*/\(.*\)/$:\1:')
-    fi
-    if [[ -n $project ]]; then
-      message "Project $project detected with project_url $project_url..."
-      message "Assuming this is what you want to create a spell for."
-    else
-      error_msg "Error no project detected..."
-      return 1
-    fi
-  fi
-#    error_msg "Unsupported..."
-#    return 1
-#  fi
-  savane_project_file=${QUILL_TMP_DIR}/${project}.savane
-  if [[ ! -e ${savane_project_file} ]]; then
-    message "Attempting to retrieve project page..."
-    wget --no-check-certificate -q -O $savane_project_file \
-         $project_url/$project/ || \
-         (error_msg "Error: unable to fetch project page" && \
-         return 1)
-  fi
-  SPELL_LICENSE="$(cat $savane_project_file | grep "License:" | sed -e "s:.*<a href=\"\(.*\)\".*:\1:g" )"
-  SPELL_URL="$(cat $savane_project_file | grep "alt=\"Homepage\"" | sed -e "s:.*<a href=\"\(.*\)\".*:\1:g")"
-  SPELL_NAME="$project"
-  cat $savane_project_file | \
-  sed -e 's:div class="indexcenter":>INDEX<:' | \
-  sed -e "s:.*<a href=\"\(.*\)\".*:\1:g" \
-      -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" | \
-  sed -n '/INDEX/,/Registration Date:/ p' > \
-      ${QUILL_TMP_DIR}/${SPELL_NAME}
-  sed -i -e '1s/INDEX.*//' \
-         -e '2s/This project is not part of the GNU Project\..*//' \
-         -e '2s/This project is part of the GNU Project\..*//' \
-         -e 's/Registration Date:.*//' \
-         -e '/^$/d' \
-         ${QUILL_TMP_DIR}/${SPELL_NAME}
-
-}
diff --git a/var/lib/quill/modules/libsavannah b/var/lib/quill/modules/libsavannah
deleted file mode 100644
index ed8c31d..0000000
--- a/var/lib/quill/modules/libsavannah
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-## savannah module
-#
-
-function quill_savannah_core(){
-  quill_savane_core "${1}" "http://savannah.nongnu.org/projects"
-}
diff --git a/var/lib/quill/modules/site_handlers/libfreshmeatxml b/var/lib/quill/modules/site_handlers/libfreshmeatxml
new file mode 100644
index 0000000..a217754
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libfreshmeatxml
@@ -0,0 +1,94 @@
+#---
+## @Synopsis libfreshmeatxml
+#---
+
+##
+## @Globals none
+function quill_fmxml_grab_from_xml() {
+  xml_grep --text_only "${1}" "${2}"
+}
+
+##
+## @Globals SPELL_NAME FRESHMEAT_XML_URL FRESHMEAT_PROJECT_URL SPELL_DESC_NAME
+## @Globals FRESHMEAT_PROJECT_FILE FRESHMEAT_FILE QUILL_TMP_DIR SPELL_SRC_URL
+## @Globals SPELL_SRC_URL SPELL_LICENSE SPELL_SHORT_DESCRIPTION
+function quill_fmxml_core() {
+  # so it is set even if we end prematurely, useful when adding spells
+  # gets properly overwritten later on
+  SPELL_NAME="$1"
+
+  # if the argument looks like a url then use that, otherwise
+  # assume the argument is the name of the spell and construct a
+  # url for where we think freshmeat.net stores their xml data
+  if grep -q "http://" <<< "${1}" ; then
+    FRESHMEAT_XML_URL="$1"
+  else
+    FRESHMEAT_XML_URL="http://freshmeat.net/projects-xml/${1}/${1}.xml"
+    FRESHMEAT_PROJECT_URL="http://freshmeat.net/projects/${1}/"
+  fi
+
+  # check if we already have the xml file, if we dont, download it
+  FRESHMEAT_FILE="${QUILL_TMP_DIR}/${1}.xml"
+  FRESHMEAT_PROJECT_FILE="${QUILL_TMP_DIR}/${1}.fm"
+  if [[ ! -e ${FRESHMEAT_PROJECT_FILE} ]]; then
+    message -n "Attempting to retrieve project page ... "
+    wget -q -Uquill -O ${FRESHMEAT_PROJECT_FILE} "${FRESHMEAT_PROJECT_URL}" ||
+      { error_msg "Error: unable to fetch project page" && return 1; }
+    tr "\r" " " < ${FRESHMEAT_PROJECT_FILE} > ${FRESHMEAT_PROJECT_FILE}.tmp
+    mv ${FRESHMEAT_PROJECT_FILE}.tmp ${FRESHMEAT_PROJECT_FILE}
+    message "Done"
+  fi
+
+  if [[ ! -e ${FRESHMEAT_FILE} ]]; then
+    message -n "Attempting to retrieve project XML page ... "
+    wget -q -Uquill -O ${FRESHMEAT_FILE} "${FRESHMEAT_XML_URL}" ||
+      { error_msg "Error: unable to fetch project XML page" && return 1; }
+    message "Done"
+  fi
+
+  # check that the project was found - exsists
+  local not_found='Error: project not found.'
+  if grep -q "$not_found" "$FRESHMEAT_FILE"; then
+    error_msg "$not_found"
+    rm "$FRESHMEAT_FILE"
+    return 1
+  fi
+
+  # fill in variables from xml file
+  SPELL_NAME=$(quill_fmxml_grab_from_xml projectname_short ${FRESHMEAT_FILE} |tr 'A-Z' 'a-z')
+  SPELL_NAME="${SPELL_NAME:-$1}"
+  SPELL_DESC_NAME="${SPELL_NAME}"
+  local tmp_url
+  for each in url_bz2 url_tgz url_zip; do
+    tmp_url="$(quill_fmxml_grab_from_xml $each ${FRESHMEAT_FILE})"
+    if [[ $tmp_url ]] ; then
+      SPELL_SRC_URL="$(grep "$each" ${FRESHMEAT_PROJECT_FILE} | grep -v "\<img\ src\>" | sed -e "s: *<a href.*\">\(.*\)</a><br>:\1:")"
+      break
+    fi
+  done
+  SPELL_URL="$(grep "url_homepage" ${FRESHMEAT_PROJECT_FILE} | grep -v "\<img\ src\>" | sed -e "s: *<a href.*\">\(.*\)</a><br>:\1:")"
+  SPELL_LICENSE="$(quill_fmxml_grab_from_xml license ${FRESHMEAT_FILE})"
+  if grep -q "(.*)" <<< "${SPELL_LICENSE}"; then
+    SPELL_LICENSE="$(awk '{print $NF}' <<< "$SPELL_LICENSE" | tr -d '()')"
+  fi
+  SPELL_SHORT_DESCRIPTION="$(quill_fmxml_grab_from_xml desc_short ${FRESHMEAT_FILE}|sed 's/\r//g')"
+  quill_fmxml_grab_from_xml desc_full ${FRESHMEAT_FILE} |fmt > ${QUILL_TMP_DIR}/${SPELL_NAME}
+}
+#---
+##
+## 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/quill/modules/site_handlers/libfsfdirectory b/var/lib/quill/modules/site_handlers/libfsfdirectory
new file mode 100644
index 0000000..e3b89eb
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libfsfdirectory
@@ -0,0 +1,49 @@
+#
+## FSF/UNESCO directory module
+#
+
+function quill_fsf_get_deps(){
+  local data
+  local file
+  file="${2}"
+  data="${1}"
+  cat $file | \
+  grep "$data" | \
+  sed -e "s:.*<tr><td valign=\"top\">$data</td><td>\(.*\)</td></tr>.*:\1:g" |\
+  sed -e "s:</td></tr>.*::g"
+}
+##
+## @Globals SPELL_NAME SPELL_LICENSE SPELL_URL
+## @Globals QUILL_TMP_DIR
+function quill_fsf_core(){
+  local project
+  local fsf_project_file
+
+  # so it is set even if we end prematurely, useful when adding spells
+  # gets properly overwritten later on
+  SPELL_NAME="$1"
+  project="$2"
+  fsf_project_file=${QUILL_TMP_DIR}/${project}.fsf
+  if [[ ! -e ${fsf_project_file} ]]; then
+    message "Attempting to retrieve project page..."
+    wget -q -O $fsf_project_file \
+         http://directory.fsf.org/$project.html || \
+         (error_msg "Error: unable to fetch project page" && \
+         return 1)
+  fi
+  SPELL_SRC_URL="$(cat $fsf_project_file| grep "Source tarball" | sed -e 's:.*<tr><td valign=\"top\">Source tarball</td><td><a href=[^\"]*\"\([^\"]*\)\"[^\"]*>.*</a></td>.*:\1:g')"
+  SPELL_SHORT_DESCRIPTION="$(cat $fsf_project_file | grep "</p><h3>" | sed -e 's:.*</p><h3>\(.*\)</h3>.*:\1:')"
+  SPELL_DEPENDENCIES="$(quill_fsf_get_deps "Source languages" "$fsf_project_file") $(quill_fsf_get_deps "Build prerequisites" "$fsf_project_file") $(quill_fsf_get_deps "Use requirements" "$fsf_project_file"))"
+  SPELL_OPTIONAL_DEPENDENCIES="$(quill_fsf_get_deps "Weak prerequisites" "$fsf_project_file")"
+  SPELL_LICENSE="$(cat $fsf_project_file| grep "Licensed under" | sed -e 's:.*<tr><td>\(Licensed under .*\)\.</td></tr> *.*:\1:' -e 's:<tr><td>This.*::' -e 's:\.</td></tr>::')"
+  SPELL_URL="$(cat $fsf_project_file| grep "Web page" | sed -e 's:.*<tr><td valign=\"top\">Web page</td><td><a href=[^\"]*\"\([^\"]*\)\"[^\"]*>.*</a></td>.*:\1:g')"
+  cat $fsf_project_file | \
+  sed -e 's:<body bgcolor="white">:>INDEX<:' | \
+  sed -n '/INDEX/,/All_Packages_in_Directory/ p' | \
+  sed -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" | \
+  sed '/Obtaining/d' | \
+  sed '/INDEX/d' | \
+  sed 's:Top &gt;.* &gt;::g' > \
+      ${QUILL_TMP_DIR}/${SPELL_NAME}
+
+}
diff --git a/var/lib/quill/modules/site_handlers/libgna b/var/lib/quill/modules/site_handlers/libgna
new file mode 100644
index 0000000..5805702
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libgna
@@ -0,0 +1,7 @@
+#
+## Gna! module
+#
+
+function quill_gna_core(){
+  quill_savane_core "${1}" "https://gna.org/projects"
+}
diff --git a/var/lib/quill/modules/site_handlers/libhackagedb b/var/lib/quill/modules/site_handlers/libhackagedb
new file mode 100644
index 0000000..39d912d
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libhackagedb
@@ -0,0 +1,104 @@
+#---
+## Haskell HackageDB module
+#---
+
+
+#---
+## @Globals none
+#---
+function quill_hdb_get_files(){
+  local package
+  local package_page
+  local cabal_file
+  local cabal_file_path
+
+  package="$1"
+  package_page="$2"
+  cabal_file="$3"
+
+  if [[ ! -e $package_page ]] ; then
+    message "Attempting to retrieve package page..."
+    wget -q -O $package_page \
+         http://hackage.haskell.org/cgi-bin/hackage-scripts/package/${package}/ || \
+         { error_msg "Error: unable to fetch package page";
+           return 1; }
+  else
+    message "Using cached package page..."
+  fi
+  if [[ ! -e $cabal_file ]] ; then
+    cabal_file_path=$(egrep -o "/packages/archive/${package}/.+/${package}\.cabal" $package_page)
+    message "Attempting to retrieve cabal file..."
+    wget -q -O ${cabal_file}.tmp \
+         http://hackage.haskell.org${cabal_file_path} || \
+         { error_msg "Error: unable to fetch cabal file";
+           return 1; }
+    cat ${cabal_file}.tmp | tr '\t' ' ' > $cabal_file
+    rm ${cabal_file}.tmp
+  else
+    message "Using cached cabal file..."
+  fi
+}
+
+#---
+## @Globals none
+#---
+function quill_hdb_get_info(){
+  local info
+  local package_page
+  local cabal_file
+  local desc_here
+  local possible_line
+
+  info="$1"
+  file="$2"
+
+  if [[ "$info" == "src" ]] ; then
+    echo "http://hackage.haskell.org$(egrep -o "/packages/archive/${package}/.+/${package}-.+\.tar.gz" $file)"
+  elif [[ "$info" == "description" ]] ; then
+    cat $file | while IFS="" ; read line ; do
+      if grep -i -q "^description:" <<< "$line" ; then
+        possible_line=$(sed -e "s/^description: *\(.*\)/\1/" <<< $line)
+        if [[ -n "$possible_line" ]] ; then
+          echo $possible_line
+        fi
+        desc_here=True
+      elif [[ -n "$desc_here" ]] && egrep -q "^[[:alpha:]|-]+:" <<< "$line" ; then
+        break
+      elif [[ -n "$desc_here" ]] ; then
+        echo ${line} | sed -e "s/^ *\.\?//"
+      fi
+    done
+  elif [[ "$info" == "build-depends" ]] ; then
+    grep -i "${info}:" $file | sed -e "s/${info}: *\(.*\)/\1/" | \
+    sed -e "s/\([^><=]\+\)[><=]\+[0-9.]\+/\1/g" | tr -d ',' | \
+    sed -e "s/^base \+\| \+base \+\| \+base$/ /" | \
+    sed -e "s/^unix \+\| \+unix \+\| \+unix$/ /"
+  else
+    grep -i "${info}:" $file | sed -e "s/${info}: *\(.*\)/\1/"
+  fi
+}
+
+#---
+## @Globals SPELL_NAME QUILL_TMP_DIR SPELL_LICENSE
+## @Globals SPELL_SHORT_DESCRIPTION SPELL_DESC_NAME
+## @Globals SPELL_URL SPELL_SRC_URL SPELL_DEPENDENCIES
+#---
+function quill_hdb_core(){
+  local package
+  local package_page
+  local cabal_file
+
+  SPELL_NAME="$1"
+  package="$2"
+
+  package_page=${QUILL_TMP_DIR}/${package}.hdb
+  cabal_file=${QUILL_TMP_DIR}/${package}.cabal
+  quill_hdb_get_files "$package" "$package_page" "$cabal_file" || return 1
+  SPELL_LICENSE="$(quill_hdb_get_info  "license" "$cabal_file")"
+  SPELL_SHORT_DESCRIPTION="$(quill_hdb_get_info  "synopsis" "$cabal_file")"
+  SPELL_DESC_NAME=${SPELL_NAME}.desc
+  quill_hdb_get_info "description" "$cabal_file" > ${QUILL_TMP_DIR}/${SPELL_DESC_NAME}
+  SPELL_URL="$(quill_hdb_get_info  "homepage" "$cabal_file")"
+  SPELL_SRC_URL="$(quill_hdb_get_info "src" "$package_page")"
+  SPELL_DEPENDENCIES="ghc "$(quill_hdb_get_info "build-depends" "$cabal_file")
+}
diff --git a/var/lib/quill/modules/site_handlers/libperlcpan b/var/lib/quill/modules/site_handlers/libperlcpan
new file mode 100644
index 0000000..d473c03
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libperlcpan
@@ -0,0 +1,97 @@
+#---
+## @Synopsis Perl-cpan module to generate spells from perl-cpan metadata
+#---
+
+##
+## @Globals QUILL_TMP_DIR
+function quill_get_manifests()
+{
+  # unless someone knows a better way to check files creation time
+  # this shoud work quite well
+  # basicaly update if the files are over a day old
+  if [[ ! -f $QUILL_TMP_DIR/02packages.details.txt.gz ]] ||
+     [[ ! -f $QUILL_TMP_DIR/03modlist.data.gz ]] ||
+     [[ ! "$(find ${QUILL_TMP_DIR}/02packages.details.txt.gz -ctime 0)" == "${QUILL_TMP_DIR}/02packages.details.txt.gz" ]] ||
+     [[ ! "$(find ${QUILL_TMP_DIR}/03modlist.data.gz -ctime 0)" == "${QUILL_TMP_DIR}/03modlist.data.gz" ]]
+  then
+    cd $QUILL_TMP_DIR
+    message -n "Retrieving 02packages.details.txt.gz ... "
+    wget -q \
+         -O 02packages.details.txt.gz \
+         ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.gz ||
+         (error_msg "Error: unable to fetch 02packages.details.txt.gz" && return 1)
+    message "done."
+
+    message -n "Retrieving 03modlist.data.gz ... "
+    wget -q \
+         -O 03modlist.data.gz \
+         ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz ||
+         (error_msg "Error: unable to fetch 03modlist.data.gz" && return 1)
+    message "done."
+  fi
+}
+
+##
+## @Globals QUILL_CPAN_INFO QUILL_CPAN_METADATA
+function quill_get_cpan_meta(){
+  eval QUILL_CPAN_INFO="( $(zgrep -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz | head -n1) )"
+#  zgrep -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz | head -n1
+  eval QUILL_CPAN_METADATA="( $(zgrep -w -B1 -A9 -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz | tr -d "[]" | sed 's:,$::g' ) )"
+#  zgrep -w -B1 -A9 -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz | tr -d "[]" | sed 's:,$::g'
+}
+
+##
+## @Globals QUILL_TMP_DIR SPELL_NAME SPELL_SRC_URL SPELL_VERSION SPELL_LICENSE
+## @Globals SPELL_SHORT_DESCRIPTION SPELL_URL SPELL_DEPENDENCIES BUILDISON
+## @Globals DEPENDSISON QUILL_CPAN_INFO QUILL_CPAN_METADATA
+function quill_cpan_core()
+{
+  # so it is set even if we end prematurely, useful when adding spells
+  # gets properly overwritten later on
+  SPELL_NAME="$2"
+
+  quill_get_manifests || return 1
+  if zgrep -q -w -E "^$SPELL_NAME" $QUILL_TMP_DIR/02packages.details.txt.gz ||
+     zgrep -q -w -E "^'$SPELL_NAME'" $QUILL_TMP_DIR/03modlist.data.gz
+  then
+    quill_get_cpan_meta $SPELL_NAME
+    SPELL_NAME="$(sed -e 's/::/-/g' <<< "$SPELL_NAME")"
+    SPELL_SRC_URL="http://www.cpan.org/authors/id/${QUILL_CPAN_INFO[2]}"
+    SPELL_VERSION="${QUILL_CPAN_INFO[1]}"
+    SPELL_SHORT_DESCRIPTION="${QUILL_CPAN_METADATA[6]}"
+    SPELL_LICENSE="ART"
+    SPELL_URL="http://search.cpan.org/~${QUILL_CPAN_METADATA[7]}/${SPELL_NAME}/"
+    local description
+    description="${QUILL_CPAN_METADATA[6]}"
+    SPELL_NAME="${1//::/-}" # the lower case target wasn't manipulated yet
+    echo $description > ${QUILL_TMP_DIR}/${SPELL_NAME}
+    BUILDISON="BUILD, "
+    touch ${QUILL_TMP_DIR}/${SPELL_NAME}-BUILD
+    echo "default_build_perl" > ${QUILL_TMP_DIR}/${SPELL_NAME}-BUILD
+    DEPENDSISON="DEPENDS, "
+    SPELL_DEPENDENCIES="perl"
+  else
+    error_msg "Error: unable to find such a CPAN module"
+    return 1
+  fi
+
+}
+
+#---
+##
+## 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/quill/modules/site_handlers/librubyraa b/var/lib/quill/modules/site_handlers/librubyraa
new file mode 100644
index 0000000..f76ee82
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/librubyraa
@@ -0,0 +1,59 @@
+#
+## Ruby RAA module
+#
+
+##
+## @Globals none
+function quill_raa_get_info(){
+  local info
+  local raa_project_file
+  info="${1}"
+  raa_project_file="${2}"
+  grep "${info}:" $raa_project_file | sed -e "s/ *${info}: *\(.*\)/\1/"
+}
+
+##
+## @Globals SPELL_NAME SPELL_SHORT_DESCRIPTION SPELL_LICENSE SPELL_URL
+## @Globals SPELL_SRC_URL SPELL_DEPENDENCIES DEPENDSISON QUILL_TMP_DIR
+function quill_raa_core(){
+  local project
+  local desc
+  local line
+  local raa_project_file
+
+  # so it is set even if we end prematurely, useful when adding spells
+  # gets properly overwritten later on
+  SPELL_NAME="$1"
+  project="$SPELL_NAME"
+  raa_project_file=${QUILL_TMP_DIR}/${project}.raa
+  if [[ ! -e ${raa_project_file} ]]; then
+    message "Attempting to retrieve project page..."
+    wget -q -O $raa_project_file.tmp \
+         http://raa.ruby-lang.org/project/$project/ || \
+         (error_msg "Error: unable to fetch project page" && \
+         return 1)
+    sed -e "s:<a href=\"\(.*\)\".*:\1:g" \
+        -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" \
+        $raa_project_file.tmp | \
+        sed -e ":pot /:\s*$/{ N; s/\n//g; t pot}; /:$/{ b pot}" \
+        -e "/^$/d" > $raa_project_file
+    if $(head -n3 $raa_project_file | grep -q "RAA - Search") ; then
+      error_msg "Error: project not found"
+      return 1
+    fi
+  fi
+  SPELL_SHORT_DESCRIPTION="$(quill_raa_get_info "Short description" "$raa_project_file" )"
+  SPELL_LICENSE="$(quill_raa_get_info "License" "$raa_project_file" )"
+  SPELL_URL="$(quill_raa_get_info "Homepage" "$raa_project_file")"
+  SPELL_SRC_URL="$(quill_raa_get_info "Download" "$raa_project_file")"
+  SPELL_NAME="$project"
+  sed -n '/Description:/,/Edit this project/ p' \
+      $raa_project_file > ${QUILL_TMP_DIR}/${SPELL_NAME}
+  sed -i \
+      -e '1s/.*Description: *\(.*\)/\1/' \
+      -e "/.*Edit this project.*/d" \
+      ${QUILL_TMP_DIR}/${SPELL_NAME}
+  DEPENDSISON="DEPENDS, "
+  SPELL_DEPENDENCIES="ruby"
+
+}
diff --git a/var/lib/quill/modules/site_handlers/libsavane b/var/lib/quill/modules/site_handlers/libsavane
new file mode 100644
index 0000000..d6c7bb7
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libsavane
@@ -0,0 +1,62 @@
+#
+## Generic savane module
+#
+
+##
+## @Globals SPELL_NAME SPELL_LICENSE SPELL_URL
+## @Globals QUILL_TMP_DIR
+function quill_savane_core(){
+  local project
+  local project_url
+  local savane_project_file
+
+  # so it is set even if we end prematurely, useful when adding spells
+  # gets properly overwritten later on
+  SPELL_NAME="$1"
+  project_url="${2:-$1}"
+  project="$SPELL_NAME"
+  if grep -q "^http://.*" <<< $SPELL_NAME; then
+    message "Unknown site, please file a bug for it..."
+    message "Attempting to figure out the project from the url..."
+    project=""
+    project="$(echo "$project_url" | sed -e 's:http.*/\(.*\)$:\1:')"
+    project_url="$(echo $project_url | sed -e 's:\(http.*\)/.*$:\1:')"
+    if [[ $project == "" ]]; then
+      project=$(echo "$project_url" | sed -e 's:http.*/\(.*\)/$:\1:')
+    fi
+    if [[ -n $project ]]; then
+      message "Project $project detected with project_url $project_url..."
+      message "Assuming this is what you want to create a spell for."
+    else
+      error_msg "Error no project detected..."
+      return 1
+    fi
+  fi
+#    error_msg "Unsupported..."
+#    return 1
+#  fi
+  savane_project_file=${QUILL_TMP_DIR}/${project}.savane
+  if [[ ! -e ${savane_project_file} ]]; then
+    message "Attempting to retrieve project page..."
+    wget --no-check-certificate -q -O $savane_project_file \
+         $project_url/$project/ || \
+         (error_msg "Error: unable to fetch project page" && \
+         return 1)
+  fi
+  SPELL_LICENSE="$(cat $savane_project_file | grep "License:" | sed -e "s:.*<a href=\"\(.*\)\".*:\1:g" )"
+  SPELL_URL="$(cat $savane_project_file | grep "alt=\"Homepage\"" | sed -e "s:.*<a href=\"\(.*\)\".*:\1:g")"
+  SPELL_NAME="$project"
+  cat $savane_project_file | \
+  sed -e 's:div class="indexcenter":>INDEX<:' | \
+  sed -e "s:.*<a href=\"\(.*\)\".*:\1:g" \
+      -e ":top;/<.*>/{;s/<[^<>]*>//g;t top;};/</{;N;b top;}" | \
+  sed -n '/INDEX/,/Registration Date:/ p' > \
+      ${QUILL_TMP_DIR}/${SPELL_NAME}
+  sed -i -e '1s/INDEX.*//' \
+         -e '2s/This project is not part of the GNU Project\..*//' \
+         -e '2s/This project is part of the GNU Project\..*//' \
+         -e 's/Registration Date:.*//' \
+         -e '/^$/d' \
+         ${QUILL_TMP_DIR}/${SPELL_NAME}
+
+}
diff --git a/var/lib/quill/modules/site_handlers/libsavannah b/var/lib/quill/modules/site_handlers/libsavannah
new file mode 100644
index 0000000..ed8c31d
--- /dev/null
+++ b/var/lib/quill/modules/site_handlers/libsavannah
@@ -0,0 +1,7 @@
+#
+## savannah module
+#
+
+function quill_savannah_core(){
+  quill_savane_core "${1}" "http://savannah.nongnu.org/projects"
+}
diff --git a/var/lib/quill/version b/var/lib/quill/version
index ddcf548..7d463b5 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.9-rc1
+0.2.9-rc2



More information about the SM-Commit mailing list