aboutsummaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
authorrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-12-23 16:11:56 +0000
committerrhatto <rhatto@04377dda-e619-0410-9926-eae83683ac58>2008-12-23 16:11:56 +0000
commit9a8f7b53cefff0a1282d32112fcf353d06cb6d5c (patch)
treebf53cd4bc143fd0ed28f48116bd9a6233e561fa3 /trunk/src
parent52a6b2792631217e5e7a96a5bd1577e320b2cdcf (diff)
downloadsimplepkg-9a8f7b53cefff0a1282d32112fcf353d06cb6d5c.tar.gz
simplepkg-9a8f7b53cefff0a1282d32112fcf353d06cb6d5c.tar.bz2
code cleanup
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@706 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/src')
-rwxr-xr-xtrunk/src/mkbuild509
1 files changed, 279 insertions, 230 deletions
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index a6dc947..84120ff 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -15,19 +15,16 @@
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place - Suite 330, Boston, MA 02111-1307, USA
#
-# Based in model generic.SlackBuild of Luiz
+# Based in model generic.SlackBuild from Luis
# Version $Rev$ - $Author$
#
-PROG_VERSION="1.2.8"
-PROG_NAME="`basename $0`"
-
#--------------------------------------------------------------------
# Functions
#--------------------------------------------------------------------
-function mkbuild_use()
-{
+function mkbuild_use {
+
# mkbuild help function
echo -e "${red}NAME${normal}
mkbuild - create SlackBuild script from ${green}.mkbuild${normal} input file
@@ -154,22 +151,18 @@ function set_parameters {
;;
'-cs'|'--commit-slackbuild')
# Commit SlackBuild file
+ ACTION="commit_slackbuild"
shift
- commit_changes $SLACKBUILDS_DIR $*
- exit 0
;;
'-cm'|'--commit-mkbuild')
# commit mkbuild file
+ ACTION="commit_mkbuild"
shift
- commit_changes $MKBUILDS_DIR $*
- exit 0
;;
'-ca'|'--commit-all')
# Commit SlackBuild and mkbuild file
+ ACTION="commit_all"
shift
- commit_changes $SLACKBUILDS_DIR $*
- commit_changes $MKBUILDS_DIR $*
- exit 0
;;
'-n'|'--new')
# New mkbuild configure file
@@ -199,7 +192,7 @@ function set_parameters {
;;
'-v'|'--version')
# Show program version
- eecho $normal "\n$PROG_NAME version $PROG_VERSION\n"
+ eecho $normal "\n$BASENAME version $PROG_VERSION\n"
;;
'-V' | '--verbose')
# Enable verbose mode
@@ -373,7 +366,7 @@ function set_status {
# $3 - file
[ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
if [ "`get_status $1 $3`" != "all" ]; then
- [ $VERBOSE -eq $on ] && echo "Section $1 $2"
+ verbose "Section $1 $2"
eval "sed -i 's/^<$1>.*$/<$1> $2/' $3"
else
echo "Warning: Section $1 have status all. Can't change!"
@@ -410,7 +403,7 @@ function activate_sections {
#if [ $SVN_MOD -eq $on -o $URL == "" ]; then
# LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source"
- # [ $VERBOSE -eq $on ] && echo -e "\nSubversion or empty URL changes:"
+ # verbose -e "\nSubversion or empty URL changes:"
# for i in $LIST_OFF; do
# set_status $i "off" $SLACKBUILD_TEMP
# done
@@ -448,7 +441,7 @@ function section_edit {
# Change sections
for i in $SECTION_LIST; do
- [ $VERBOSE -eq $on ] && echo "Change section $i"
+ verbose "Change section $i"
if [ "$i" = "slackdesc" ]; then
# Special slackdesc section
slackdesc_edit > $AUX_TMP
@@ -562,7 +555,9 @@ function apply_mkpatch {
}
# ----------------------------------------------------------------
-# ------------------- svn functions ------------------------------
+# svn functions
+# ----------------------------------------------------------------
+
function submit_slackbuild {
# Submit SlackBuild in local Slack.Sarava tree
@@ -663,7 +658,8 @@ function submit_cleanup {
}
# ----------------------------------------------------------------
-# ------------------- general functions --------------------------
+# general functions
+# ----------------------------------------------------------------
function validate_parameter {
@@ -819,6 +815,7 @@ function update_manifest_info {
function update_manifest {
# Update Manifest file
+ verbose "Updating Manifest..."
# Update mkbuild metainformation
update_manifest_info $WORK/$MKBUILD_NAME
@@ -852,15 +849,262 @@ function update_manifest {
}
+function if_previous_error {
+
+ if [ "$?" != "0" ]; then
+ handle_error $*
+ fi
+
+}
+
+function verbose {
+
+ if [ $VERBOSE -eq $on ]; then
+ echo $*
+ fi
+
+}
+
+function make_slackbuild {
+
+ # Get values
+ # Author name
+ AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"}
+ [ -z "$AUTHOR" ] && handle_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR"
+ verbose "[[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"`"
+ if_previous_error $ERROR_MKBUILD_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS"
+ verbose "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\""
+
+ # URL program
+ URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "URL"
+ verbose "[[URL]]=\"$URL\""
+
+ AUX=`get_mkbuild_status "svn_source"`
+ SVN_MOD=`convert_boolean "$AUX"`
+
+ AUX=`get_mkbuild_status "git_source"`
+ GIT_MOD=`convert_boolean "$AUX"`
+
+ # Check sections
+ if [ $SVN_MOD -eq $on -o $GIT_MOD -eq $on -o $URL == "" ]; then
+ LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source"
+ verbose -e "\nCheck subversion or empty URL"
+ for i in $LIST_OFF; do
+ if [ `get_mkbuild_status "$i"` != "off" ]; then
+ handle_error $ERROR_MKBUILD_VCS
+ else
+ verbose -e "off: $i is ok."
+ fi
+ done
+ fi
+
+ STR_MOUNT="`echo $URL | sed 's/.*\.\([a-z0-9]\+\)$/\1/'`"
+ 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 "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\""
+
+ if [ $SVN_MOD -eq $off ] && [ $GIT_MOD -eq $off ]; then
+ # Extension
+ EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "EXTENSION"
+ verbose "[[EXTENSION]]=\"$EXTENSION\""
+
+ # Unpacker
+ UNPACKER=`validate_parameter "$UNPACKER" "UNPACKER" "tar"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER"
+ verbose "[[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"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "UNPACKER FLAGS"
+ verbose "[[UNPACKER_FLAGS]]=\"$UNPACKER_FLAGS\""
+
+ # Decompressor program and test flag
+ DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""`
+ [ -z $DECOMPRESSOR ] && decompress_find
+ verbose "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\""
+
+ DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "DECOMPRESSOR TEST FLAG"
+ verbose "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\""
+ fi
+
+ # Build number
+ BUILD_NUMBER=`validate_parameter "$BUILD_NUMBER" "BUILD NUMBER" "1"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "BUILD NUMBER"
+
+ # Build archteture
+ ARCH=`validate_parameter "$ARCH" "ARCH" "i486"`
+ verbose "[[ARCH]]=\"$ARCH\""
+
+ # Source name
+ STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'`
+ SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "SOURCE NAME"
+ verbose "[[SOURCE NAME]]=\"$SRC_NAME\""
+
+ # Package name
+ STR_MOUNT=$SRC_NAME
+ PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"`
+ verbose "[[PACKAGE NAME]]=\"$PKG_NAME\""
+
+ # Version
+ STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'`
+ VERSION=`validate_parameter "$VERSION" "VERSION" "$STR_MOUNT"`
+ if_previous_error handle_error $ERROR_MKBUILD_CONSTRUCTION "VERSION"
+ verbose "[[VERSION]]=\"$VERSION\""
+
+ # Source name construction string
+ CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`"
+ verbose "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\""
+
+ # Build Source Name
+ [ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
+ verbose "SOURCE_NAME=\"$SOURCE_NAME\""
+
+ # Eval source code name
+ DIST_SRC_NAME="`eval "echo $CONST_STRING"`" # we need this to strip some escape strings
+ DIST_SRC_NAME="`eval "echo $DIST_SRC_NAME"`" # twice does the job
+
+ # Documentations list
+ DEFAULT_DOCFILES="NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING LICENSE SIGNATURE readme.*"
+ DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "$DEFAULT_DOCFILES"`
+ verbose "[[DOCUMENTATION FILES]]=\"$DOCFILES\""
+
+ # ./configure option
+ OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""`
+ verbose "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\""
+
+ # PREFIX
+ PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"`
+ verbose "[[PREFIX]]=\"$PREFIX\""
+
+ # Number of jobs
+ NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""`
+ is_number $NUMJOBS && NUMJOBS="-j${NUMJOBS}"
+ verbose "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
+
+ # Make slack-required file
+ SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""`
+ verbose "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\""
+
+ # SlackBuild model
+ MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"`
+ verbose "[[SLACKBUILD MODEL]]=\"$MODEL\""
+
+ # PATCH FILES
+ PATCH_FILES=`validate_parameter "$PATCH_FILES" "PATCH FILES" ""`
+ verbose "[[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"`
+ verbose "[[NUMBER OF PREFIX SLASHES TO STRIP]]=\"$NPS_STRIP\""
+
+ # SlackBuild path
+ # SlackBuild path in mkbuild parameters file
+ SLACKBUILD=${PKG_NAME}.SlackBuild
+ SLACKBUILD_PATH=`get_slackbuild_path`
+ verbose "[[SLACKBUILD PATH]]=\"$SLACKBUILD_PATH\""
+
+ #--------------------------------------------------------------
+ #- Start build SlackBuild -
+ #--------------------------------------------------------------
+ verbose -e "\nStart SlackBuild make"
+ SLACKBUILD_TEMP=$SLACKBUILD.tmp
+ cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
+
+ # Apply mkpatch
+ verbose -e "\nMkpatch section ..."
+ apply_mkpatch
+
+ # On/Off sections
+ verbose -e "\nEnable/disable sections ..."
+ activate_sections
+
+ # Change sections
+ verbose -e "\nEdit sections ..."
+ section_edit
+
+ # Change strings from model
+ verbose -e "\nChange strings in $PACKAGE.SlackBuild model..."
+ start_build $SLACKBUILD_TEMP
+
+ # Remove off sections
+ verbose -e "\nRemove off sections ..."
+ build_slackbuild
+
+ # Make slack-required file
+ verbose -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 -e "\nEdit others [[]] parameters ..."
+ change_other_parameters
+
+ # Update Manifest file
+ update_manifest
+
+ # Commit SlackBuild
+ [ $SUBMIT_SLACKBUILD -eq $on ] && submit_slackbuild
+
+ # Commit mkbuild
+ [ $SUBMIT_MKBUILD -eq $on ] && submit_mkbuild
+
+}
+
+function create_mkbuild {
+
+ # 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"
+
+}
+
# ----------------------------------------------------------------
#=============================
# Main Program
#=============================
-#-----------------------------
+
# Common functions
COMMON_SH="/usr/libexec/simplepkg/common.sh"
-SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf"
+PROG_VERSION="`echo '$Rev$' | sed -e 's/[^0-9]//g'`"
BASENAME="`basename $0`"
WORK=`pwd`
LANG=en_US
@@ -904,219 +1148,24 @@ error_codes
# Configure input parameters
set_parameters "$@"
-[ $VERBOSE -eq $on ] && echo -e "$PROG_NAME version $PROG_VERSION\n"
+verbose -e "$BASENAME version $PROG_VERSION\n"
if [ ! -z $MKBUILD_NAME ]; then
case $ACTION in
+ 'commit_slackbuild')
+ commit_changes $SLACKBUILDS_DIR $*
+ ;;
+ 'commit_mkbuild')
+ commit_changes $MKBUILDS_DIR $*
+ ;;
+ 'commit_all')
+ commit_changes $SLACKBUILDS_DIR $*
+ commit_changes $MKBUILDS_DIR $*
+ ;;
'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"
+ create_mkbuild
;;
'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\""
-
- AUX=`get_mkbuild_status "svn_source"`
- SVN_MOD=`convert_boolean "$AUX"`
-
- AUX=`get_mkbuild_status "git_source"`
- GIT_MOD=`convert_boolean "$AUX"`
-
- # Check sections
- if [ $SVN_MOD -eq $on -o $GIT_MOD -eq $on -o $URL == "" ]; then
- LIST_OFF="download_source md5sum_download_and_check_0 md5sum_download_and_check_1 gpg_signature_check untar_source"
- [ $VERBOSE -eq $on ] && echo -e "\nCheck subversion or empty URL"
- for i in $LIST_OFF; do
- if [ `get_mkbuild_status "$i"` != "off" ]; then
- handle_error $ERROR_MKBUILD_VCS
- else
- [ $VERBOSE -eq $on ] && echo -e "off: $i is ok."
- fi
- done
- fi
-
- STR_MOUNT="`echo $URL | sed 's/.*\.\([a-z0-9]\+\)$/\1/'`"
- 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\""
-
- if [ $SVN_MOD -eq $off ] && [ $GIT_MOD -eq $off ]; then
- # Extension
- EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "EXTENSION"
- [ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\""
-
- # 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\""
-
- # 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\""
- fi
-
- BUILD_NUMBER=`validate_parameter "$BUILD_NUMBER" "BUILD NUMBER" "1"` || handle_error $ERROR_MKBUILD_CONSTRUCTION "BUILD NUMBER"
- # 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\""
-
- # Eval source code name
- DIST_SRC_NAME="`eval "echo $CONST_STRING"`" # we need this to strip some escape strings
- DIST_SRC_NAME="`eval "echo $DIST_SRC_NAME"`" # twice does the job
-
- # Documentations list
- DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING LICENSE SIGNATURE 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" ""`
- [ $VERBOSE -eq $on ] && echo "[[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"`
- [ $VERBOSE -eq $on ] && echo "[[NUMBER OF PREFIX SLASHES TO STRIP]]=\"$NPS_STRIP\""
-
- # SlackBuild path
- # SlackBuild path in mkbuild parameters file
- SLACKBUILD=${PKG_NAME}.SlackBuild
- 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_TEMP=$SLACKBUILD.tmp
- cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
-
- # Apply mkpatch
- [ $VERBOSE -eq $on ] && echo -e "\nMkpatch section ..."
- apply_mkpatch
-
- # 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_other_parameters
-
- # Update Manifest file
- update_manifest
-
- # Commit SlackBuild
- [ $SUBMIT_SLACKBUILD -eq $on ] && submit_slackbuild
-
- # Commit mkbuild
- [ $SUBMIT_MKBUILD -eq $on ] && submit_mkbuild
+ make_slackbuild
;;
'search')
SEARCH=`find $MKBUILDS_DIR -iname $MKBUILD_NAME`
@@ -1131,6 +1180,6 @@ if [ ! -z $MKBUILD_NAME ]; then
fi
# Clear temporary files
-[ $VERBOSE -eq $on ] && echo -e "\nRemove temporary files ..."
+verbose -e "\nRemove temporary files ..."
clear_files
exit $EXIT_CODE