diff options
Diffstat (limited to 'branches')
-rw-r--r-- | branches/0.6/mkbuild/sample-Pyrex-large.mkbuild | 9 | ||||
-rwxr-xr-x | branches/0.6/src/mkbuild | 107 |
2 files changed, 80 insertions, 36 deletions
diff --git a/branches/0.6/mkbuild/sample-Pyrex-large.mkbuild b/branches/0.6/mkbuild/sample-Pyrex-large.mkbuild index 0686d69..e052eb3 100644 --- a/branches/0.6/mkbuild/sample-Pyrex-large.mkbuild +++ b/branches/0.6/mkbuild/sample-Pyrex-large.mkbuild @@ -85,12 +85,15 @@ #[[SIGNING KEY URL]]="" #[[PATCH FILES]]="" +# SlackBuild model +[[SLACKBUILD MODEL]]="generic.mkSlackBuild" + +# SlackBuild PATH in Slack.Sarava tree +[[SLACKBUILD PATH]]="dev/python/pyrex" + #--------------------- # SlackBuild Sections #--------------------- -# SlackBuild model -[[SLACKBUILD MODEL]]="generic.mkSlackBuild" -# # Default enable sections: # head, set_variables, slkflags, start_structure, untar_source, # make_package, install_package, build_package diff --git a/branches/0.6/src/mkbuild b/branches/0.6/src/mkbuild index fce2533..365bcd0 100755 --- a/branches/0.6/src/mkbuild +++ b/branches/0.6/src/mkbuild @@ -1,16 +1,26 @@ #!/bin/bash # -# Script para gerar SlackBuild -# Por Rudson R. Alves +# mkbuild: SlackBuild scripts maker +# feedback: rudsonaalves at yahoo.com.br | gpl # -# Este script auxilia a criação de SlackBuilds, com o modelo -# do Luiz do Sarava Linux +# mkbuild is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or any later version. # -# SlackBuilds são scripts utilizados no Slackware para gerar -# pacotes tgz. +# mkbuild is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR +# A PARTICULAR PURPOSE. See the GNU General Public License for more details. # -# Version 0.9.8 -PROG_VERSION=0.9.8 +# You should have received a copy of the GNU General Public License along with +# 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 +# +# Version 0.9.9 +PROG_VERSION=0.9.9 +PROG_NAME=`basename $0` #-------------------------------------------------------------------- # Functions @@ -58,6 +68,8 @@ DESCRIPTION commit SlackBuilds in local svn tree -v, --version program version + -V, --verbose + print debug information EXAMPLES mkbuild --prefix /usr/local pyrex.mkbuild @@ -116,29 +128,18 @@ function mkbuild_error { exit $1 } -function is_number { - - # Check if argument is a number - local -i int - if [ $# -eq 0 ]; then - return 1 - else - (let int=$1) 2>/dev/null - return $? # Exit status of the let thread - fi -} - function set_parameters { # Get and set mkbuild variables with parameters input # Use: set_parameters $@ # where $@ are the parameters input # - ALL_PAR=( $@ ) # carrega todos os parâmetros - N_PAR=$# # carrega o número de parâmetros + ALL_PAR=( $@ ) # all parameters + N_PAR=$# # number of parameters + + i=0 # start counter - i=0 # inicia o contador - # Checa todos os parâmetros passados + # analyze all the parameters while [ $i -lt $N_PAR ]; do # get parameter[i] PAR=${ALL_PAR[$i]} @@ -157,7 +158,11 @@ function set_parameters { ;; '-v'|'--version') # Show program version - echo -e "\nmkbuild version $PROG_VERSION\n" && exit 0 + echo -e "\n$PROG_NAME version $PROG_VERSION\n" && exit 0 + ;; + '-V' | '--verbose') + # Enable verbose mode + VERBOSE=1 ;; '-a'|'--author') # Enter with author name @@ -237,7 +242,7 @@ function get_variable { [ $# -ne 1 ] && mkbuild_error $ERROR_PROGRAM [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0 - grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2 -d\" + grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2- -d= | tr -d '\"' } function edit_file { @@ -298,6 +303,7 @@ function clear_files { # Remove temporary files rm $AUX_TMP 2>/dev/null rm $SLACKBUILD_TEMP 2>/dev/null + chmod 755 *.SlackBuild } function set_status { @@ -349,7 +355,7 @@ function build_slackbuild { function section_edit { - # Edit sections by change you values + # Edits a section substituting its content [ -z $MK_INPUT_FILE ] && return 0 SECTION_LIST=`grep '^#>[a-z]' $MK_INPUT_FILE | cut -c3-` @@ -417,9 +423,9 @@ function make_slack_required { done } -function change_others_fields { +function change_others_parameters { - # Change others fields started by '[[' in .mkbuild file + # Change others parameters started by '[[' in .mkbuild file grep '\[\[[A-Za-z]' $MK_INPUT_FILE | while read i; do CHANGE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\1/'`" VALUE="`echo $i | sed 's/\[\[\(.*\)\]\]=\"\(.*\)\"/\2/'`" @@ -430,10 +436,16 @@ function change_others_fields { function commit_slackbuild { # Commit SlackBuild in local Slack.Sarava tree + if [ $UID -ne 0 ]; then + echo "Only root can commit SlackBuilds..." + return 1 + fi + # Get SlackBuild path SLACKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""` if [ $? != 0 ]; then # Mount SlackBuild path + [ $VERBOSE -ne 0 ] && echo -e "\nFind SlackBuild PATH in Slack.Sarava tree..." AUX=`lynx -dump http://gentoo-portage.com/Search?search=$PKG_NAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "` [ ! -z $AUX ] && SLACKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || SLACKBUILD_PATH="others/unclassified/$PKG_NAME" fi @@ -546,6 +558,7 @@ SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf" WORK=`pwd` LANG=en_US COMMIT=0 +VERBOSE=0 if [ -f "$COMMON" ]; then source $COMMON @@ -554,7 +567,7 @@ else mk_exit 0 fi -# createpkg and mkbuild section +# Createpkg and mkbuild section SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/slackbuilds`" #----------------------------- @@ -575,17 +588,22 @@ error_codes # Configure input parameters set_parameters $@ +[ $VERBOSE -ne 0 ] && echo -e "$PROG_NAME version $PROG_VERSION\n" + # Get values # Author name AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"} [ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR" +[ $VERBOSE -ne 0 ] && 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"`" || mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS" +[ $VERBOSE -ne 0 ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\"" # URL program URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || mkbuild_error $ERROR_CONSTRUCTION "URL" +[ $VERBOSE -ne 0 ] && 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 @@ -594,74 +612,96 @@ if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT else URL_BASE=$URL fi +[ $VERBOSE -ne 0 ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\"" # Extension EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "EXTENSION" +[ $VERBOSE -ne 0 ] && echo "[[EXTENSION]]=\"$EXTENSION\"" # Build archteture ARCH=`validate_parameter "$ARCH" "ARCH" "i486"` +[ $VERBOSE -ne 0 ] && echo "[[ARCH]]=\"$ARCH\"" # Source name STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "SOURCE NAME" +[ $VERBOSE -ne 0 ] && 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 -ne 0 ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\"" # Version STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'` VERSION=`validate_parameter "$VERSION" "VERSION" $STR_MOUNT` || mkbuild_error $ERROR_CONSTRUCTION "VERSION" +[ $VERBOSE -ne 0 ] && echo "[[VERSION]]=\"$VERSION\"" # Construction source name string CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`" +[ $VERBOSE -ne 0 ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\"" # Build Source Name [ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"` +[ $VERBOSE -ne 0 ] && echo "SOURCE_NAME=\"$SOURCE_NAME\"" # Decompressor program and test flag DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""` || decompress_find +[ $VERBOSE -ne 0 ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\"" DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR TEST FLAG" +[ $VERBOSE -ne 0 ] && 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 -ne 0 ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\"" # ./configure option OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""` +[ $VERBOSE -ne 0 ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\"" # PREFIX PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"` +[ $VERBOSE -ne 0 ] && echo "[[PREFIX]]=\"$PREFIX\"" # Number of jobs NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""` +[ $VERBOSE -ne 0 ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\"" # Make slack-required file. SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""` +[ $VERBOSE -ne 0 ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\"" # SlackBuild model MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"` +[ $VERBOSE -ne 0 ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\"" # # Start build SlackBuild SLACKBUILD=${PKG_NAME}.SlackBuild SLACKBUILD_TEMP=$SLACKBUILD.tmp cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP +[ $VERBOSE -ne 0 ] && echo -en "\nStart SlackBuild make" -# Change Strings from model +# Change strings from model start_build $SLACKBUILD_TEMP +[ $VERBOSE -ne 0 ] && echo -en "\nEdit mkSlackBuild model .." # On/Off sections activate_sections +[ $VERBOSE -ne 0 ] && echo -en ".\nEnable and desable sections .." # Change sections section_edit +[ $VERBOSE -ne 0 ] && echo -en ".\nChange sections .." # Remove off sections build_slackbuild +[ $VERBOSE -ne 0 ] && echo -en ".\nRemove off sections .." # Make slack-required file make_slack_required +[ $VERBOSE -ne 0 ] && echo -en ".\nMake slack-required file .." if [ -e slack-required ]; then DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`" @@ -671,10 +711,11 @@ else fi # Others changes -change_others_fields +change_others_parameters +[ $VERBOSE -ne 0 ] && echo -en ".\nEdit others [[]] parameters .." # Clear temporary files clear_files +[ $VERBOSE -ne 0 ] && echo -e ".\nRemove temporary files ..." [ $COMMIT -eq 1 ] && commit_slackbuild - |