]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
new function svn_remove_empty_folders
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 28 Nov 2008 03:30:14 +0000 (03:30 +0000)
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>
Fri, 28 Nov 2008 03:30:14 +0000 (03:30 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@582 04377dda-e619-0410-9926-eae83683ac58

trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/src/createpkg

index e77f73de9711c53f8156df9cda02ec17c7e4c8b3..c3a5e3f41b88cc0b41964bbfee5e06dd0f0e15be 100644 (file)
@@ -7,7 +7,8 @@ simplepkg changelog
     - common.sh:
       - other minor changes
       - repository metainformationg is now added at svn control if applicable
-      - new functions su_svn, chown_svn, chgrp_svn, regexp_slash, default_distro and svn_add
+      - new functions svn_remove_empty_folders, svn_del, su_svn, chown_svn, chgrp_svn,
+        regexp_slash, default_distro and svn_add
       - new config parameter "TMP" 
       - renamed function use_svn to templates_under_svn
     - simplaret: simplaret_search_and_process_patch do not donwload a package with the same
index 368cbd1a3078a58e09ce8186e1b1f3297456dbfe..27d329faff9d0f7a6af32730ec4d280b11afc0d1 100644 (file)
@@ -589,7 +589,7 @@ function svn_del {
     chown_svn $file && chgrp_svn $file
     ( cd $folder && su_svn del --force `basename $file` )
   else
-    rm -f $file
+    rm -rf $file
   fi
 
 }
@@ -671,6 +671,26 @@ function chgrp_svn {
 
 }
 
+function svn_remove_empty_folders {
+
+  if [ -z "$1" ]; then
+    return 1
+  fi
+
+  main_folder="$1"
+  search="`find $main_folder -type d | grep -v '/.svn' | sed '1d'`"
+  results="`echo $search | wc -l`"
+
+  if [ "$results" -eq "0" ]; then
+    svn_del $folder
+  else
+    for folder in $search; do
+      svn_remove_empty_folders $folder
+    done
+  fi
+
+}
+
 # -----------------------------------------------
 #           update jail functions
 # -----------------------------------------------
index ce9c3a5cc871ee229283dbfc11f3bad38189e660..bd2a2ea09ff999cdd5370923b06148931ec8dd44 100644 (file)
@@ -578,6 +578,8 @@ if [ $REMOVE_OLD_PACKAGE -eq $on ]; then
       fi
     done
 
+    svn_remove_empty_folders . 
+
     cd $cwd
 
   else