]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
Várias alterações. Ver trunk/doc/CHANGELOG
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Sat, 1 Dec 2007 01:16:52 +0000 (01:16 +0000)
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Sat, 1 Dec 2007 01:16:52 +0000 (01:16 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@461 04377dda-e619-0410-9926-eae83683ac58

trunk/doc/CHANGELOG
trunk/lib/common.sh
trunk/mkbuild/generic.mkSlackBuild
trunk/mkbuild/model.mkbuild
trunk/simplepkg.SlackBuild
trunk/src/createpkg
trunk/src/lspkg
trunk/src/mkbuild

index c00c57282b118dcb34e3cfd492146ec176f17859..0b9565b8de1b3d4c4155f43ad36d5adcd67f6ce5 100644 (file)
@@ -1,6 +1,27 @@
 simplepkg changelog
 ===================
 
+0.6pre1-11
+  - generic.mkSlackBuild-0.9.0:
+    - added [[BUILD NUMBER]] parameter
+
+  - model.mkbuild-0.9.0:
+      - added [[BUILD NUMBER]]="" parameter
+
+  - createpkg-1.1.9:
+    - added option --all, to build all SlackBuilds in repository
+    - added number of parameters check
+    - integrate handle_error with common.sh
+
+  - mkbuild-1.1.9:
+    - added [[BUILD NUMBER]]="" parameter support
+    - bugfix: removed [] from is_number function call
+    - correction of some codes of error and calls the handle_error function
+
+  - common.sh
+    - ERROR_PAR_NUMBER - incorrect number of parameters
+    - ERROR_COMMON_NOT_FOUND - file common.sh not found
+
 0.6pre1-10
 
   - simplepkg.conf:
@@ -39,7 +60,7 @@ simplepkg changelog
     - called to svn functions change to send SLACKBUILDS_DIR and SLACKBUILDS_SVN variables
     - error 2 (usage function) change to usage function call
 
-  - lspkg:
+  - lspkg-0.4:
     - added error code 1 to fail exit
 
   - mkbuild-1.1.8:
index ef5d62a5786006f6cad21f467f423bfcec57de36..3db98a87c64e8976a2729252262f509f9d00b0eb 100644 (file)
@@ -711,6 +711,9 @@ function error_codes {
 
   # Commum error codes
   ERROR_FILE_NOTFOUND=100                   # file not found
+  ERROR_NOT_NUMBER=101                      # argument is not a number
+  ERROR_PAR_NUMBER=102                      # incorrect number of parameters
+  ERROR_COMMON_NOT_FOUND=103                # common.sh not found
 
   # Createpkg error codes
   ERROR_CREATEPKG_INSTALLPKG=200            # installpkg error
@@ -771,10 +774,18 @@ function handle_error {
       eecho $error "$BASENAME: error downloading $2 source from version control system" ;;
     $ERROR_MKDIR)
       eecho $error "$BASENAME: make directory $2 error, aborting" ;;
+
     #
     # General errors
     $ERROR_FILE_NOTFOUND)
       eecho $error "$BASENAME: file $2 not found!" ;;
+    $ERROR_NOT_NUMBER)
+      eecho $error "$BASENAME: $2 need a number argument" ;;
+    $ERROR_PAR_NUMBER)
+      eecho $error "$BASENAME: incorrect number of parameters" ;;
+    $ERROR_COMMON_NOT_FOUND)
+      eecho $error "$BASENAME: file $COMMON_SH not found. Check your $BASENAME installation"
+
     #
     # Createpkg errors
     $ERROR_CREATEPKG_INSTALLPKG)
@@ -783,6 +794,7 @@ function handle_error {
       eecho $error "$BASENAME: dependency solve error, aborting" ;;
     $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND)
       eecho $error "$BASENAME: SlackBuild or package not found" ;;
+
     #
     # Mkbuild errors
     $ERROR_MKBUILD_CONSTRUCTION)
@@ -791,6 +803,7 @@ function handle_error {
       eecho $error "$BASENAME: Program logical error." ;;
     $ERROR_MKBUILD_INPUT_PAR)
       eecho $error "$BASENAME: Input parameter $2 error. See \"mkbuild --help\"." ;;
+
     #
     # Others errors
     *)
