[Lunar-commits] r21460 - in moonbase/trunk/devel: cvs/plugin.d git/plugin.d subversion/plugin.d

Auke Kok sofar at lunar-linux.org
Thu Sep 21 03:32:37 UTC 2006


Author: sofar
Date: 2006-09-21 03:32:37 +0000 (Thu, 21 Sep 2006)
New Revision: 21460

Modified:
   moonbase/trunk/devel/cvs/plugin.d/download-cvs.plugin
   moonbase/trunk/devel/git/plugin.d/download-git.plugin
   moonbase/trunk/devel/subversion/plugin.d/download-svn.plugin
Log:
Allow the base of the SOURCE name to be used as base directory name for svn, cvs and git downloads. The SOURCE_DIRECTORY obviously needs to be set correctly if you decide not to use $MODULE-$VERSION as first SOURCE=(+.tar.bz2).


Modified: moonbase/trunk/devel/cvs/plugin.d/download-cvs.plugin
===================================================================
--- moonbase/trunk/devel/cvs/plugin.d/download-cvs.plugin	2006-09-21 01:10:49 UTC (rev 21459)
+++ moonbase/trunk/devel/cvs/plugin.d/download-cvs.plugin	2006-09-21 03:32:37 UTC (rev 21460)
@@ -42,9 +42,10 @@
            "${FILE_COLOR}${CVSMODULE}${DEFAULT_COLOR}${MESSAGE_COLOR}"   \
  	   "for module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
 
+  SBASE=$(source_basename $2)
   mk_source_dir $TMPDIR/$MODULE-$VERSION
   cd $TMPDIR/$MODULE-$VERSION
-  
+
   if [ -f "$3/$2" ] ; then
     verbose_msg "Extracting local CVS copy"
     # unpacking in last component dir of $CVSMODULE
@@ -53,14 +54,14 @@
     mkdir -p $(dirname $CVSMODULE)
     cd $(dirname $CVSMODULE)
     debug_msg "get_cvs: PWD=$PWD tar xjf $2"
-    if ! tar xjf $3/$2 ; then
+    if ! unpack $2 ; then
       message "${PROBLEM_COLOR}Warning: bad local CVS copy, checking out fresh CVS copy${DEFAULT_COLOR}"
-      
+
       rm_source_dir $TMPDIR/$MODULE-$VERSION
       mk_source_dir $TMPDIR/$MODULE-$VERSION
       cd $TMPDIR/$MODULE-$VERSION
     else
-      cd $TMPDIR/$MODULE-$VERSION/$CVSMODULE
+      cd $TMPDIR/$MODULE-$VERSION/$SBASE
     fi
   fi
 
@@ -75,9 +76,9 @@
     if [ -d CVS ] ; then
       verbose_msg "[${TRY}] cvs -qz3 up -PAd $CVSOPTIONS $CVSRELEASE"
       cvs -qz3 up -PAd $CVSOPTIONS $CVSRELEASE && GOT_CVS="yes" 
-    else 
+    else
       verbose_msg "[${TRY}] cvs -d $CVSROOT -qz3 co $CVSOPTIONS $CVSRELEASE $CVSMODULE"
-      cvs -d $CVSROOT -qz3 co $CVSOPTIONS $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
+      cvs -d $CVSROOT -qz3 co -d $SBASE $CVSOPTIONS $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
     fi
 
     if [ "$?" == "0" ] ; then
@@ -86,12 +87,12 @@
 
     sleep 2
   done
-  
+
   if [ "$GOT_CVS" == "yes" ] ; then
     message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$2${DEFAULT_COLOR}"
     # pack in last component dir of $CVSMODULE
-    cd $TMPDIR/$MODULE-$VERSION/$(dirname $CVSMODULE)
-    tar cjf $3/$2 $(basename $CVSMODULE)
+    cd $TMPDIR/$MODULE-$VERSION
+    tar cjf $3/$2 $SBASE/
     cd $CD
   else
     activity_log "lget"  "$MODULE"  "$VERSION"  "failed" "Could not get $CVSMODULE"

Modified: moonbase/trunk/devel/git/plugin.d/download-git.plugin
===================================================================
--- moonbase/trunk/devel/git/plugin.d/download-git.plugin	2006-09-21 01:10:49 UTC (rev 21459)
+++ moonbase/trunk/devel/git/plugin.d/download-git.plugin	2006-09-21 03:32:37 UTC (rev 21460)
@@ -40,6 +40,7 @@
   message  "${MESSAGE_COLOR}Downloading GIT module for" \
  	   "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
 
+  SBASE=$(source_basename $2)
   mk_source_dir $TMPDIR/$MODULE-$VERSION
   cd $TMPDIR/$MODULE-$VERSION
   if [ -f "$3/$2" ] ; then
