aboutsummaryrefslogtreecommitdiff
path: root/trunk/lib
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-15 15:23:23 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-15 15:23:23 +0000
commit7a9a77f408711dbc28b3c9120fde47d7fdd694d3 (patch)
tree5a787edc6ea9ac455b3cce49985497e6b965c368 /trunk/lib
parent74912bb1eb1076a1b6a6ffac18886f51f0a2885a (diff)
downloadsimplepkg-7a9a77f408711dbc28b3c9120fde47d7fdd694d3.tar.gz
simplepkg-7a9a77f408711dbc28b3c9120fde47d7fdd694d3.tar.bz2
attemting to fix 64
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@743 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/lib')
-rw-r--r--trunk/lib/common.sh103
1 files changed, 101 insertions, 2 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index 9589568..5d125b7 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -664,10 +664,56 @@ function sync_repo {
function svn_add {
- if [ -e "$1" ] && [ -d "`dirname $1`/.svn" ] && ! svn_check $1; then
- su_svn add $1
+ local file="$1" folder folders dir_list cwd
+ local subfolder subfolders
+
+ if [ -e "$file" ] && ! svn_check $file; then
+
+ folder="`absolute_folder $file`"
+ cwd="`pwd`"
+
+ if [ -d "$folder/.svn" ]; then
+ cd $folder
+ su_svn add `basename $file`
+ else
+
+ # reverse folder order
+ dir_list="`echo $folder | tr '/' ' '`"
+ for i in $dir_list; do
+ folders="$i $folders"
+ done
+
+ cd $folder
+
+ for i in $folders; do
+ cd ..
+ if [ -d ".svn" ]; then
+ # add the parent folder
+ su_svn add --depth=empty $i
+
+ # add all subfolders
+ cd $i
+ subfolders="$(echo $folder | sed -e "s/^$(regexp_slash $(pwd))//")"
+ for subfolder in `echo $subfolders | tr '/' ' '`; do
+ if ! svn_check $subfolder; then
+ su_svn add --depth=empty $subfolder
+ cd $subfolder
+ fi
+ done
+
+ # add the file
+ cd $folder
+ su_svn add `basename $file`
+
+ break
+ fi
+ done
+
+ fi
fi
+ cd $cwd
+
}
function svn_del {
@@ -741,6 +787,43 @@ function svn_mkdir {
}
+function is_inside_svn_repo {
+
+ # check if a file is inside a svn repository
+ # usage: is_inside_svn_repo <file>
+
+ local file="$1" folder folders dir_list cwd
+
+ if [ -e "$file" ]; then
+ folder="`absolute_folder $file`"
+ fi
+
+ if [ -d "$folder/.svn" ]; then
+ return true
+ fi
+
+ # reverse folder order
+ dir_list="`echo $folder | tr '/' ' '`"
+ for i in $dir_list; do
+ folders="$i $folders"
+ done
+
+ cwd="`pwd`"
+ cd $folder
+
+ for i in $folders; do
+ cd ..
+ if [ -d ".svn" ]; then
+ cd $cwd
+ return true
+ fi
+ done
+
+ cd $cwd
+ return false
+
+}
+
function su_svn {
# execute svn using a different user
@@ -1532,6 +1615,22 @@ function file_extension {
}
+function absolute_folder {
+
+ # get the absolute folder from a file
+ # usage: absolute_folder <file>
+
+ local file="$1" cwd
+
+ if [ -e "$file" ]; then
+ cwd="`pwd`"
+ cd `dirname $file`
+ pwd
+ cd $cwd
+ fi
+
+}
+
function check_installed {
# checks if a package is installed