aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--trunk/doc/CHANGELOG15
-rwxr-xr-xtrunk/src/mkbuild481
2 files changed, 258 insertions, 238 deletions
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG
index eeffd06..791634c 100644
--- a/trunk/doc/CHANGELOG
+++ b/trunk/doc/CHANGELOG
@@ -1,12 +1,25 @@
simplepkg changelog
===================
+0.6pre13
+========
+ - mkbuild-1.1.11:
+ - -sp, --slackbuild-path option added
+ - ACTION variable added (values are: new, show-path, and build)
+ - MKBUILD_NAME and MK_INPUT_FILE variables are the same ones
+ - Several 'sed - i' applied
+ - Changed caracter of separation in the command 'sed' for ¦
+ - Reorganized the function get_slackbuild_path
+ - Call for the function start_build moved of position
+
0.6pre12
========
- common.sh: small change
+
- generic.mkSlackBuild / perl.mkSlackBuild: minor fixe
- - mkbuild:
+
+ - mkbuild-1.1.10:
- added inputs --path-files and --nps-strip
- remove old code 'let i++' in set_parameters function
- PATCH FILES parameter default set to ""
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index 9cb9efe..d4286a5 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -19,7 +19,7 @@
# Based in model generic.SlackBuild of Luiz
#
# Version:
-PROG_VERSION=1.1.10
+PROG_VERSION=1.1.11
PROG_NAME=`basename $0`
#--------------------------------------------------------------------
@@ -82,6 +82,8 @@ DESCRIPTION
program version
-V, --verbose
print debug information
+ -sp, --slackbuild-path
+ print SlackBuild path in Slack.Sarava tree
EXAMPLES
mkbuild --prefix /usr/local pyrex.mkbuild
@@ -114,6 +116,8 @@ function set_parameters {
# where $@ are the parameters input
#
# Parameters analyze
+ ACTION="build"
+
while [ "$1" ]; do
case $1 in
'-bn'|'--build-number')
@@ -137,8 +141,9 @@ function set_parameters {
;;
'-n'|'--new')
# New mkbuild configure file
- MKBUILD_NAME=$2
+ MKBUILD_NAME="${2//.mkbuild}.mkbuild"
[ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--new <mkbuild_name>"
+ ACTION="new"
shift
;;
'-d'|'--debug')
@@ -231,49 +236,45 @@ function set_parameters {
[ ${NPS_STRIP:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR NPS_STRIP
shift
;;
+ '-sp'|'--slackbuild-path')
+ # Print SlackBuild path in Slack.Sarava tree
+ ACTION="show-path"
+ ;;
*)
# mkbuild input file
- MK_INPUT_FILE="${1//.mkbuild}.mkbuild"
- [ ! -e $MK_INPUT_FILE ] && handle_error $ERROR_FILE_NOTFOUND $MK_INPUT_FILE
+ MKBUILD_NAME="${1//.mkbuild}.mkbuild"
+ #[ ! -e $MKBUILD_NAME ] && handle_error $ERROR_FILE_NOTFOUND $MKBUILD_NAME
;;
esac
shift
done
+
+ [ ! -e $MKBUILD_NAME ] && ACTION='new'
}
function get_variable {
- # Get variable value from mkbuild file (MK_INPUT_FILE)
+ # Get variable value from mkbuild file (MKBUILD_NAME)
[ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
- [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0
+ [ -z $MKBUILD_NAME ] && echo "Warning: no [mkbuild_file]." && return 0
- grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2- -d= | sed -e 's/^"//' -e 's/"$//'
+ sed -n '1,/^#>>/ p' $MKBUILD_NAME | grep "^\[\[${1}\]\]" | cut -f2- -d= | sed -e 's/^"//' -e 's/"$//'
}
function edit_file {
# Edit file $3, by change string [[$1]] to $2
- local STR_OLD
- local STR_NEW
-
[ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
- STR_OLD=$( echo $1 | sed 's/\//\\\//g' )
- STR_NEW=$( echo $2 | sed 's/\//\\\//g' )
- eval "sed 's/\[\[$STR_OLD\]\]/$STR_NEW/' $3 > $AUX_TMP"
- mv $AUX_TMP $3
+
+ eval "sed -i 's¦\[\[$1\]\]¦$2¦g' $3"
}
function edit_file_full {
# Edit file $3, by change string $1 to $2
- local STR_OLD
- local STR_NEW
-
[ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
- STR_OLD=$( echo $1 | sed 's/\//\\\//g' )
- STR_NEW=$( echo $2 | sed 's/\//\\\//g' )
- eval "sed 's/$STR_OLD/$STR_NEW/' $3 > $AUX_TMP"
- mv $AUX_TMP $3
+
+ eval "sed -i 's¦$1¦$2¦' $3"
}
function start_build {
@@ -343,7 +344,7 @@ function get_status {
function activate_sections {
# Enable and desable sections
- ACTIONS_LIST=`sed '/^#>>/,/<</ ! d; /^#/ d ' $MK_INPUT_FILE | tr -d ' '`
+ ACTIONS_LIST=`sed '/^#>>/,/<</ ! d; /^#/ d ' $MKBUILD_NAME | tr -d ' '`
for i in $ACTIONS_LIST; do
STATUS=`echo $i | cut -f1 -d:`
SECTION=`echo $i | cut -f2 -d:`
@@ -357,21 +358,21 @@ function build_slackbuild {
# Make SlackBuild backup
[ -e $SLACKBUILD ] && mv $SLACKBUILD $SLACKBUILD.old
# Remove off sections
- sed '/^<[a-z].*> off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP > $AUX_TMP
+ sed -i '/^<[a-z].*> off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP
# Remove sections names
- sed '/^<.*$/ d' $AUX_TMP > $SLACKBUILD_TEMP
+ sed -i '/^<.*$/ d' $SLACKBUILD_TEMP
# Remove clear lines
- sed ':i ; $! N; s/\n/<NL>/ ; t i' $SLACKBUILD_TEMP | sed 's/<NL><NL><NL>/<NL><NL>/g' | sed 's/<NL><NL><NL>/<NL><NL>/g' | sed 's/<NL>/\n/g' > $AUX_TMP
+ sed -i ':i ; $! N; s/\n/Ø/ ; t i ; s/Ø\{3,\}/ØØ/g ; s/Ø/\n/g' $SLACKBUILD_TEMP
# Remove from frist line do #!/... line
- sed '1,/^#\!/ {/^#\!/ b; d }' $AUX_TMP > $SLACKBUILD
+ sed '1,/^#\!/ {/^#\!/ b; d }' $SLACKBUILD_TEMP > $SLACKBUILD
}
function section_edit {
# Edits a section substituting its content
- [ -z $MK_INPUT_FILE ] && return 0
+ [ -z $MKBUILD_NAME ] && return 0
- SECTION_LIST=`grep '^#>[a-z]' $MK_INPUT_FILE | cut -c3-`
+ SECTION_LIST=`grep '^#>[a-z]' $MKBUILD_NAME | cut -c3-`
# Check for sections change
[ -z "$SECTION_LIST" ] && return 0
@@ -402,7 +403,7 @@ function slackdesc_edit {
done
echo -en "|\n"
- sed -n '/#>slackdesc/,/#<slackdesc/ { /^#/ b; p }' $MK_INPUT_FILE
+ sed -n '/#>slackdesc/,/#<slackdesc/ { /^#/ b; p }' $MKBUILD_NAME
sed '1, /\[\[SLACK-DESC\]\]/ d' $SLACKBUILD_TEMP
}
@@ -414,7 +415,7 @@ function section_change {
# Copy first half
eval "sed '1,/^<$1>/! d' $SLACKBUILD_TEMP > $AUX_TMP"
# Paste new section
- eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#</ b; p }' $MK_INPUT_FILE >> $AUX_TMP"
+ eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#</ b; p }' $MKBUILD_NAME >> $AUX_TMP"
# Copy second halt
eval "sed '/^<\/$1>/,$ ! d' $SLACKBUILD_TEMP >> $AUX_TMP"
@@ -440,7 +441,7 @@ function make_slack_required {
function change_others_parameters {
# Change others parameters started by '[[' in .mkbuild file
- grep -v '^#' $MK_INPUT_FILE | grep '\[\[[A-Za-z]' | while read i; do
+ grep -v '^#' $MKBUILD_NAME | grep '\[\[[A-Za-z]' | while read i; do
CHANGE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\1/'`"
VALUE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\2/'`"
edit_file "$CHANGE" "$VALUE" $SLACKBUILD
@@ -449,9 +450,33 @@ function change_others_parameters {
function get_slackbuild_path {
- # Search SlackBuild Path in gentoo tree
- eval "lynx -connect_timeout=10 -dump http://gentoo-portage.com/Search?search=$PKG_NAME | tr -d ' ' | grep '^[a-z].*\/$PKG_NAME\$' | head --lines=1"
+ # Search for SlackBuild Path in order:
+ # - command line parameter;
+ # - mkbuild parameters file;
+ # - SlackBuild tree;
+ # - Gentool-portage internet tree;
+ # - default path (others/unclassified/$PKG_NAME).
+
+ # Start AUX_PATH with command line parameter
+ AUX_PATH="$SLACKBUILD_PATH"
+ # Get in mkbuild
+ [ -z $AUX_PATH ] && AUX_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
+
+ # SlackBuild path in SlackBuild tree
+ [ -z $AUX_PATH ] && AUX_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname` 2>/dev/null
+
+ # SlackBuild path in gentoo-portage tree
+ if [ -z $AUX_PATH ]; then
+ AUX_PATH=`eval "lynx -connect_timeout=10 -dump http://gentoo-portage.com/Search?search=$PKG_NAME | tr -d ' ' | grep '^[a-z].*\/$PKG_NAME\$' | head --lines=1"`
+ [ ! -z $AUX_PATH ] && AUX_PATH=`echo $AUX_PATH | sed 's:\-:\/:'`
+ fi
+
+ # SlackBuild path default
+ [ -z $AUX_PATH ] && AUX_PATH="others/unclassified/$PKG_NAME"
+
+ # Down case SlackBuild path
+ echo $AUX_PATH | tr [A-Z] [a-z]
}
# ----------------------------------------------------------------
@@ -468,20 +493,6 @@ function commit_slackbuild {
# check SlackBuilds directory
[ ! -e $SLACKBUILDS_DIR ] && createpkg --sync
- # Get SlackBuild path
- # Get SlackBuild path in slackbuild local tree
- if [ -z $SLACKBUILD_PATH ]; then
- SLACKBUILD_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname` 2>/dev/null
- fi
-
- # Get SlackBuild path in gentoo-portage tree
- if [ -z $SLACKBUILD_PATH ]; then
- # Mount SlackBuild path
- [ $VERBOSE -eq $on ] && echo -e "\nFind SlackBuild PATH in Slack.Sarava tree..."
- AUX=`get_slackbuild_path`
- [ ! -z $AUX ] && SLACKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || SLACKBUILD_PATH="others/unclassified/$PKG_NAME"
- fi
-
# change to SlackBuilds directory
cd $SLACKBUILDS_DIR/
@@ -505,27 +516,13 @@ function commit_mkbuild {
echo "Only root can commit mkbuild..."
return 1
fi
- echo -e "\nCommit $MK_INPUT_FILE"
+ echo -e "\nCommit $MKBUILD_NAME"
# check mkbuild directory
[ ! -e $MKBUILDS_DIR ] && build_repo $MKBUILDS_DIR $MKBUILDS_SVN
# Get mkbuild path in parameter file
- MKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
- #[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD PATH]]=\"$SLACKBUILD_PATH\""
-
- # Get mkbuild path in slackbuild local tree
- if [ -z $MKBUILD_PATH ]; then
- MKBUILD_PATH=`find $MKBUILDS_DIR -name $MK_INPUT_FILE | xargs dirname` 2>/dev/null
- fi
-
- # Get SlackBuild path in gentoo-portage tree
- if [ -z $MKBUILD_PATH ]; then
- # Mount mkbuild path
- [ $VERBOSE -eq $on ] && echo -e "\nFind mkbuild PATH in Slack.Sarava tree..."
- AUX=`get_slackbuild_path`
- [ ! -z $AUX ] && MKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || MKBUILD_PATH="others/unclassified/$PKG_NAME"
- fi
+ MKBUILD_PATH=$SLACKBUILD_PATH
# change to mkbuilds directory
cd $MKBUILDS_DIR/
@@ -534,7 +531,7 @@ function commit_mkbuild {
# check path
[ ! -e $MKBUILD_PATH ] && svn_mkdir $MKBUILD_PATH
# add SlackBuild
- svn_add $MK_INPUT_FILE $MKBUILD_PATH
+ svn_add $MKBUILD_NAME $MKBUILD_PATH
cd $WORK
}
@@ -643,6 +640,9 @@ fi
# Start constants
set_constants
+# Select color mode: gray, color or none (*)
+color_select $COLOR_MODE
+
# Set commit off
COMMIT_SLACKBUILD=$off
COMMIT_MKBUILD=$off
@@ -668,182 +668,189 @@ error_codes
set_parameters "$@"
[ $VERBOSE -eq $on ] && echo -e "$PROG_NAME version $PROG_VERSION\n"
-if [ ! -z "$MKBUILD_NAME" ]; then
- # Create a new .mkbuild parameters-file
- cp $MODEL_DIR/model.mkbuild ${MKBUILD_NAME}.mkbuild
- # Package Author
- if [ ! -z "$AUTHOR" ]; then
- edit_file "YOUR NAME" "${AUTHOR}" ${MKBUILD_NAME}.mkbuild
- # Package Author Signature
- if [ -z "$AUTHOR_INITIALS" ]; then
- AUTHOR_INITIALS=`echo $AUTHOR | tr '[A-Z]' '[a-z]' | sed 's/ /\n/g' | sed 's/^\([a-z]\).*/\1/' | sed ':i ; $! N ; s/\n// ; t i'`
- fi
- edit_file "YOUR SIGNATURE" "${AUTHOR_INITIALS}" ${MKBUILD_NAME}.mkbuild
- fi
- # Change Default SourceForge URL
- [ -z "$URL" ] && URL="http://downloads.sourceforge.net/[[PKG NAME]]/"
- edit_file "DEFAULT URL" "${URL}" ${MKBUILD_NAME}.mkbuild
- # Change Package Name
- edit_file "PKG NAME" "${MKBUILD_NAME}" ${MKBUILD_NAME}.mkbuild
- edit_file "PKG NAME" "${MKBUILD_NAME}" ${MKBUILD_NAME}.mkbuild
-
- # Print .mkbuild name
- echo "${MKBUILD_NAME}.mkbuild"
-else
- # Get values
- # Author name
- AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"}
- [ -z "$AUTHOR" ] && handle_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR"
- [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR]]=\"$AUTHOR\""
-
- # Author initials
- STR_MOUNT=`echo $AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]`
- AUTHOR_INITIALS="`validate_parameter "$AUTHOR_INITIALS" "SLACKBUILD AUTHOR INITIALS" "$STR_MOUNT"`" || handle_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS"
- [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\""
-
- # URL program
- URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || handle_error $ERROR_MKBUILD_CONSTRUCTION "URL"
- [ $VERBOSE -eq $on ] && echo "[[URL]]=\"$URL\""
-
- STR_MOUNT="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`"
- if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then
- SOURCE_NAME=`basename $URL`
- URL_BASE=`dirname $URL`
- else
- URL_BASE=$URL
- fi
- [ $VERBOSE -eq $on ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\""
-
- # Extension
- EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "EXTENSION"
- [ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\""
-
- BUILD_NUMBER=`validate_parameter "$BUILD_NUMBER" "BUILD NUMBER" "1"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "BUILD NUMBER"
-
- # Unpacker
- UNPACKER=`validate_parameter "$UNPACKER" "UNPACKER" "tar"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER"
- [ $VERBOSE -eq $on ] && echo "[[UNPACKER]]=\"$UNPACKER\""
-
- # Unpacker flags
- [ "$UNPACKER" == "tar" ] && STR_MOUNT="--no-same-owner --no-same-permissions -xvf" || STR_MOUNT=""
- UNPACKER_FLAGS=`validate_parameter "$UNPACKER_FLAGS" "UNPACKER FLAGS" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER FLAGS"
- [ $VERBOSE -eq $on ] && echo "[[UNPACKER_FLAGS]]=\"$UNPACKER_FLAGS\""
-
- # Build archteture
- ARCH=`validate_parameter "$ARCH" "ARCH" "i486"`
- [ $VERBOSE -eq $on ] && echo "[[ARCH]]=\"$ARCH\""
-
- # Source name
- STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'`
- SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "SOURCE NAME"
- [ $VERBOSE -eq $on ] && echo "[[SOURCE NAME]]=\"$SRC_NAME\""
-
- # Package name
- STR_MOUNT=`echo $SRC_NAME | tr [A-Z_] [a-z\-]`
- PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"`
- [ $VERBOSE -eq $on ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\""
-
- # Version
- STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'`
- VERSION=`validate_parameter "$VERSION" "VERSION" $STR_MOUNT` || handle_error $ERROR_MKBUILD_CONSTRUCTION "VERSION"
- [ $VERBOSE -eq $on ] && echo "[[VERSION]]=\"$VERSION\""
-
- # Construction source name string
- CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`"
- [ $VERBOSE -eq $on ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\""
-
- # Build Source Name
- [ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
- [ $VERBOSE -eq $on ] && echo "SOURCE_NAME=\"$SOURCE_NAME\""
-
- # Decompressor program and test flag
- DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""`
- [ -z $DECOMPRESSOR ] && decompress_find
- [ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\""
-
- DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || handle_error $ERROR_MKBUILD_CONSTRUCTION "DECOMPRESSOR TEST FLAG"
- [ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\""
-
- # Documentations list
- DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"`
- [ $VERBOSE -eq $on ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\""
-
- # ./configure option
- OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""`
- [ $VERBOSE -eq $on ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\""
-
- # PREFIX
- PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"`
- [ $VERBOSE -eq $on ] && echo "[[PREFIX]]=\"$PREFIX\""
-
- # Number of jobs
- NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""`
- is_number $NUMJOBS && NUMJOBS="-j${NUMJOBS}"
- [ $VERBOSE -eq $on ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
-
- # Make slack-required file
- SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""`
- [ $VERBOSE -eq $on ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\""
-
- # SlackBuild model
- MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"`
- [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\""
-
- # PATCH FILES
- PATCH_FILES=`validate_parameter "$PATCH_FILES" "PATCH FILES" ""`
-
- # Strip the smallest prefix containing num leading slashes from each file name found in the patch file.
- NPS_STRIP=`validate_parameter "$NPS_STRIP" "NUMBER OF PREFIX SLASHES TO STRIP" "1"`
-
- # SlackBuild path
- SLACKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
- [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD PATH]]=\"$SLACKBUILD_PATH\""
-
- #--------------------------------------------------------------
- #- Start build SlackBuild -
- #--------------------------------------------------------------
- [ $VERBOSE -eq $on ] && echo -e "\nStart SlackBuild make"
- SLACKBUILD=${PKG_NAME}.SlackBuild
- SLACKBUILD_TEMP=$SLACKBUILD.tmp
- cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
-
- # Change strings from model
- [ $VERBOSE -eq $on ] && echo -e "\nStart build $PACKAGE.SlackBuild..."
- start_build $SLACKBUILD_TEMP
-
- # On/Off sections
- [ $VERBOSE -eq $on ] && echo -e "\nEnable/desable sections ..."
- activate_sections
-
- # Change sections
- [ $VERBOSE -eq $on ] && echo -e "\nEdit sections ..."
- section_edit
-
- # Remove off sections
- [ $VERBOSE -eq $on ] && echo -e "\nRemove off sections ..."
- build_slackbuild
-
- # Make slack-required file
- [ $VERBOSE -eq $on ] && echo -e "\nMake slack-required file ..."
- make_slack_required
-
- if [ -e slack-required ]; then
- DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`"
- edit_file "REQUIRES" "$DEPENDENCY_LIST" $SLACKBUILD
- else
- edit_file "REQUIRES" " " $SLACKBUILD
- fi
+case $ACTION in
+ 'new')
+ # Create a new .mkbuild parameters-file
+ cp $MODEL_DIR/model.mkbuild $MKBUILD_NAME
+ # Package Author
+ if [ ! -z "$AUTHOR" ]; then
+ edit_file "YOUR NAME" "${AUTHOR}" $MKBUILD_NAME
+ # Package Author Signature
+ if [ -z "$AUTHOR_INITIALS" ]; then
+ AUTHOR_INITIALS=`echo $AUTHOR | tr '[A-Z]' '[a-z]' | sed 's/ /\n/g' | sed 's/^\([a-z]\).*/\1/' | sed ':i ; $! N ; s/\n// ; t i'`
+ fi
+ edit_file "YOUR SIGNATURE" "${AUTHOR_INITIALS}" $MKBUILD_NAME
+ fi
+ # Change Default SourceForge URL
+ [ -z "$URL" ] && URL="http://downloads.sourceforge.net/[[PKG NAME]]/"
+ edit_file "DEFAULT URL" "${URL}" $MKBUILD_NAME
+ # Change Package Name
+ edit_file "PKG NAME" "${MKBUILD_NAME//.mkbuild}" $MKBUILD_NAME
+
+ # Print .mkbuild name
+ echo "$MKBUILD_NAME"
+ ;;
+ 'show-path')
+ # Print SlackBuild Path
+ get_slackbuild_path
+ ;;
+ 'build')
+ # Get values
+ # Author name
+ AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"}
+ [ -z "$AUTHOR" ] && handle_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR"
+ [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR]]=\"$AUTHOR\""
+
+ # Author initials
+ STR_MOUNT=`echo $AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]`
+ AUTHOR_INITIALS="`validate_parameter "$AUTHOR_INITIALS" "SLACKBUILD AUTHOR INITIALS" "$STR_MOUNT"`" || handle_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS"
+ [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\""
+
+ # URL program
+ URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || handle_error $ERROR_MKBUILD_CONSTRUCTION "URL"
+ [ $VERBOSE -eq $on ] && echo "[[URL]]=\"$URL\""
+
+ STR_MOUNT="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`"
+ if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then
+ SOURCE_NAME=`basename $URL`
+ URL_BASE=`dirname $URL`
+ else
+ URL_BASE=$URL
+ fi
+ [ $VERBOSE -eq $on ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\""
+
+ # Extension
+ EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "EXTENSION"
+ [ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\""
+
+ BUILD_NUMBER=`validate_parameter "$BUILD_NUMBER" "BUILD NUMBER" "1"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "BUILD NUMBER"
+
+ # Unpacker
+ UNPACKER=`validate_parameter "$UNPACKER" "UNPACKER" "tar"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER"
+ [ $VERBOSE -eq $on ] && echo "[[UNPACKER]]=\"$UNPACKER\""
+
+ # Unpacker flags
+ [ "$UNPACKER" == "tar" ] && STR_MOUNT="--no-same-owner --no-same-permissions -xvf" || STR_MOUNT=""
+ UNPACKER_FLAGS=`validate_parameter "$UNPACKER_FLAGS" "UNPACKER FLAGS" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER FLAGS"
+ [ $VERBOSE -eq $on ] && echo "[[UNPACKER_FLAGS]]=\"$UNPACKER_FLAGS\""
+
+ # Build archteture
+ ARCH=`validate_parameter "$ARCH" "ARCH" "i486"`
+ [ $VERBOSE -eq $on ] && echo "[[ARCH]]=\"$ARCH\""
+
+ # Source name
+ STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'`
+ SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "SOURCE NAME"
+ [ $VERBOSE -eq $on ] && echo "[[SOURCE NAME]]=\"$SRC_NAME\""
+
+ # Package name
+ STR_MOUNT=$SRC_NAME
+ PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"`
+ [ $VERBOSE -eq $on ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\""
+
+ # Version
+ STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'`
+ VERSION=`validate_parameter "$VERSION" "VERSION" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "VERSION"
+ [ $VERBOSE -eq $on ] && echo "[[VERSION]]=\"$VERSION\""
+
+ # Construction source name string
+ CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`"
+ [ $VERBOSE -eq $on ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\""
+
+ # Build Source Name
+ [ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
+ [ $VERBOSE -eq $on ] && echo "SOURCE_NAME=\"$SOURCE_NAME\""
+
+ # Decompressor program and test flag
+ DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""`
+ [ -z $DECOMPRESSOR ] && decompress_find
+ [ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\""
+
+ DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || handle_error $ERROR_MKBUILD_CONSTRUCTION "DECOMPRESSOR TEST FLAG"
+ [ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\""
+
+ # Documentations list
+ DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"`
+ [ $VERBOSE -eq $on ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\""
+
+ # ./configure option
+ OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""`
+ [ $VERBOSE -eq $on ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\""
+
+ # PREFIX
+ PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"`
+ [ $VERBOSE -eq $on ] && echo "[[PREFIX]]=\"$PREFIX\""
+
+ # Number of jobs
+ NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""`
+ is_number $NUMJOBS && NUMJOBS="-j${NUMJOBS}"
+ [ $VERBOSE -eq $on ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
+
+ # Make slack-required file
+ SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""`
+ [ $VERBOSE -eq $on ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\""
+
+ # SlackBuild model
+ MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"`
+ [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\""
+
+ # PATCH FILES
+ PATCH_FILES=`validate_parameter "$PATCH_FILES" "PATCH FILES" ""`
+
+ # Strip the smallest prefix containing num leading slashes from each file name found in the patch file.
+ NPS_STRIP=`validate_parameter "$NPS_STRIP" "NUMBER OF PREFIX SLASHES TO STRIP" "1"`
+
+ # SlackBuild path
+ # SlackBuild path in mkbuild parameters file
+ SLACKBUILD_PATH=`get_slackbuild_path`
+ [ $VERBOSE -eq $on ] && echo "[[SLACKBUILD PATH]]=\"$SLACKBUILD_PATH\""
+
+ #--------------------------------------------------------------
+ #- Start build SlackBuild -
+ #--------------------------------------------------------------
+ [ $VERBOSE -eq $on ] && echo -e "\nStart SlackBuild make"
+ SLACKBUILD=${PKG_NAME}.SlackBuild
+ SLACKBUILD_TEMP=$SLACKBUILD.tmp
+ cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
+
+ # On/Off sections
+ [ $VERBOSE -eq $on ] && echo -e "\nEnable/desable sections ..."
+ activate_sections
+
+ # Change sections
+ [ $VERBOSE -eq $on ] && echo -e "\nEdit sections ..."
+ section_edit
+
+ # Change strings from model
+ [ $VERBOSE -eq $on ] && echo -e "\nChange strings in $PACKAGE.SlackBuild model..."
+ start_build $SLACKBUILD_TEMP
+
+ # Remove off sections
+ [ $VERBOSE -eq $on ] && echo -e "\nRemove off sections ..."
+ build_slackbuild
+
+ # Make slack-required file
+ [ $VERBOSE -eq $on ] && echo -e "\nMake slack-required file ..."
+ make_slack_required
+
+ if [ -e slack-required ]; then
+ DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`"
+ edit_file "REQUIRES" "$DEPENDENCY_LIST" $SLACKBUILD
+ else
+ edit_file "REQUIRES" " " $SLACKBUILD
+ fi
- # Others changes
- [ $VERBOSE -eq $on ] && echo -e "\nEdit others [[]] parameters ..."
- change_others_parameters
+ # Others changes
+ [ $VERBOSE -eq $on ] && echo -e "\nEdit others [[]] parameters ..."
+ change_others_parameters
- # Commit SlackBuild
- [ $COMMIT_SLACKBUILD -eq $on ] && commit_slackbuild
+ # Commit SlackBuild
+ [ $COMMIT_SLACKBUILD -eq $on ] && commit_slackbuild
- # Commit mkbuild
- [ $COMMIT_MKBUILD -eq $on ] && commit_mkbuild
-fi
+ # Commit mkbuild
+ [ $COMMIT_MKBUILD -eq $on ] && commit_mkbuild
+ ;;
+esac
# Clear temporary files
[ $VERBOSE -eq $on ] && echo -e "\nRemove temporary files ..."