aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2008-02-11 00:42:02 +0000
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2008-02-11 00:42:02 +0000
commitf0333443cd5b076ecb8f424d61725d841bd049ac (patch)
treefd87f56abb2ca326c068690da99c7b356ad750c4 /trunk
parent8d6fbc79a4246f93acdc58a71b25ce10b85f1d0d (diff)
downloadsimplepkg-f0333443cd5b076ecb8f424d61725d841bd049ac.tar.gz
simplepkg-f0333443cd5b076ecb8f424d61725d841bd049ac.tar.bz2
mkbuild-1.2.2: várias alterações...
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@487 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/doc/CHANGELOG10
-rwxr-xr-xtrunk/src/mkbuild1212
2 files changed, 624 insertions, 598 deletions
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG
index 05c6ea6..c33f7f8 100644
--- a/trunk/doc/CHANGELOG
+++ b/trunk/doc/CHANGELOG
@@ -4,6 +4,14 @@ simplepkg changelog
0.6pre18
========
+ - mkbuild-1.2.2:
+ - remove "-sp" option
+ - function change_others_parameters works of the beginning of the
+ archive .mkbuild until the line initiated for "#>>"
+ - added "--sync" option
+ - change indent spaces to 2
+ - "show slackbuild path" option and related functions had been removed
+ - removed others small bugs
- common.sh: fixed default_arch
- simpletrack: error message
@@ -11,7 +19,7 @@ simplepkg changelog
========
- mkpatch add simple patch suport to mkbuild
- - mkpatch 1.1:
+ - mkpatch-1.1:
- --help, -h option suport
- change select line: 'sed "#i g;d"' is 30% most fast that 'sed -n "#i p"'
- change 'while' loop to most speed in patch application
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index a4b9261..809fbcd 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -19,7 +19,7 @@
# Based in model generic.SlackBuild of Luiz
#
# Version:
-PROG_VERSION=1.2.0
+PROG_VERSION=1.2.2
PROG_NAME=`basename $0`
#--------------------------------------------------------------------
@@ -28,8 +28,8 @@ PROG_NAME=`basename $0`
function mkbuild_use()
{
- # mkbuild help function
- echo "
+ # mkbuild help function
+ echo "
NAME
mkbuild - create SlackBuild script from .mkbuild input file
@@ -48,42 +48,44 @@ DESCRIPTION
change build number
-cs, --const_string <string>
construction string to source name
- -u, --url <url_address>
- url address to source
- -pn, --pkg_name <package_name>
- package name
- -sn, --src_name <source_name>
- source name
- -pv, --pkg_version <version>
- package version
- -md, --model <SlackBuild_model>
- SlackBuild model file
-j, --jobs <jobs_number>
Number of jobs to run simultaneously
- --prefix <install_dir>
- Prefix install directory
- -pf, --patch-files
- List of patch files
+ -md, --model <SlackBuild_model>
+ SlackBuild model file
-npss, --nps-strip
Number of prefix slashes to strip
+ -pf, --patch-files
+ List of patch files
+ -pn, --pkg_name <package_name>
+ package name
+ --prefix <install_dir>
+ Prefix install directory
+ -pv, --pkg_version <version>
+ package version
+ -sn, --src_name <source_name>
+ source name
+ -u, --url <url_address>
+ url address to source
Program options:
- -h, --help
- this help mesage
+ -d, --debug
+ enable debug mode
-cs, --commit-slackbuild
commit SlackBuilds in local svn SlackBuild tree
-cm, --commit-mkbuild
commit .mkbuild in local svn mkbuild tree
-c, --commit-all
commit SlackBuild and .mkbuild files in local svn tree
+ -h, --help
+ this help mesage
-n, --new <mkbuild_name>
start a new mkbuild configure file
+ --sync
+ synchronize mkbuilds repository
-v, --version
program version
-V, --verbose
print debug information
- -sp, --slackbuild-path
- print SlackBuild path in Slack.Sarava tree
EXAMPLES
mkbuild -c pyrex.mkbuild
@@ -117,476 +119,491 @@ COPYRIGHT
function set_parameters {
- # Get and set mkbuild variables with parameters input
- # Use: set_parameters $@
- # where $@ are the parameters input
- #
- # Parameters analyze
- ACTION="build"
-
- while [ "$1" ]; do
- case $1 in
- '-bn'|'--build-number')
- # Build Number
- BUILD_NUMBER=$2
- is_number $BUILD_NUMBER || handle_error "$ERROR_NOT_NUMBER" "--build-number"
- shift
- ;;
- '-cs'|'--commit-slackbuild')
- # Commit SlackBuild file
- COMMIT_SLACKBUILD=$on
- ;;
- '-cm'|'--commit-mkbuild')
- # commit mkbuild file
- COMMIT_MKBUILD=$on
- ;;
- '-c'|'--commit-all')
- # Commit SlackBuild and mkbuild file
- COMMIT_SLACKBUILD=$on
- COMMIT_MKBUILD=$on
- ;;
- '-n'|'--new')
- # New mkbuild configure file
- MKBUILD_NAME="${2//.mkbuild}.mkbuild"
- [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--new <mkbuild_name>"
- ACTION="new"
- shift
- ;;
- '-d'|'--debug')
- # Debug mode
- set -x
- ;;
- '-h'|'--help' )
- # Show help mesage
- mkbuild_use && exit 0
- ;;
- '-v'|'--version')
- # Show program version
- eecho $normal "\n$PROG_NAME version $PROG_VERSION\n" && exit 0
- ;;
- '-V' | '--verbose')
- # Enable verbose mode
- VERBOSE=1
- ;;
- '-a'|'--author')
- # Enter with author name
- AUTHOR=$2
- [ ${AUTHOR:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR AUTHOR
- shift
- ;;
- '-ai'|'--author_initials')
- # Enter with author name
- AUTHOR_INITIALS=$2
- [ ${AUTHOR_INITIALS:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR AUTHOR_INITIALS
- shift
- ;;
- '-cs'|'--const_string')
- # Enter with construction source name string
- CONST_STRING=$2
- [ ${CONST_STRING:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR CONST_STRING
- shift
- ;;
- '-md'|'--model')
- # Enter with SlackBuild model
- MODEL=$2
- [ ${MODEL:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR MODEL
- shift
- ;;
- '-j'|'--jobs')
- # Enter with SlackBuild model
- NUMJOBS=$2
- [ ${NUMJOBS:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR NUMJOBS
- ! is_number $NUMJOBS && handle_error $ERROR_NOT_NUMBER NUMJOBS
- NUMJOBS="-j$NUMJOBS"
- shift
- ;;
- '--prefix')
- # Enter with SlackBuild model
- PREFIX=$2
- [ ${PREFIX:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR PREFIX
- shift
- ;;
- '-pn'|'--pkg_name')
- # Enter with package name
- PKG_NAME=$2
- [ ${PKG_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR PKG_NAME
- shift
- ;;
- '-pv'|'pkg_version')
- # Enter with package version
- VERSION=$2
- [ ${VERSION:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR VERSION
- shift
- ;;
- '-sn'|'--src_name')
- # Enter with source name
- SRC_NAME=$2
- [ ${SRC_NAME:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR SRC_NAME
- shift
- ;;
- '-u'|'--url')
- # Enter with url address
- URL=$2
- [ ${URL:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR URL
- shift
- ;;
- '-pf'|'--patch-files')
- # Path files list
- PATCH_FILES=$2
- [ ${PATCH_FILES:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR PATCH_FILES
- shift
- ;;
- '-npss'|'--nps-strip')
- # Number of prefix slashes to strip
- NPS_STRIP=$2
- [ ${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
- MKBUILD_NAME="${1//.mkbuild}.mkbuild"
- #[ ! -e $MKBUILD_NAME ] && handle_error $ERROR_FILE_NOTFOUND $MKBUILD_NAME
- ;;
- esac
+ # Get and set mkbuild variables with parameters input
+ # Use: set_parameters $@
+ # where $@ are the parameters input
+ #
+ # Parameters analyze
+ ACTION="build"
+
+ while [ "$1" ]; do
+ case $1 in
+ '-bn'|'--build-number')
+ # Build Number
+ BUILD_NUMBER=$2
+ is_number $BUILD_NUMBER || handle_error "$ERROR_NOT_NUMBER" "--build-number"
+ shift
+ ;;
+ '-cs'|'--commit-slackbuild')
+ # Commit SlackBuild file
+ COMMIT_SLACKBUILD=$on
+ ;;
+ '-cm'|'--commit-mkbuild')
+ # commit mkbuild file
+ COMMIT_MKBUILD=$on
+ ;;
+ '-c'|'--commit-all')
+ # Commit SlackBuild and mkbuild file
+ COMMIT_SLACKBUILD=$on
+ COMMIT_MKBUILD=$on
+ ;;
+ '-n'|'--new')
+ # New mkbuild configure file
+ MKBUILD_NAME="${2//.mkbuild}.mkbuild"
+ [ ${MKBUILD_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR "--new <mkbuild_name>"
+ ACTION="new"
+ shift
+ ;;
+ '-d'|'--debug')
+ # Debug mode
+ set -x
+ ;;
+ '-h'|'--help' )
+ # Show help mesage
+ mkbuild_use && exit 0
+ ;;
+ '--sync' )
+ # Synchronize mkbuilds repository
+ sync_repo $MKBUILDS_DIR $MKBUILDS_SVN
+ cd $WORK
+ ;;
+ '-v'|'--version')
+ # Show program version
+ eecho $normal "\n$PROG_NAME version $PROG_VERSION\n"
+ ;;
+ '-V' | '--verbose')
+ # Enable verbose mode
+ VERBOSE=1
+ ;;
+ '-a'|'--author')
+ # Enter with author name
+ AUTHOR=$2
+ [ ${AUTHOR:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR AUTHOR
+ shift
+ ;;
+ '-ai'|'--author_initials')
+ # Enter with author name
+ AUTHOR_INITIALS=$2
+ [ ${AUTHOR_INITIALS:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR AUTHOR_INITIALS
+ shift
+ ;;
+ '-cs'|'--const_string')
+ # Enter with construction source name string
+ CONST_STRING=$2
+ [ ${CONST_STRING:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR CONST_STRING
+ shift
+ ;;
+ '-md'|'--model')
+ # Enter with SlackBuild model
+ MODEL=$2
+ [ ${MODEL:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR MODEL
shift
- done
+ ;;
+ '-j'|'--jobs')
+ # Enter with SlackBuild model
+ NUMJOBS=$2
+ [ ${NUMJOBS:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR NUMJOBS
+ ! is_number $NUMJOBS && handle_error $ERROR_NOT_NUMBER NUMJOBS
+ NUMJOBS="-j$NUMJOBS"
+ shift
+ ;;
+ '--prefix')
+ # Enter with SlackBuild model
+ PREFIX=$2
+ [ ${PREFIX:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR PREFIX
+ shift
+ ;;
+ '-pn'|'--pkg_name')
+ # Enter with package name
+ PKG_NAME=$2
+ [ ${PKG_NAME:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR PKG_NAME
+ shift
+ ;;
+ '-pv'|'pkg_version')
+ # Enter with package version
+ VERSION=$2
+ [ ${VERSION:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR VERSION
+ shift
+ ;;
+ '-sn'|'--src_name')
+ # Enter with source name
+ SRC_NAME=$2
+ [ ${SRC_NAME:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR SRC_NAME
+ shift
+ ;;
+ '-u'|'--url')
+ # Enter with url address
+ URL=$2
+ [ ${URL:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR URL
+ shift
+ ;;
+ '-pf'|'--patch-files')
+ # Path files list
+ PATCH_FILES=$2
+ [ ${PATCH_FILES:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR PATCH_FILES
+ shift
+ ;;
+ '-npss'|'--nps-strip')
+ # Number of prefix slashes to strip
+ NPS_STRIP=$2
+ [ ${NPS_STRIP:0:1} = '-' ] && handle_error $ERROR_MKBUILD_INPUT_PAR NPS_STRIP
+ shift
+ ;;
+ *)
+ # mkbuild input file
+ MKBUILD_NAME="${1//.mkbuild}.mkbuild"
+ ;;
+ esac
+ shift
+ done
+
+ [ ! -e $MKBUILD_NAME ] && ACTION='new'
- [ ! -e $MKBUILD_NAME ] && ACTION='new'
}
function get_variable {
- # Get variable value from mkbuild file (MKBUILD_NAME)
- [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
- [ -z $MKBUILD_NAME ] && echo "Warning: no [mkbuild_file]." && return 0
+ # Get variable value from mkbuild file (MKBUILD_NAME)
+ [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+ [ -z $MKBUILD_NAME ] && echo "Warning: no [mkbuild_file]." && return 0
+
+ sed -n '1,/^#>>/ p' $MKBUILD_NAME | grep "^\[\[${1}\]\]" | 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
- [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+ # Edit file $3, by change string [[$1]] to $2
+ [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+
+ eval "sed -i 's¦\[\[$1\]\]¦$2¦g' $3"
- eval "sed -i 's¦\[\[$1\]\]¦$2¦g' $3"
}
function edit_file_full {
- # Edit file $3, by change string $1 to $2
- [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+ # Edit file $3, by change string $1 to $2
+ [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+
+ eval "sed -i 's¦$1¦$2¦' $3"
- eval "sed -i 's¦$1¦$2¦' $3"
}
function start_build {
- # Build initial sections
- [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
-
- edit_file "SLACKBUILD AUTHOR" "$AUTHOR" $1
- edit_file "SLACKBUILD AUTHOR INITIALS" $AUTHOR_INITIALS $1
- edit_file "SOURCE NAME" "$SRC_NAME" $1
- edit_file "PROGRAM NAME" "$PKG_NAME" $1
- edit_file "PACKAGE NAME" "$PKG_NAME" $1
- edit_file "DECOMPRESSOR" "$DECOMPRESSOR" $1
- edit_file "DECOMPRESSOR TEST FLAG" "$DECOMPRESSOR_TEST_FLAG" $1
- edit_file "PROGRAM URL" "$URL" $1
- if [ "$ARCH" == "noarch" ]; then
- sed -i 's/^ARCH=.*$/ARCH="noarch"/' $1
- else
- edit_file "ARCH" "$ARCH" $1
- fi
- edit_file "NUMBER OF JOBS" "$NUMJOBS" $1
- edit_file "VERSION" $VERSION $1
- edit_file "SOURCE NAME CONSTRUCTION STRING" "$CONST_STRING" $1
- edit_file "EXTENSION" "$EXTENSION" $1
- edit_file "DOWNLOAD FOLDER URL" "$URL_BASE" $1
- edit_file "OTHER CONFIGURE ARGS" "$OPTIONS" $1
- edit_file "DOCUMENTATION FILES" "$DOCFILES" $1
- edit_file "PREFIX" "$PREFIX" $1
- edit_file "UNPACKER" "$UNPACKER" $1
- edit_file "UNPACKER FLAGS" "$UNPACKER_FLAGS" $1
- edit_file "BUILD NUMBER" "$BUILD_NUMBER" $1
- edit_file "PATCH FILES" "$PATCH_FILES" $1
- edit_file "NUMBER OF PREFIX SLASHES TO STRIP" "$NPS_STRIP" $1
-
- edit_file_full "\$EXTENSION" "$EXTENSION" $1
+ # Build initial sections
+ [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+
+ edit_file "SLACKBUILD AUTHOR" "$AUTHOR" $1
+ edit_file "SLACKBUILD AUTHOR INITIALS" $AUTHOR_INITIALS $1
+ edit_file "SOURCE NAME" "$SRC_NAME" $1
+ edit_file "PROGRAM NAME" "$PKG_NAME" $1
+ edit_file "PACKAGE NAME" "$PKG_NAME" $1
+ edit_file "DECOMPRESSOR" "$DECOMPRESSOR" $1
+ edit_file "DECOMPRESSOR TEST FLAG" "$DECOMPRESSOR_TEST_FLAG" $1
+ edit_file "PROGRAM URL" "$URL" $1
+ if [ "$ARCH" == "noarch" ]; then
+ sed -i 's/^ARCH=.*$/ARCH="noarch"/' $1
+ else
+ edit_file "ARCH" "$ARCH" $1
+ fi
+ edit_file "NUMBER OF JOBS" "$NUMJOBS" $1
+ edit_file "VERSION" $VERSION $1
+ edit_file "SOURCE NAME CONSTRUCTION STRING" "$CONST_STRING" $1
+ edit_file "EXTENSION" "$EXTENSION" $1
+ edit_file "DOWNLOAD FOLDER URL" "$URL_BASE" $1
+ edit_file "OTHER CONFIGURE ARGS" "$OPTIONS" $1
+ edit_file "DOCUMENTATION FILES" "$DOCFILES" $1
+ edit_file "PREFIX" "$PREFIX" $1
+ edit_file "UNPACKER" "$UNPACKER" $1
+ edit_file "UNPACKER FLAGS" "$UNPACKER_FLAGS" $1
+ edit_file "BUILD NUMBER" "$BUILD_NUMBER" $1
+ edit_file "PATCH FILES" "$PATCH_FILES" $1
+ edit_file "NUMBER OF PREFIX SLASHES TO STRIP" "$NPS_STRIP" $1
+
+ edit_file_full "\$EXTENSION" "$EXTENSION" $1
+
}
function clear_files {
- # Remove temporary files
- rm $AUX_TMP 2>/dev/null
- rm $SLACKBUILD_TEMP 2>/dev/null
- rm $DIFF_FILE 2>/dev/null
- chmod 755 *.SlackBuild 2>/dev/null
+ # Remove temporary files
+ [ ! -z $AUX_TMP ] && rm $AUX_TMP 2>/dev/null
+ [ ! -z $SLACKBUILD_TEMP ] && rm $SLACKBUILD_TEMP 2>/dev/null
+ [ ! -z $DIFF_FILE ] && rm $DIFF_FILE 2>/dev/null
+ chmod 755 *.SlackBuild 2>/dev/null
+
}
function set_status {
- # Set status section
- # $1 - Section
- # $2 - Status
- # $3 - file
- [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
- if [ "`get_status $1 $3`" != "all" ]; then
- [ $VERBOSE -eq $on ] && echo "Section $1 $2"
- eval "sed 's/^<$1>.*$/<$1> $2/' $3" > $AUX_TMP
- mv $AUX_TMP $3
- else
- echo "Warning: Section $1 have status all. Can't change!"
- fi
+ # Set status section
+ # $1 - Section
+ # $2 - Status
+ # $3 - file
+ [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+ if [ "`get_status $1 $3`" != "all" ]; then
+ [ $VERBOSE -eq $on ] && echo "Section $1 $2"
+ eval "sed 's/^<$1>.*$/<$1> $2/' $3" > $AUX_TMP
+ mv $AUX_TMP $3
+ else
+ echo "Warning: Section $1 have status all. Can't change!"
+ fi
+
}
function get_status {
- # Get status from section
- # $1 - Section
- # $2 - file
- [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
- eval "sed '/^<$1>.*$/! d' $2"
+ # Get status from section
+ # $1 - Section
+ # $2 - file
+ [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
+ eval "sed '/^<$1>.*$/! d' $2"
+
}
function activate_sections {
- # Enable and desable sections
- 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:`
- set_status $SECTION $STATUS $SLACKBUILD_TEMP
- done
+ # Enable and desable sections
+ 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:`
+ set_status $SECTION $STATUS $SLACKBUILD_TEMP
+ done
+
}
function build_slackbuild {
- # Clean SlackBuild
- # Make SlackBuild backup
- [ -e $SLACKBUILD ] && mv $SLACKBUILD $SLACKBUILD.old
- # Remove off sections
- sed -i '/^<[a-z].*> off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP
- # Remove sections names
- sed -i '/^<.*$/ d' $SLACKBUILD_TEMP
- # Remove clear lines
- 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 }' $SLACKBUILD_TEMP > $SLACKBUILD
+ # Clean SlackBuild
+ # Make SlackBuild backup
+ [ -e $SLACKBUILD ] && mv $SLACKBUILD $SLACKBUILD.old
+ # Remove off sections
+ sed -i '/^<[a-z].*> off/, /^<\/[a-z].*>$/ d' $SLACKBUILD_TEMP
+ # Remove sections names
+ sed -i '/^<.*$/ d' $SLACKBUILD_TEMP
+ # Remove clear lines
+ 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 }' $SLACKBUILD_TEMP > $SLACKBUILD
+
}
function section_edit {
- # Edits a section substituting its content
- [ -z $MKBUILD_NAME ] && return 0
+ # Edits a section substituting its content
+ [ -z $MKBUILD_NAME ] && return 0
- SECTION_LIST=`grep '^#>[a-z]' $MKBUILD_NAME | cut -c3-`
+ SECTION_LIST=`grep '^#>[a-z]' $MKBUILD_NAME | cut -c3-`
- # Check for sections change
- [ -z "$SECTION_LIST" ] && return 0
+ # Check for sections change
+ [ -z "$SECTION_LIST" ] && return 0
+
+ # Change sections
+ for i in $SECTION_LIST; do
+ [ $VERBOSE -eq $on ] && echo "Change section $i"
+ if [ "$i" = "slackdesc" ]; then
+ # Special slackdesc section
+ slackdesc_edit > $AUX_TMP
+ mv $AUX_TMP $SLACKBUILD_TEMP
+ else
+ # Others sections
+ section_change $i
+ fi
+ done
- # Change sections
- for i in $SECTION_LIST; do
- [ $VERBOSE -eq $on ] && echo "Change section $i"
- if [ "$i" = "slackdesc" ]; then
- # Special slackdesc section
- slackdesc_edit > $AUX_TMP
- mv $AUX_TMP $SLACKBUILD_TEMP
- else
- # Others sections
- section_change $i
- fi
- done
}
function slackdesc_edit {
- # Edit slackdesc section
- sed -n '1,/|-----/ { /<slackdesc>/ b; /|-----/ b; p; }' $SLACKBUILD_TEMP
- echo -n $PKG_NAME | tr [a-z+\-] " "
- echo -n "|-----handy-ruler"
- let N=18+${#PKG_NAME}
- for i in `seq $N $SLACKDESC_LEN`; do
- echo -n "-"
- done
- echo -en "|\n"
-
- sed -n '/#>slackdesc/,/#<slackdesc/ { /^#/ b; p }' $MKBUILD_NAME
- sed '1, /\[\[SLACK-DESC\]\]/ d' $SLACKBUILD_TEMP
+ # Edit slackdesc section
+ sed -n '1,/|-----/ { /<slackdesc>/ b; /|-----/ b; p; }' $SLACKBUILD_TEMP
+ echo -n $PKG_NAME | tr [a-z+\-] " "
+ echo -n "|-----handy-ruler"
+ let N=18+${#PKG_NAME}
+ for i in `seq $N $SLACKDESC_LEN`; do
+ echo -n "-"
+ done
+ echo -en "|\n"
+
+ sed -n '/#>slackdesc/,/#<slackdesc/ { /^#/ b; p }' $MKBUILD_NAME
+ sed '1, /\[\[SLACK-DESC\]\]/ d' $SLACKBUILD_TEMP
+
}
function section_change {
- # Change section lines
- [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+ # Change section lines
+ [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+
+ # Copy first half
+ eval "sed '1,/^<$1>/! d' $SLACKBUILD_TEMP > $AUX_TMP"
+ # Paste new section
+ eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#</ b; p }' $MKBUILD_NAME >> $AUX_TMP"
+ # Copy second halt
+ eval "sed '/^<\/$1>/,$ ! d' $SLACKBUILD_TEMP >> $AUX_TMP"
- # Copy first half
- eval "sed '1,/^<$1>/! d' $SLACKBUILD_TEMP > $AUX_TMP"
- # Paste new section
- eval "sed -n '/#>$1/,/#<$1/ { /^#>/ b; /^#</ b; p }' $MKBUILD_NAME >> $AUX_TMP"
- # Copy second halt
- eval "sed '/^<\/$1>/,$ ! d' $SLACKBUILD_TEMP >> $AUX_TMP"
+ mv $AUX_TMP $SLACKBUILD_TEMP
- mv $AUX_TMP $SLACKBUILD_TEMP
}
function make_slack_required {
- # Build slack-required file
- [ -e slack-required ] && mv slack-required slack-required.old
- [ -z "$SLACK_REQUIRED" ] && return 0
+ # Build slack-required file
+ [ -e slack-required ] && mv slack-required slack-required.old
+ [ -z "$SLACK_REQUIRED" ] && return 0
- echo -e "# Dependency list to $SRC_NAME\n#\n# dependency [condition] [version]]" > slack-required
+ echo -e "# Dependency list to $SRC_NAME\n#\n# dependency [condition] [version]]" > slack-required
+
+ echo $SLACK_REQUIRED | sed 's/:/\n/g' | while read i; do
+ REQ=`echo $i | awk '{ print $1 }'`
+ CON=`echo $i | awk '{ print $2 }'`
+ VER=`echo $i | awk '{ print $3 }'`
+ echo -e "$REQ\t\t$CON\t\t$VER" >> slack-required
+ done
- echo $SLACK_REQUIRED | sed 's/:/\n/g' | while read i; do
- REQ=`echo $i | awk '{ print $1 }'`
- CON=`echo $i | awk '{ print $2 }'`
- VER=`echo $i | awk '{ print $3 }'`
- echo -e "$REQ\t\t$CON\t\t$VER" >> slack-required
- done
}
function change_others_parameters {
- # Change others parameters started by '[[' in .mkbuild file
- 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
- done
+ # Change others parameters started by '[[' in .mkbuild file
+ sed '1,/#>>/ ! d' $MKBUILD_NAME | grep -v '^#' | 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
+ done
+
}
function get_slackbuild_path {
- # 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"
+ # Search for SlackBuild Path in order:
+ # - command line parameter;
+ # - mkbuild parameters file;
+ # - SlackBuild tree;
+ # - Gentool-portage internet tree;
+ # - default path (others/unclassified/$PKG_NAME).
- # Get in mkbuild
- [ -z $AUX_PATH ] && AUX_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
+ # Start AUX_PATH with command line parameter
+ AUX_PATH="$SLACKBUILD_PATH"
- # SlackBuild path in SlackBuild tree
- [ -z $AUX_PATH ] && AUX_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname` 2>/dev/null
+ # Get in mkbuild
+ [ -z $AUX_PATH ] && AUX_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
- # 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 in SlackBuild tree
+ [ -z $AUX_PATH ] && AUX_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname` 2>/dev/null
- # SlackBuild path default
- [ -z $AUX_PATH ] && AUX_PATH="others/unclassified/$PKG_NAME"
+ # SlackBuild path default
+ [ -z $AUX_PATH ] && AUX_PATH="others/unclassified/$PKG_NAME"
- # Down case SlackBuild path
- echo $AUX_PATH | tr [A-Z] [a-z]
+ # Down case SlackBuild path
+ echo $AUX_PATH | tr [A-Z] [a-z]
}
function apply_mkpatch {
- # Apply mkpatch if exist
- sed -n '/#p>/,/#p</ { /^#/ b; p }' $MKBUILD_NAME > $DIFF_FILE
- if [ -s $DIFF_FILE ]; then
- mkpatch $DIFF_FILE $SLACKBUILD_TEMP > $AUX_TMP || handle_error $?
- [ ! -s $AUX_TMP ] && handle_error 1
- cp $AUX_TMP $SLACKBUILD_TEMP
- [ $VERBOSE -eq $on ] && ( echo -e "\nApply mkpath ..."; cat $DIFF_FILE )
- fi
+ # Apply mkpatch if exist
+ sed -n '/#p>/,/#p</ { /^#/ b; p }' $MKBUILD_NAME > $DIFF_FILE
+ if [ -s $DIFF_FILE ]; then
+ mkpatch $DIFF_FILE $SLACKBUILD_TEMP > $AUX_TMP || handle_error $?
+ [ ! -s $AUX_TMP ] && handle_error 1
+ cp $AUX_TMP $SLACKBUILD_TEMP
+ [ $VERBOSE -eq $on ] && ( echo -e "\nApply mkpath ..."; cat $DIFF_FILE )
+ fi
+
}
# ----------------------------------------------------------------
# ------------------- svn functions ------------------------------
function commit_slackbuild {
- # Commit SlackBuild in local Slack.Sarava tree
- if [ $UID -ne 0 ]; then
- echo "Only root can commit SlackBuilds..."
- return 1
- fi
- echo -e "\nCommit $SLACKBUILD"
+ # Commit SlackBuild in local Slack.Sarava tree
+ if [ $UID -ne 0 ]; then
+ echo "Only root can commit SlackBuilds..."
+ return 1
+ fi
+ echo -e "\nCommit $SLACKBUILD"
+
+ # check SlackBuilds directory
+ [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync
- # check SlackBuilds directory
- [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync
+ # change to SlackBuilds directory
+ cd $SLACKBUILDS_DIR/
- # change to SlackBuilds directory
- cd $SLACKBUILDS_DIR/
+ # Add SlackBuild scripts
+ # check path
+ [ ! -e $SLACKBUILD_PATH ] && svn_mkdir $SLACKBUILD_PATH
+ # add SlackBuild
+ svn_add $SLACKBUILD $SLACKBUILD_PATH
- # Add SlackBuild scripts
- # check path
- [ ! -e $SLACKBUILD_PATH ] && svn_mkdir $SLACKBUILD_PATH
- # add SlackBuild
- svn_add $SLACKBUILD $SLACKBUILD_PATH
+ # check slack-required
+ # add slack-required
+ [ -e $WORK/slack-required ] && svn_add slack-required $SLACKBUILD_PATH
- # check slack-required
- # add slack-required
- [ -e $WORK/slack-required ] && svn_add slack-required $SLACKBUILD_PATH
+ cd $WORK
- cd $WORK
}
function commit_mkbuild {
- # Commit mkbuild in local mkbuild Slack.Sarava tree
- if [ $UID -ne 0 ]; then
- echo "Only root can commit mkbuild..."
- return 1
- fi
- echo -e "\nCommit $MKBUILD_NAME"
+ # Commit mkbuild in local mkbuild Slack.Sarava tree
+ if [ $UID -ne 0 ]; then
+ echo "Only root can commit mkbuild..."
+ return 1
+ fi
+ echo -e "\nCommit $MKBUILD_NAME"
- # check mkbuild directory
- [ ! -e $MKBUILDS_DIR ] && build_repo $MKBUILDS_DIR $MKBUILDS_SVN
+ # check mkbuild directory
+ [ ! -e $MKBUILDS_DIR ] && build_repo $MKBUILDS_DIR $MKBUILDS_SVN
- # Get mkbuild path in parameter file
- MKBUILD_PATH=$SLACKBUILD_PATH
+ # Get mkbuild path in parameter file
+ MKBUILD_PATH=$SLACKBUILD_PATH
- # change to mkbuilds directory
- cd $MKBUILDS_DIR/
+ # change to mkbuilds directory
+ cd $MKBUILDS_DIR/
- # Add mkbuild scripts
- # check path
- [ ! -e $MKBUILD_PATH ] && svn_mkdir $MKBUILD_PATH
- # add SlackBuild
- svn_add $MKBUILD_NAME $MKBUILD_PATH
+ # Add mkbuild scripts
+ # check path
+ [ ! -e $MKBUILD_PATH ] && svn_mkdir $MKBUILD_PATH
+ # add SlackBuild
+ svn_add $MKBUILD_NAME $MKBUILD_PATH
+
+ cd $WORK
- cd $WORK
}
function svn_mkdir {
- # svn make directory
- [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+ # svn make directory
+ [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
+
+ DIR_LIST=`echo $1 | tr '/' ' '`
- DIR_LIST=`echo $1 | tr '/' ' '`
+ DIR=""
+ for i in $DIR_LIST; do
+ DIR=$DIR/$i
+ [ ! -e ${DIR:1} ] && svn mkdir ${DIR:1}
+ done
- DIR=""
- for i in $DIR_LIST; do
- DIR=$DIR/$i
- [ ! -e ${DIR:1} ] && svn mkdir ${DIR:1}
- done
}
function svn_add {
- # svn add file
- [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
+ # svn add file
+ [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
+
+ # copy file
+ if [ -e $2/$1 ]; then
+ echo "$2/$1 exist. Overwriter it."
+ cp $WORK/$1 $2/
+ else
+ cp $WORK/$1 $2/
+ # add file to svn tree
+ svn add $2/$1
+ fi
- # copy file
- if [ -e $2/$1 ]; then
- echo "$2/$1 exist. Overwriter it."
- cp $WORK/$1 $2/
- else
- cp $WORK/$1 $2/
- # add file to svn tree
- svn add $2/$1
- fi
}
# ----------------------------------------------------------------
@@ -594,56 +611,59 @@ function svn_add {
function validate_parameter {
- # Validate parameter in .mkbuild file
- [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
+ # Validate parameter in .mkbuild file
+ [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
- if [ ! -z "$1" ]; then
- echo "$1"
+ if [ ! -z "$1" ]; then
+ echo "$1"
+ else
+ local STRING="`get_variable "$2"`"
+ if [ ! -z "$STRING" ]; then
+ echo "$STRING"
else
- local STRING="`get_variable "$2"`"
- if [ ! -z "$STRING" ]; then
- echo "$STRING"
- else
- echo "$3"
- fi
+ echo "$3"
fi
+ fi
+
}
function decompress_find {
- # Find decompressor program and test flag
- case $EXTENSION in
- 'gz'|'GZ')
- DECOMPRESSOR="gunzip"
- DECOMPRESSOR_TEST_FLAG="-t"
- ;;
- 'bz2'|'BZ2')
- DECOMPRESSOR="bunzip2"
- DECOMPRESSOR_TEST_FLAG="-t"
- ;;
- 'zip'|'ZIP')
- DECOMPRESSOR="unzip"
- DECOMPRESSOR_TEST_FLAG="-t"
- ;;
- *)
- handle_error $ERROR_MKBUILD_CONSTRUCTION "DECOMPRESSOR"
- ;;
- esac
+ # Find decompressor program and test flag
+ case $EXTENSION in
+ 'gz'|'GZ')
+ DECOMPRESSOR="gunzip"
+ DECOMPRESSOR_TEST_FLAG="-t"
+ ;;
+ 'bz2'|'BZ2')
+ DECOMPRESSOR="bunzip2"
+ DECOMPRESSOR_TEST_FLAG="-t"
+ ;;
+ 'zip'|'ZIP')
+ DECOMPRESSOR="unzip"
+ DECOMPRESSOR_TEST_FLAG="-t"
+ ;;
+ *)
+ handle_error $ERROR_MKBUILD_CONSTRUCTION "DECOMPRESSOR"
+ ;;
+ esac
+
}
function load_parameters {
- # Load Createpkg parameters
- SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`"
- [ ! -d $SLACKBUILDS_DIR ] && mkdir -p $SLACKBUILDS_DIR
+ # Load Createpkg parameters
+ SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`"
+ [ ! -d $SLACKBUILDS_DIR ] && mkdir -p $SLACKBUILDS_DIR
+
+ MKBUILDS_DIR="`eval_parameter MKBUILDS_DIR /var/simplaret/mkbuilds`"
+ [ ! -d $SLACKBUILDS_DIR ] && mkdir -p $SLACKBUILDS_DIR
- MKBUILDS_DIR="`eval_parameter MKBUILDS_DIR /var/simplaret/mkbuilds`"
- [ ! -d $SLACKBUILDS_DIR ] && mkdir -p $SLACKBUILDS_DIR
+ SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_DIR svn://slack.sarava.org/slackbuilds`"
+ MKBUILDS_SVN="`eval_parameter MKBUILDS_SVN svn://slack.sarava.org/mkbuilds`"
- SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_DIR svn://slack.sarava.org/slackbuilds`"
- MKBUILDS_SVN="`eval_parameter MKBUILDS_SVN svn://slack.sarava.org/mkbuilds`"
+ COLOR_MODE="`eval_parameter COLOR_MODE none`"
- COLOR_MODE="`eval_parameter COLOR_MODE none`"
}
# ----------------------------------------------------------------
@@ -696,193 +716,191 @@ error_codes
set_parameters "$@"
[ $VERBOSE -eq $on ] && echo -e "$PROG_NAME version $PROG_VERSION\n"
-case $ACTION in
+if [ ! -z $MKBUILD_NAME ]; then
+ 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
+ # 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
- # 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
+ 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"
;;
'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=${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_others_parameters
-
- # Commit SlackBuild
- [ $COMMIT_SLACKBUILD -eq $on ] && commit_slackbuild
-
- # Commit mkbuild
- [ $COMMIT_MKBUILD -eq $on ] && commit_mkbuild
+ # 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=${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_others_parameters
+
+ # Commit SlackBuild
+ [ $COMMIT_SLACKBUILD -eq $on ] && commit_slackbuild
+
+ # Commit mkbuild
+ [ $COMMIT_MKBUILD -eq $on ] && commit_mkbuild
;;
-esac
+ esac
+fi
# Clear temporary files
[ $VERBOSE -eq $on ] && echo -e "\nRemove temporary files ..."