diff options
author | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2009-01-15 15:23:23 +0000 |
---|---|---|
committer | rhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58> | 2009-01-15 15:23:23 +0000 |
commit | 7a9a77f408711dbc28b3c9120fde47d7fdd694d3 (patch) | |
tree | 5a787edc6ea9ac455b3cce49985497e6b965c368 | |
parent | 74912bb1eb1076a1b6a6ffac18886f51f0a2885a (diff) | |
download | simplepkg-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
-rw-r--r-- | trunk/lib/common.sh | 103 | ||||
-rwxr-xr-x | trunk/src/mkbuild | 21 |
2 files changed, 110 insertions, 14 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 diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index d705929..fdee5ed 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -643,25 +643,22 @@ function submit_mkbuild { local candidate oldplace - # check mkbuild directory + # Check mkbuild directory [ ! -d $MKBUILDS_DIR ] && build_repo $MKBUILDS_DIR $MKBUILDS_SVN # Get mkbuild path in parameter file MKBUILD_PATH=$SLACKBUILD_PATH - # change to mkbuilds directory + # Change to mkbuilds directory cd $MKBUILDS_DIR/ - # Add mkbuild scripts - # check path + # Check path [ ! -e $MKBUILD_PATH ] && svn_mkdir $MKBUILD_PATH - # add mkbuild - svn_copy $WORK/`basename $MKBUILD_NAME` $MKBUILD_PATH - - for i in `ls $WORK | grep -E -v '(SlackBuild|old|slack-required|.mkbuild$|.tmp$)\*{0,1}$'`; do + # Add relevant files + for i in `ls $WORK | grep -E -v '(SlackBuild|old|slack-required|.tmp$)\*{0,1}$'`; do if [ "`basename $i`" != "$DIST_SRC_NAME" ]; then - if ! is_the_same $(dirname $MKBUILD_PATH) $WORK; then + if ! is_the_same $MKBUILD_PATH $WORK; then svn_copy $WORK/$i $MKBUILD_PATH else svn_add $WORK/$i @@ -669,7 +666,7 @@ function submit_mkbuild { fi done - # remove stuff in old places + # Remove stuff in old places for candidate in $(find . -name $(basename $MKBUILD_NAME)); do oldplace="`dirname $candidate | sed -e 's/^\.\///'`" if [ "$oldplace" != "$MKBUILD_PATH" ]; then @@ -685,8 +682,8 @@ function submit_mkbuild { function submit_cleanup { - # remove files that should not be stored at the mkbuilds repository - if ! is_the_same $(dirname $MKBUILD_PATH) $WORK; then + # Remove files that should not be stored at the mkbuilds repository + if is_the_same $MKBUILD_PATH $WORK; then ( cd $WORK rm -f *.old *.tmp *.SlackBuild slack-required $DIST_SRC_NAME |