@@ -47,7 +48,7 @@
     # unpacking
     CD=$(pwd -P)
     cd $CD
-    if ! tar xjf $3/$2 ; then
+    if ! unpack $2 ; then
       message "${PROBLEM_COLOR}Warning: bad local GIT copy, checking out fresh GIT copy${DEFAULT_COLOR}"
       rm_source_dir $TMPDIR/$MODULE-$VERSION
       mk_source_dir $TMPDIR/$MODULE-$VERSION
@@ -60,14 +61,14 @@
   fi
 
   for (( TRY=1 ; $TRY<$NUM_RETRY+1 ; TRY++ )) ; do
-    if [ -d "$MODULE-$VERSION/.git" ] ; then
-      cd $MODULE-$VERSION
+    if [ -d "$SBASE/.git" ] ; then
+      cd $SBASE
       verbose_msg "[${TRY}] git pull"
       git pull && GOT_GIT="yes" 
       cd ${CD}
     else
       verbose_msg "[${TRY}] git clone $GIT_URL"
-      git clone $GIT_URL $MODULE-$VERSION && GOT_GIT="yes"
+      git clone $GIT_URL $SBASE && GOT_GIT="yes"
     fi
 
     if [ "$?" == "0" ] ; then
@@ -80,7 +81,7 @@
   if [ "$GOT_GIT" == "yes" ] ; then
     message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$2${DEFAULT_COLOR}"
     # pack
-    tar cjf $3/$2 $MODULE-$VERSION
+    tar cjf $3/$2 $SBASE
   else
     activity_log "lget" "$MODULE" "$VERSION" "failed" "Could not fetch \"$1\""
   fi

Modified: moonbase/trunk/devel/subversion/plugin.d/download-svn.plugin
===================================================================
--- moonbase/trunk/devel/subversion/plugin.d/download-svn.plugin	2006-09-21 01:10:49 UTC (rev 21459)
+++ moonbase/trunk/devel/subversion/plugin.d/download-svn.plugin	2006-09-21 03:32:37 UTC (rev 21460)
@@ -29,7 +29,6 @@
   fi
 
   SVN_URL=$(echo $1 | cut -d: -f1-2)
-  SVN_DIR=$(echo $1 | cut -d: -f3)
   # translate svn+http(s) urls:
   if [ "${SVN_URL:0:8}" == "svn+http" ]; then
     SVN_URL="${SVN_URL:4}"
@@ -38,16 +37,16 @@
   message  "${MESSAGE_COLOR}Downloading SVN module for" \
  	   "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
 
+  SBASE=$(source_basename $2)
   mk_source_dir $TMPDIR/$MODULE-$VERSION
   cd $TMPDIR/$MODULE-$VERSION
 
   if [ -f "$3/$2" ] ; then
     verbose_msg "Extracting local SVN copy"
-    # unpacking in last component dir of $SVN_DIR
     CD=$(pwd -P)
-    if ! tar xjf $3/$2 ; then
+    if ! unpack $2 ; then
       message "${PROBLEM_COLOR}Warning: bad local SVN copy, checking out fresh SVN copy${DEFAULT_COLOR}"
-      
+
       rm_source_dir $TMPDIR/$MODULE-$VERSION
       mk_source_dir $TMPDIR/$MODULE-$VERSION
     fi
@@ -60,14 +59,14 @@
   fi
 
   for (( TRY=1 ; $TRY<$NUM_RETRY+1 ; TRY++ )) ; do
-    if [ -d "${SVN_DIR}/.svn" ] ; then
-      cd ${SVN_DIR}
+    if [ -d "$SBASE/.svn" ] ; then
+      cd $SBASE
       verbose_msg "[${TRY}] svn up"
       svn up && GOT_SVN="yes" 
       cd ${CD}
     else
-      verbose_msg "[${TRY}] svn co $SVN_URL $SVN_DIR"
-      svn co $SVN_URL $SVN_DIR && GOT_SVN="yes"
+      verbose_msg "[${TRY}] svn co $SVN_URL $SBASE"
+      svn co $SVN_URL $SBASE && GOT_SVN="yes"
     fi
 
     if [ "$?" == "0" ] ; then
@@ -76,11 +75,10 @@
 
     sleep 2
   done
-  
+
   if [ "$GOT_SVN" == "yes" ] ; then
     message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$2${DEFAULT_COLOR}"
-    # pack in last component dir of $SVN_DIR
-    tar cjf $3/$2 $SVN_DIR
+    tar cjf $3/$2 $SBASE
   else
     activity_log "lget" "$MODULE" "$VERSION" "failed" "Could not fetch \"$1\""
   fi



More information about the Lunar-commits mailing list