[SM-Commit] GIT changes to master =?unknown-8bit?Q?qui?= =?unknown-8bit?Q?ll_by_Andra=C5?= =?unknown-8bit?Q?=BE?= Levstik (48d09e6a5aebece23212a22fbda0fbdd68b5fd8b)

=?unknown-8bit?Q?Andra=C5=BE?= Levstik scm at mail.sourcemage.org
Mon Mar 5 17:39:34 EST 2007


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

 var/lib/quill/ChangeLog           |    6 ++++++
 var/lib/quill/modules/libdetails  |   22 ++++++++++++++++++----
 var/lib/quill/modules/libperlcpan |   14 +++++++++-----
 var/lib/quill/version             |    2 +-
 4 files changed, 34 insertions(+), 10 deletions(-)

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

    minor fixes here and there

diff --git a/var/lib/quill/ChangeLog b/var/lib/quill/ChangeLog
index 387dc92..476e1fc 100644
--- a/var/lib/quill/ChangeLog
+++ b/var/lib/quill/ChangeLog
@@ -1,3 +1,9 @@
+2007-03-05 Andraž "ruskie" Levstik <ruskie at mages.ath.cx>
+	* libdetails: minor fixes to the src dir hunt code and
+	  to the sf misc code
+	* libperlcpan: check if the current files are out of date by
+	  more than a day then reload if necessary
+
 2007-03-02 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* quill: simplified the various fetching modules code, now adding a new one
 	    requires only more parameter parsing and quill_help
diff --git a/var/lib/quill/modules/libdetails b/var/lib/quill/modules/libdetails
index 1a8dd78..5d411f5 100644
--- a/var/lib/quill/modules/libdetails
+++ b/var/lib/quill/modules/libdetails
@@ -15,12 +15,26 @@ function query_spell_name(){
 
 function query_spell_source_url(){
   # misc sf fix
-  SPELL_SRC_URL=$(sed "s,http://prdownloads.sourceforge.net,$SOURCEFORGE_URL," <<< $SPELL_SRC_URL)
+  # try to handle as many sf url formats as possible
+  # I tested this with various URLs and it seems to work quite well
+  # if any oter are found should be included
+  # possibly split the code into a separate function???
+  SPELL_SRC_URL=$(sed -e "s,http://prdownloads.sourceforge.net,$SOURCEFORGE_URL," \
+                      -e "s,http://downloads.sourceforge.net/\(.*\)?.*,$SOURCEFORGE_URL/\1," \
+                      -e "s,http://downloads.sourceforge.net/\(.*\),$SOURCEFORGE_URL/\1," \
+                      -e "s,http://sourceforge.net/project/showfiles.php.*,,"
+                      -e "s,/\(.*\)?.*,\1," \
+                      <<< $SPELL_SRC_URL)
 if ! [[ $SPELL_SRC_URL ]] ||
    ! query "Is $SPELL_SRC_URL the proper source url?" y; then
   query_msg "Please enter the url of the source:"
   read "SPELL_SRC_URL"
-  SPELL_SRC_URL=$(sed "s,http://prdownloads.sourceforge.net,$SOURCEFORGE_URL," <<< $SPELL_SRC_URL)
+  SPELL_SRC_URL=$(sed -e "s,http://prdownloads.sourceforge.net,$SOURCEFORGE_URL," \
+                      -e "s,http://downloads.sourceforge.net/\(.*\)?.*,$SOURCEFORGE_URL/\1," \
+                      -e "s,http://downloads.sourceforge.net/\(.*\),$SOURCEFORGE_URL/\1," \
+                      -e "s,http://sourceforge.net/project/showfiles.php.*,,"
+                      -e "s,/\(.*\)?.*,\1," \
+                      <<< $SPELL_SRC_URL)
 fi
 }
 
@@ -167,13 +181,13 @@ function hunt_src_dir(){
   message "Checking for the source directory..."
   compressor=$(guess_compressor ${QUILL_TMP_DIR}/${SPELL_SRC_FILE})
   case "$compresor" in
-     bzip2|gzip|compress*|tar) SPELL_SRC_DIR=$(tar tf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | \
+     bzip2|gzip|compress*|tar) SPELL_SRC_DIR=$(tar vtf "${QUILL_TMP_DIR}/${SPELL_SRC_FILE}" | \
                                                grep / | \
                                                sed -e "s=/.*$==g;q") || \
                                                (error_msg "Error: getting path from tarball" && \
                                                return 1) ;;
                             *) SPELL_SRC_DIR=${SPELL}-${VERSION} &&
-                               message "Unsupported format" &&
+                               message "Unsupported format..." &&
                                return 2 ;;
   esac
   message "Done.\n"
diff --git a/var/lib/quill/modules/libperlcpan b/var/lib/quill/modules/libperlcpan
index 90a0b05..853a2f4 100644
--- a/var/lib/quill/modules/libperlcpan
+++ b/var/lib/quill/modules/libperlcpan
@@ -3,9 +3,13 @@
 #---
 function quill_get_cpan_meta()
 {
-  if [[ $FORCE_CPAN_DOWNLOAD == on ]] ||
-     [ ! -f $QUILL_TMP_DIR/02packages.details.txt.gz ] ||
-     [ ! -f $QUILL_TMP_DIR/03modlist.data.gz ]
+  # 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 [[ ! "$(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" ]] ||
+     [[ ! -f $QUILL_TMP_DIR/02packages.details.txt.gz ]] ||
+     [[ ! -f $QUILL_TMP_DIR/03modlist.data.gz ]]
   then
     cd $QUILL_TMP_DIR
     message "Attempting to retrive 02packages.details.txt.gz..."
@@ -30,8 +34,8 @@ function quill_cpan_core()
   SPELL_NAME="$1"
 
   quill_get_cpan_meta $1
-  if zgrep -q -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz ||
-     zgrep -q -w -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz
+  if ! zgrep -q -w -E "^${1}" $QUILL_TMP_DIR/02packages.details.txt.gz ||
+     ! zgrep -q -w -E "^'${1}'" $QUILL_TMP_DIR/03modlist.data.gz
   then
     SPELL_NAME="$(echo ${1} | sed -e 's/::/-/g')"
     SPELL_SRC_URL="http://www.cpan.org/authors/id/${QUILL_CPAN_INFO[2]}"
diff --git a/var/lib/quill/version b/var/lib/quill/version
index 7179039..5d87b90 100644
--- a/var/lib/quill/version
+++ b/var/lib/quill/version
@@ -1 +1 @@
-0.2.3
+0.2.3-2007-03-05



More information about the SM-Commit mailing list