From 94ccc9486807daf234905205e9733c3a5b82f972 Mon Sep 17 00:00:00 2001 From: rhatto Date: Sun, 4 Jan 2009 16:54:06 +0000 Subject: attempting to solve #67 git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@731 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/mkbuild | 53 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 36 insertions(+), 17 deletions(-) diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index 65c4c5b..494d012 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -130,6 +130,8 @@ function set_parameters { # Parameter evaluation ACTION="build" + local search match + while [ "$1" ]; do case $1 in '-bn'|'--build-number') @@ -297,7 +299,23 @@ function set_parameters { shift done - [ ! -e "$MKBUILD_NAME" -a "$ACTION" == "build" ] && ACTION='new' + if [ ! -e "$MKBUILD_NAME" ] && [ "$ACTION" != "search" ]; then + + search="`search_mkbuild`" + + if [ ! -z "$search" ]; then + for match in $search; do + MKBUILD_NAME="$match" + WORK="`dirname $match`" + break + done + else + if [ "$ACTION" == "build" ]; then + ACTION='new' + fi + fi + + fi MKBUILD_BASENAME="`basename $MKBUILD_NAME .mkbuild`" @@ -639,7 +657,7 @@ function submit_mkbuild { [ ! -e $MKBUILD_PATH ] && svn_mkdir $MKBUILD_PATH # add mkbuild - svn_copy $WORK/$MKBUILD_NAME $MKBUILD_PATH + 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 if [ "`basename $i`" != "$DIST_SRC_NAME" ]; then @@ -854,10 +872,10 @@ function edit_manifest { echo "Updating Manifest..." # Update mkbuild metainformation - update_manifest_info $WORK/$MKBUILD_NAME + update_manifest_info $WORK/`basename $MKBUILD_NAME` # Update SlackBuild information - update_manifest_info $WORK/$SLACKBUILD + update_manifest_info $WORK/`basename $SLACKBUILD` # Update slack-required information if [ -e "$WORK/slack-required" ]; then @@ -1336,9 +1354,14 @@ function create_mkbuild { function search_mkbuild { # find a given mkbuild - # usage: search_mkbuild + # usage: search_mkbuild [-i] - find $MKBUILDS_DIR -iname $MKBUILD_NAME + if [ "$1" == "-i" ]; then + # case insensitive mode + find $MKBUILDS_DIR -iname $MKBUILD_NAME + else + find $MKBUILDS_DIR -name $MKBUILD_NAME + fi } @@ -1347,17 +1370,13 @@ function edit_mkbuild { # edit a mkbuild # usage: edit_mkbuild - local match search="`search_mkbuild`" + local match - if [ ! -z "$search" ]; then - for match in $search; do - # Edit the first matching mkbuild - if [ -z "$EDITOR" ]; then - EDITOR="vi" - fi - $EDITOR $match - break - done + if [ -e "$MKBUILD_NAME" ]; then + if [ -z "$EDITOR" ]; then + EDITOR="vi" + fi + $EDITOR $MKBUILD_NAME else echo "Not found: $MKBUILD_NAME" return 1 @@ -1444,7 +1463,7 @@ if [ ! -z "$MKBUILD_NAME" ]; then make_slackbuild ;; 'search') - search_mkbuild + search_mkbuild -i ;; 'edit') edit_mkbuild -- cgit v1.2.3