index 6e9e2220f9b054c2bb73aafe50cff0ab2f748e13..0a25211dea9e1c8f950cc5dbc873af172c8bcf79 100644 (file)
@@ -1,9 +1,9 @@
-###################################################
+#################################################################
 ## Generic template for SlackBuilds
 ##
-## Version 0.8.1 - Luis ( luis at riseup d0t net)
-##
-###################################################
+## Version 0.9.0 - Luis ( luis at riseup d0t net)
+##                 Alves ( rudsonalves at yahoo d0t com d0t br )
+#################################################################
 #!/bin/bash
 <head> off
 #
@@ -44,7 +44,7 @@ PKG_NAME="[[PACKAGE NAME]]"
 ARCH=${ARCH:=[[ARCH]]}
 SRC_VERSION=${VERSION:=[[VERSION]]}
 PKG_VERSION="$(echo "$SRC_VERSION" | tr '[[:blank:]-]' '_')"
-BUILD=${BUILD:=1[[SLACKBUILD AUTHOR INITIALS]]}
+BUILD=${BUILD:=[[BUILD NUMBER]][[SLACKBUILD AUTHOR INITIALS]]}
 SRC_DIR=${SRC_DIR:=$CWD}/$PKG_NAME
 TMP=${TMP:=/tmp}
 PKG=${PKG:=$TMP/package-$PKG_NAME}
index ee2bb991d6773468aeddfce5e270d4847cbba4eb..edd33c65924e88989ab1d77d91cbe1aab4bc4b60 100644 (file)
@@ -1,3 +1,8 @@
+#################################################################
+## Generic template for Mkbuild
+##
+## Version 0.9.0 - Alves ( rudsonalves at yahoo d0t com d0t br )
+#################################################################
 #--------------------
 # Personal variables
 #--------------------
 # Auto-set, get EXTENSION from URL: http://.../$SRC_NAME-$VERSION.tar.$EXTENSION'
 [[EXTENSION]]=""
 
+#
+# Build number.
+# Auto-set to default 1
+[[BUILD NUMBER]]=""
+
 #
 # Source Name construction string
 # Default value is: $SRC_NAME-$VERSION.tar.$EXTENSION
index c6714d24d5894e3e7331e999f5cf8e4fee4e2094..7ddaf304ac4e3c30eee35673893114e63ff3888a 100755 (executable)
@@ -18,7 +18,7 @@
 PACKAGE="simplepkg"
 PACK_DIR="package-$PACKAGE"
 BUILD=${BUILD:=1rha}
-VERSION="0.6pre10"
+VERSION="0.6pre11"
 ARCH="noarch"
 LIBEXEC="/usr/libexec/$PACKAGE"
 BINDIR="/usr/bin"
index 2f647a7ddc03027a0b0e0f404e2fdc1d72dada0e..a08750e5dceedafc98bf96694ecdcdc6228cb47b 100644 (file)
@@ -26,7 +26,7 @@
 #               Createpkg functions
 #---------------------------------------------------
 
