aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-28 02:27:47 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2009-01-28 02:27:47 +0000
commitd5dbc2e8edc33dff24d71fe646ea3f35a1c95b56 (patch)
tree2a9412642619080d79f56489aba857e78d23b160
parent0bdd70fc94ca425d86fb4878253c69e9b5958e3a (diff)
downloadsimplepkg-d5dbc2e8edc33dff24d71fe646ea3f35a1c95b56.tar.gz
simplepkg-d5dbc2e8edc33dff24d71fe646ea3f35a1c95b56.tar.bz2
attempting to fix #70
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@781 04377dda-e619-0410-9926-eae83683ac58
-rwxr-xr-xtrunk/src/mkbuild171
1 files changed, 103 insertions, 68 deletions
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index 03aa080..353d437 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -164,68 +164,65 @@ function set_parameters {
'-cs'|'--commit-slackbuild')
# Commit SlackBuild file
ACTION="commit_slackbuild"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise commit log message is evalued
;;
'-cm'|'--commit-mkbuild')
# commit mkbuild file
ACTION="commit_mkbuild"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise commit log message is evalued
;;
'-ca'|'--commit-all')
# Commit SlackBuild and mkbuild file
ACTION="commit_all"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise commit log message is evalued
;;
'-is'|'--import-slackbuilds')
# Import SlackBuilds
ACTION="import_slackbuilds"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise specific arguments are evalued
;;
'-im'|'--import-mkbuilds')
# Import mkbuilds
ACTION="import_mkbuilds"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise specific arguments are evalued
;;
'-ia'|'-i'|'--import-all'|'--import')
# Import SlackBuilds and mkbuilds
ACTION="import_all"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise specific arguments are evalued
;;
'--status')
# Repository status
ACTION="status"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
break # we need to break otherwise specific arguments are evalued
;;
'-um'|'--update-manifest')
ACTION="update_manifest"
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ set_mkbuild_name $2
SOURCE_FILE="$3"
shift 2
;;
'-n'|'--new')
# New mkbuild configure file
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
- [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--new <mkbuild_name>"
+ set_mkbuild_name $2
ACTION="new"
shift
;;
'-s'|'--search')
# Search for a mkbuild file
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
- [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--search <mkbuild_name>"
+ set_mkbuild_name $2
ACTION='search'
;;
'-e'|'--edit')
# Open mkbuild with $EDITOR
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
- [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--edit <mkbuild_name>"
+ set_mkbuild_name $2
ACTION='edit'
;;
'-d'|'--debug')
@@ -326,7 +323,7 @@ function set_parameters {
;;
*)
# mkbuild input file
- MKBUILD_NAME="${1//.mkbuild}.mkbuild"
+ set_mkbuild_name $1
;;
esac
shift
@@ -355,6 +352,7 @@ function set_parameters {
fi
+ MKBUILD_NAME="${MKBUILD_NAME//.mkbuild}.mkbuild"
MKBUILD_BASENAME="`basename $MKBUILD_NAME .mkbuild`"
}
@@ -1491,6 +1489,11 @@ function create_mkbuild {
# Change Package Name
edit_file "PKG NAME" "${MKBUILD_NAME//.mkbuild}" $MKBUILD_NAME
+ # Change SlackBuild Path
+ if [ ! -z "$MKBUILD_PATH" ]; then
+ edit_file_full "\[\[SLACKBUILD PATH\]\]=.*" "\[\[SLACKBUILD PATH\]\]=\"`regexp_slash $MKBUILD_PATH`\"" $MKBUILD_NAME
+ fi
+
# Print .mkbuild name
echo "$MKBUILD_NAME"
@@ -1506,15 +1509,49 @@ function search_mkbuild {
return
fi
- if [ "$1" == "-i" ]; then
- # case insensitive mode
- find $MKBUILDS_DIR -iname $MKBUILD_NAME
+ if [ ! -z "$MKBUILD_PATH" ]; then
+ if echo $name | grep -q -e "\.mkbuild$"; then
+ if [ -d "$MKBUILDS_DIR/$MKBUILD_PATH" ]; then
+ find $MKBUILDS_DIR/$MKBUILD_PATH -name $MKBUILD_NAME
+ else
+ find $MKBUILDS_DIR -name $MKBUILD_NAME
+ fi
+ else
+ if [ -d "$MKBUILDS_DIR/$MKBUILD_PATH" ]; then
+ find $MKBUILDS_DIR/$MKBUILD_PATH -name '*.mkbuild'
+ fi
+ fi
else
- find $MKBUILDS_DIR -name $MKBUILD_NAME
+ if [ "$1" == "-i" ]; then
+ # case insensitive mode
+ find $MKBUILDS_DIR -iname $MKBUILD_NAME
+ else
+ find $MKBUILDS_DIR -name $MKBUILD_NAME
+ fi
fi
}
+function set_mkbuild_name {
+
+ local name="$1"
+
+ MKBUILD_PATH=""
+ MKBUILD_NAME="`basename $name`"
+
+ if echo $name | grep -q "/"; then
+ if echo $name | grep -q -e "\.mkbuild$"; then
+ MKBUILD_NAME="`basename $name`"
+ MKBUILD_PATH="`dirname $name`"
+ else
+ MKBUILD_PATH="$name"
+ fi
+ else
+ MKBUILD_NAME="${name//.mkbuild}.mkbuild"
+ fi
+
+}
+
function list_mkbuilds {
# list all available mkbuilds
@@ -1660,55 +1697,53 @@ error_codes
set_parameters "$@"
verbose -e "$BASENAME version $PROG_VERSION\n"
-if [ ! -z "$MKBUILD_NAME" ]; then
- case $ACTION in
- 'update_manifest')
- shift
- update_manifest $*
- ;;
- 'commit_slackbuild')
- shift 2
- commit_changes $SLACKBUILDS_DIR $MKBUILD_BASENAME: $*
- ;;
- 'commit_mkbuild')
- shift 2
- commit_changes $MKBUILDS_DIR $MKBUILD_BASENAME: $*
- ;;
- 'commit_all')
- shift 2
- commit_changes $SLACKBUILDS_DIR $MKBUILD_BASENAME: $*
- commit_changes $MKBUILDS_DIR $MKBUILD_BASENAME: $*
- ;;
- 'import_slackbuilds')
- shift
- import_slackbuilds $*
- ;;
- 'import_mkbuilds')
- shift
- import_mkbuilds $*
- ;;
- 'import_all')
- shift
- import_mkbuilds $*
- import_slackbuilds $*
- ;;
- 'new')
- create_mkbuild
- ;;
- 'build')
- make_slackbuild
- ;;
- 'search')
- search_mkbuild -i
- ;;
- 'status')
- repository_status
- ;;
- 'edit')
- edit_mkbuild
- ;;
- esac
-fi
+case $ACTION in
+ 'update_manifest')
+ shift
+ update_manifest $*
+ ;;
+ 'commit_slackbuild')
+ shift 2
+ commit_changes $SLACKBUILDS_DIR $MKBUILD_BASENAME: $*
+ ;;
+ 'commit_mkbuild')
+ shift 2
+ commit_changes $MKBUILDS_DIR $MKBUILD_BASENAME: $*
+ ;;
+ 'commit_all')
+ shift 2
+ commit_changes $SLACKBUILDS_DIR $MKBUILD_BASENAME: $*
+ commit_changes $MKBUILDS_DIR $MKBUILD_BASENAME: $*
+ ;;
+ 'import_slackbuilds')
+ shift
+ import_slackbuilds $*
+ ;;
+ 'import_mkbuilds')
+ shift
+ import_mkbuilds $*
+ ;;
+ 'import_all')
+ shift
+ import_mkbuilds $*
+ import_slackbuilds $*
+ ;;
+ 'new')
+ create_mkbuild
+ ;;
+ 'build')
+ make_slackbuild
+ ;;
+ 'search')
+ search_mkbuild -i
+ ;;
+ 'status')
+ repository_status
+ ;;
+ 'edit')
+ edit_mkbuild
+ ;;
+esac
# Clear temporary files
verbose -e "\nRemove temporary files ..."