[SM-Commit] GIT changes to master quill by Andraž Levstik (33761ac354dddecbb45ce903133ad402fb22edde)

Andraž Levstik scm at sourcemage.org
Sat Aug 11 15:04:57 EDT 2007


GIT changes to master quill by Andraž Levstik <ruskie at mages.ath.cx>:

 usr/bin/quill                     |   31 ++++++++++++++++---
 var/lib/quill/ChangeLog           |    4 ++
 var/lib/quill/modules/libgna      |    7 ++++
 var/lib/quill/modules/libsavane   |   62 ++++++++++++++++++++++++++++++++++++++
 var/lib/quill/modules/libsavannah |    7 ++++
 var/lib/quill/version             |    2 -
 6 files changed, 108 insertions(+), 5 deletions(-)

New commits:
commit 33761ac354dddecbb45ce903133ad402fb22edde
Author: Andraž Levstik <ruskie at mages.ath.cx>
Commit: Andraž Levstik <ruskie at mages.ath.cx>

    added generic savane and gna and savannah support, atm untested

diff --git a/usr/bin/quill b/usr/bin/quill
index 5469140..dfaf73d 100755
--- a/usr/bin/quill
+++ b/usr/bin/quill
@@ -55,9 +55,17 @@ while [[ -n $1 ]]; do
                   check_parameter $2
                   QUILL_FETCH_MODE="cpan"
                   shift ;;
-    --rubyraa|-y)
+     --savane|-s)
                   check_parameter $2
-                  QUILL_FETCH_MODE="raa"
+                  QUILL_FETCH_MODE="savane"
+                  shift ;;
+   --savannah|-a)
+                  check_parameter $2
+                  QUILL_FETCH_MODE="savannah"
+                  shift ;;
+        --gna|-g)
+                  check_parameter $2
+                  QUILL_FETCH_MODE="gna"
                   shift ;;
      --update|-u)
                   check_parameter $2
@@ -68,6 +76,21 @@ while [[ -n $1 ]]; do
                   QUILL_UPDATE="on"
                   QUILL_FETCH_MODE="fmxml"
                   shift ;;
+         -us|-su)
+                  check_parameter $2
+                  QUILL_UPDATE="on"
+                  QUILL_FETCH_MODE="savane"
+                  shift ;;
+         -ug|-gu)
+                  check_parameter $2
+                  QUILL_UPDATE="on"
+                  QUILL_FETCH_MODE="gna"
+                  shift ;;
+         -ua|-au)
+                  check_parameter $2
+                  QUILL_UPDATE="on"
+                  QUILL_FETCH_MODE="savannah"
+                  shift ;;
          -uc|-cu)
                   check_parameter $2
                   QUILL_UPDATE="on"
@@ -136,7 +159,7 @@ unset -f url_ftp_verify &&
 function url_ftp_verify() {
   local  URL=$1
 
-  if  [  -n  "$URL"  ];  then
+  if  [[  -n  "$URL"  ]];  then
     local  FILENAME=`basename $URL`
     local  DIRECTORY=`dirname $URL`
     local  OUTPUT=`wget --passive-ftp -t 1 -T 30 -O - --spider -S "$DIRECTORY/" 2>&1`
@@ -145,7 +168,7 @@ function url_ftp_verify() {
       rm  -f  .listing
     else
       echo  $OUTPUT  |  sed  's/LIST.*//g'
-      [  -f  .listing  ]  &&  cat  .listing
+      [[  -f  .listing  ]]  &&  cat  .listing
       rm -f  .listing
       false
     fi
diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index ff58243..316d530 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,5 +1,9 @@
 2007-08-11 Andraž "ruskie" Levstik <ruskie at mages.ath.cx>
 	* librubyraa: added to check if the project page exists yet
+	* libsavane: generic support for any savane compatible site
+	* libgna: specific calls for Gna! site
+	* libsavannah: specific calls for savannah site
+	* quill: added necessary calls
 
 2007-07-12 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* libcore: fixed mirror indexing in check_source_urls messages
diff --git a/var/lib/quill/modules/libgna b/var/lib/quill/modules/libgna
new file mode 100644
index 0000000..5805702
--- /dev/null
+++ b/var/lib/quill/modules/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/libsavane b/var/lib/quill/modules/libsavane
new file mode 100644
index 0000000..a2ec6dc
--- /dev/null
+++ b/var/lib/quill/modules/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
+  else
+    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.tmp \
+         $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
new file mode 100644
index 0000000..ed8c31d
--- /dev/null
+++ b/var/lib/quill/modules/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 09c8683..6e33192 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.8-rc1
+0.2.8-rc2



More information about the SM-Commit mailing list