-CREATEPKG_VERSION="1.1.8"
+CREATEPKG_VERSION="1.1.9"
 
 function usage {
 
@@ -42,6 +42,18 @@ function usage {
     exit
 }
 
+function build_all_slackbuild {
+
+    # Build all SlackBuilds in repository
+    createpkg --sync
+
+    cd $SLACKBUILDS_DIR
+    LIST=`find . -name *.SlackBuild | sed 's/.*\/\(.*\)\.SlackBuild$/\1/' | sort | uniq`
+    for i in $LIST; do
+        [ ! lspkg $i >/dev/null ] && createpkg -i $i
+    done
+}
+
 function check_config {
 
     # check the configuration
@@ -66,6 +78,7 @@ function check_config {
 function solve_dep {
 
     # Solve dependency
+    [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
     local PACK="$1"
     local COND="$2"
     local VER="$3"
@@ -82,20 +95,15 @@ function solve_dep {
             eecho $messag "$BASENAME: processing $PACKAGE dependency $PACK"
             SYNC=$no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK
 
-            # check if the package was built and installed
-            EXIT_CODE="$?"
+            # Check if the package was built and installed
+            EXIT_CODE=$?
 
-            if [ "$EXIT_CODE" == "5" ]; then
-                # exit code 5 == slackbuild not found
-                # try to use simplaret
+            if [ $EXIT_CODE -eq $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND ]; then
+                # Try to use simplaret
                 ARCH=$CREATE_ARCH simplaret --update
                 ARCH=$CREATE_ARCH simplaret --install $PACK
-                EXIT_CODE="$?"
-                if [ "$EXIT_CODE" != "0" ]; then
-                    handle_error $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND $PACK
-                fi
-
-            elif [ "$EXIT_CODE" != "0" ]; then
+                [ $? -ne 0 ] && handle_error $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND $PACK
+            elif [ $EXIT_CODE -ne 0 ]; then
                 handle_error $EXIT_CODE $PACK
             fi
 
@@ -107,6 +115,7 @@ function solve_dep {
 function find_slackbuild {
 
     # Find SlackBuild script in the repository
+    [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
     find $SLACKBUILDS_DIR -iname $1.SlackBuild
 
 }
@@ -243,16 +252,21 @@ INSTALL=$off
 NO_DEPS=$off
 
 case $1 in
+    '--all'|'-a')
+        # build all SlackBuilds in repository
+        build_all_slackbuild
+        exit 0
+    ;;
     '--search'|'-s')
         [ $# -ne 2 ] && usage   # two parameters is required
         find_slackbuild $2
-        exit
+        exit 0
     ;;
     '--info'|'-f')
         [ $# -ne 2 ] && usage   # two parameters is required
         PKG_PATH=`find_slackbuild $2`
         info_builds
-        exit
+        exit 0
     ;;
     '--install'|'-i')
         [ $# -ne 2 ] && usage   # two parameters is required
@@ -315,7 +329,6 @@ if [ "`echo $BUILD_SCRIPT | wc -w`" -gt 1 ]; then
     BUILD_SCRIPT=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | grep "/$PACKAGE.SlackBuild"`
     PS3="$AUX"
 else
-    #PACKAGE=`echo $BUILD_SCRIPT | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'`
     PACKAGE=`basename $BUILD_SCRIPT .SlackBuild`
 fi
 
@@ -332,7 +345,7 @@ elif [ -f "$SCRIPT_BASE/slack-required" ]; then
 fi
 
 if [ ! -z "$SLACK_REQUIRED" -a $NO_DEPS -ne $on ]; then
-    # this routine checks for dependencies in package's slack-required
+    # This routine checks for dependencies in package's slack-required
     ( grep '^[^#]' $SLACK_REQUIRED | while read dep; do
         if [ ! -z "$dep" ]; then
             PROGRAM="`echo $dep | awk '{ print $1 }'`"
@@ -342,10 +355,8 @@ if [ ! -z "$SLACK_REQUIRED" -a $NO_DEPS -ne $on ]; then
         fi
         true
     done )
-    if [ $? -ne 0 ]; then
-        eecho $messag "$BASENAME: dependency solve error"
-        exit 1
-    fi
+    [ $? -ne 0 ] && handle_error $error $ERROR_CREATEPKG_DEPENDENCY
+
     eecho $messag "$BASENAME: done checking for $PACKAGE dependencies"
 else
     eecho $messag "$BASENAME: no unmet dependencies for $PACKAGE"
index c62399c108a0c9adedcb4fa5068724b64c596ce8..e772fb300dc7fd474b48ce2a9199c01540409532 100755 (executable)
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# lspkg v0.3: view installed and contents of slackware packages
+# lspkg v0.4: view installed and contents of slackware packages
 #
 # feedback: rhatto at riseup.net | gpl
 #
index 2ff24351ba16f97df28fea0582f863973c813cbb..f9281a2b5a609174fefefd008e559a9ef4e2119b 100755 (executable)
@@ -18,7 +18,7 @@
 #
 # Based in model generic.SlackBuild of Luiz
 #
-# Version 1.1.9
+# Version:
 PROG_VERSION=1.1.9
 PROG_NAME=`basename $0`
 
@@ -44,6 +44,8 @@ DESCRIPTION
                 author name
             -ai, --author_initials <initials>
                 author signature
+            -bn, --build-number
+                change build number
             -cs, --const_string <string>
                 construction string to source name
             -u, --url <url_address>
@@ -110,6 +112,12 @@ function set_parameters {
     # Parameters analyze
     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
@@ -179,7 +187,7 @@ function set_parameters {
                 let i++
                 NUMJOBS=$2
                 [ ${NUMJOBS:0:1} = "-" ] && handle_error $ERROR_MKBUILD_INPUT_PAR NUMJOBS
-                [ ! is_number $NUMJOBS ] &&  handle_error $ERROR_MKBUILD_INPUT_PAR NUMJOBS
+                ! is_number $NUMJOBS &&  handle_error $ERROR_NOT_NUMBER NUMJOBS
                 NUMJOBS="-j$NUMJOBS"
                 shift
             ;;
@@ -231,7 +239,7 @@ function set_parameters {
 function get_variable {
 
     # Get variable value from mkbuild file (MK_INPUT_FILE)
-    [ $# -ne 1 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
     [ -z $MK_INPUT_FILE ] && echo "Warning: no [mkbuild_file]." && return 0
 
     grep "^\[\[${1}\]\]" $MK_INPUT_FILE | cut -f2- -d= | sed -e 's/^"//' -e 's/"$//'
@@ -243,7 +251,7 @@ function edit_file {
     local STR_OLD
     local STR_NEW
 
-    [ $# -ne 3 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -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"
@@ -256,7 +264,7 @@ function edit_file_full {
     local STR_OLD
     local STR_NEW
 
-    [ $# -ne 3 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -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"
@@ -266,7 +274,7 @@ function edit_file_full {
 function start_build  {
 
     # Build initial sections
-    [ $# -ne 1 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
 
     edit_file "SLACKBUILD AUTHOR" "$AUTHOR" $1
     edit_file "SLACKBUILD AUTHOR INITIALS" $AUTHOR_INITIALS $1
@@ -287,6 +295,7 @@ function start_build  {
     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_full "\$EXTENSION" "$EXTENSION" $1
 }
@@ -305,7 +314,7 @@ function set_status {
     # $1 - Section
     # $2 - Status
     # $3 - file
-    [ $# -ne 3 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -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
@@ -320,7 +329,7 @@ function get_status {
     # Get status from section
     # $1 - Section
     # $2 - file
-    [ $# -ne 2 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
     eval "sed '/^<$1>.*$/! d' $2"
 }
 
@@ -393,7 +402,7 @@ function slackdesc_edit {
 function section_change {
 
     # Change section lines
-    [ $# -ne 1 ] && handle_error $ERROR_MKBUILD_PROGRAM
+    [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
 
     # Copy first half
     eval "sed '1,/^<$1>/! d' $SLACKBUILD_TEMP > $AUX_TMP"
@@ -526,7 +535,7 @@ function commit_mkbuild {
 function svn_mkdir {
 
     # svn make directory
-    [ $# -ne 1 ] && handle_error 0
+    [ $# -ne 1 ] && handle_error $ERROR_PAR_NUMBER
 
     DIR_LIST=`echo $1 | tr '/' ' '`
 
@@ -540,7 +549,7 @@ function svn_mkdir {
 function svn_add {
 
     # svn add file
-    [ $# -ne 2 ] && handle_error 0
+    [ $# -ne 2 ] && handle_error $ERROR_PAR_NUMBER
 
     # copy file
     if [ -e $2/$1 ]; then
@@ -559,16 +568,16 @@ function svn_add {
 function validate_parameter {
 
     # Validate parameter in .mkbuild file
-    [ $# -ne 3 ] && return 1
+    [ $# -ne 3 ] && handle_error $ERROR_PAR_NUMBER
 
     if [ ! -z "$1" ]; then
         echo "$1"
     else
         local STRING="`get_variable "$2"`"
-        if [ -z "$STRING" ]; then
-            echo "$3"
-        else
+        if [ ! -z "$STRING" ]; then
             echo "$STRING"
+        else
+            echo "$3"
         fi
     fi
 }
@@ -621,8 +630,7 @@ LANG=en_US
 if [ -f "$COMMON_SH" ]; then
   source $COMMON_SH
 else
-  echo "error: file $COMMON_SH not found. Check your $BASENAME installation"
-  handle_error 0
+  handle_error $ERROR_COMMON_NOT_FOUND
 fi
 
 # Start constants
@@ -703,6 +711,8 @@ else
     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\""
@@ -761,7 +771,7 @@ else
 
     # Number of jobs
     NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""`
-    [ `is_number $NUMJOBS` ] && NUMJOBS="-j${NUMJOBS}"
+    is_number $NUMJOBS && NUMJOBS="-j${NUMJOBS}"
     [ $VERBOSE -eq $on ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
 
     # Make slack-required file