]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
templatepkg now can automatically creates the svn repository
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 17 Jan 2009 19:47:59 +0000 (19:47 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Sat, 17 Jan 2009 19:47:59 +0000 (19:47 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@754 04377dda-e619-0410-9926-eae83683ac58

trunk/lib/common.sh
trunk/src/createpkg
trunk/src/mkbuild
trunk/src/templatepkg

index a7fa50c21fa290fcd057f20a62b10151494b016f..22ac92408903f6c3fae6e07bb58b791ae826f43b 100644 (file)
@@ -925,6 +925,30 @@ function check_svn_repo {
 
 }
 
+function check_and_create_svn_repo {
+
+  # check and create svn repository
+  # usage: check_and_create_svn_repo <repository>
+
+  local repository repository_type repository_path
+
+  repository_type="`echo $repository | cut -d : -f 1`"
+  repository_path="`echo $repository | cut -d : -f 2`"
+
+  if [ "$repository_type" == "file" ] && [ ! -d "$repository_path" ]; then
+    echo "Creating subversion repository $repository..."
+    mkdir -p `dirname $repository_path`
+    svnadmin create $repository_path --fs-type fsfs
+    if [ "$?" != "0" ]; then
+      EXIT_CODE="1"
+      return $EXIT_CODE
+    else
+      return 0
+    fi
+  fi
+
+}
+
 # -----------------------------------------------
 #           update jail functions
 # -----------------------------------------------
@@ -1634,6 +1658,55 @@ function absolute_folder {
 
 }
 
+function list_builds {
+
+  # list all available builds
+  # usage: list_builds <folder> <file_type>
+
+  local folder="$1" file_type="$2"
+  local i j k
+
+  if [ ! -d "$folder" ] || [ -z "$file_type" ]; then
+    return
+  fi
+
+  cd $folder
+  echo "Sarava $file_type list"
+  # level 1
+  for i in *; do
+    if [ -d $i ]; then
+      echo -e "  $i: "
+      (
+        cd $i
+        # level 2
+        for j in *; do
+          if [ -d $j ]; then
+            eecho $commun "    $j"
+            (
+              cd $j
+              BUILD="`ls *.$file_type 2>/dev/null`"
+              if [ "$BUILD" != "" ]; then
+                # level 3
+                for k in $BUILD; do
+                  eecho $messag "      $k"
+                done
+              else
+                BUILD=""
+              fi
+              for k in *; do
+                if [ -d $k ]; then
+                  eecho $messag "      $k.$file_type"
+                fi
+              done
+            )
+          fi
+        done
+      )
+    fi
+  done
+
+}
+
 function check_installed {
 
   # checks if a package is installed 
index c2d3c3243e53e76fd7ab592d74303075c81be927..a02c8c8c946eadc54f56ec39b65da69ebd3dbd33 100644 (file)
@@ -211,43 +211,12 @@ function info_builds {
 
 }
 
-function list_builds {
+function list_slackbuilds {
 
-  # List all available SlackBuilds
-  cd $SLACKBUILDS_DIR
-  echo "Sarava SlackBuilds list"
-  # level 1
-  for i in *; do
-    if [ -d $i ]; then
-      echo -e "  $i: "
-      (
-        cd $i
-        # level 2
-        for j in *; do
-          if [ -d $j ]; then
-            eecho $commun "    $j"
-            (
-              cd $j
-              BUILD="`ls *.SlackBuild 2>/dev/null`"
-              if [ "$BUILD" != "" ]; then
-                # level 3
-                for k in $BUILD; do
-                  eecho $messag "      $k"
-                done
-              else
-                BUILD=""
-              fi
-              for k in *; do
-                if [ -d $k ]; then
-                  eecho $messag "      $k.SlackBuild"
-                fi
-              done
-            )
-          fi
-        done
-      )
-    fi
-  done
+  # list all available slackbuilds
+  # usage: list_slackbuilds
+
+  list_builds $SLACKBUILDS_DIR SlackBuild
 
 }
 
@@ -379,7 +348,6 @@ function repository_import {
     repository="file://$repository"
   fi
 
-  repository_type="`echo $repository | cut -d : -f 1`"
   repository_path="`echo $repository | cut -d : -f 2`"
 
   # eval again so it doesn't include repository style information
@@ -392,17 +360,14 @@ function repository_import {
     return $EXIT_CODE
   fi
 
-  if [ "$repository_type" == "file" ] && [ ! -d "$repository_path" ]; then
-    echo "Creating subversion repository $repository..."
-    mkdir -p `dirname $repository_path`
-    svnadmin create $repository_path --fs-type fsfs
-    chown_svn $repository_path && chgrp_svn $repository_path
-    if [ "$?" != "0" ]; then
-      EXIT_CODE="1"
-      return $EXIT_CODE
-    fi
+  check_and_create_svn_repo $repository
+  if [ "$?" != "0" ]; then
+    EXIT_CODE="1"
+    return $EXIT_CODE
   fi
 
+  chown_svn $repository_path && chgrp_svn $repository_path
+
   echo "Importing packages from $packages_dir into $repository..."
   su_svn import $packages_dir $repository -m "importing binary packages"
   if [ "$?" == "0" ]; then
@@ -612,7 +577,7 @@ case $1 in
   ;;
   '--search'|'-s')
     if [ $# -ne 2 ]; then
-      list_builds
+      list_slackbuilds
     else
       LIST=`find_slackbuild $2`
       for i in $LIST; do
@@ -651,7 +616,7 @@ case $1 in
     exit $EXIT_CODE
   ;;
   '--list'|'-l')
-    list_builds
+    list_slackbuilds
     exit $EXIT_CODE
   ;;
   '--update')
index 63ab779980367b02e603f9852d0049925722a593..c34803893294cfb9702baa903eb06e50a398d24b 100755 (executable)
@@ -1372,41 +1372,10 @@ function search_mkbuild {
 
 function list_mkbuilds {
 
-  # List all available mkbuilds
-  cd $MKBUILDS_DIR
-  echo "Sarava mkbuilds list"
-  # level 1
-  for i in *; do
-    if [ -d $i ]; then
-      echo -e "  $i: "
-      (
-        cd $i
-        # level 2
-        for j in *; do
-          if [ -d $j ]; then
-            eecho $commun "    $j"
-            (
-              cd $j
-              BUILD="`ls *.mkbuild 2>/dev/null`"
-              if [ "$BUILD" != "" ]; then
-                # level 3
-                for k in $BUILD; do
-                  eecho $messag "      $k"
-                done
-              else
-                BUILD=""
-              fi
-              for k in *; do
-                if [ -d $k ]; then
-                  eecho $messag "      $k.mkbuild"
-                fi
-              done
-            )
-          fi
-        done
-      )
-    fi
-  done
+  # list all available mkbuilds
+  # usage: list_mkbuilds
+
+  list_builds $MKBUILDS_DIR mkbuild
 
 }
 
index 8d98950a81a8a2d59d3dbf9ff208faf8c076d2ff..0eee07575b8c2ec6a4758384ad1f1729bb7e24a4 100755 (executable)
@@ -153,6 +153,7 @@ function import_export_templates {
   # usage: template_export <import|export> <repository>
 
   local templates templates_folder basedir repository mode preposition
+  local repository_type repository_path
 
   if [ "$?" != 0 ]; then
     usage
@@ -179,6 +180,7 @@ function import_export_templates {
 
       if [ "$mode" == "export" ]; then
         preposition="to"
+        check_and_create_svn_repo $repository
         echo Exporting templates to $repository...
         svn import $templates/ $repository/ -m "initial import"
         if [ "$?" != "0" ]; then