aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-12-01 01:16:52 +0000
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>2007-12-01 01:16:52 +0000
commit76cb2a284631a2354a368320234b16f4316fd137 (patch)
tree5b945dc8435be4407f3d7abec746510ac5586b05 /trunk
parent246475541fd2d6cb4a5e96010191f2ebaf841a23 (diff)
downloadsimplepkg-76cb2a284631a2354a368320234b16f4316fd137.tar.gz
simplepkg-76cb2a284631a2354a368320234b16f4316fd137.tar.bz2
Várias alterações. Ver trunk/doc/CHANGELOG
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@461 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk')
-rw-r--r--trunk/doc/CHANGELOG23
-rw-r--r--trunk/lib/common.sh13
-rw-r--r--trunk/mkbuild/generic.mkSlackBuild10
-rw-r--r--trunk/mkbuild/model.mkbuild10
-rwxr-xr-xtrunk/simplepkg.SlackBuild2
-rw-r--r--trunk/src/createpkg51
-rwxr-xr-xtrunk/src/lspkg2
-rwxr-xr-xtrunk/src/mkbuild46
8 files changed, 111 insertions, 46 deletions
diff --git a/trunk/doc/CHANGELOG b/trunk/doc/CHANGELOG
index c00c572..0b9565b 100644
--- a/trunk/doc/CHANGELOG
+++ b/trunk/doc/CHANGELOG
@@ -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:
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh
index ef5d62a..3db98a8 100644
--- a/trunk/lib/common.sh
+++ b/trunk/lib/common.sh
@@ -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
*)
diff --git a/trunk/mkbuild/generic.mkSlackBuild b/trunk/mkbuild/generic.mkSlackBuild
index 6e9e222..0a25211 100644
--- a/trunk/mkbuild/generic.mkSlackBuild
+++ b/trunk/mkbuild/generic.mkSlackBuild
@@ -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}
diff --git a/trunk/mkbuild/model.mkbuild b/trunk/mkbuild/model.mkbuild
index ee2bb99..edd33c6 100644
--- a/trunk/mkbuild/model.mkbuild
+++ b/trunk/mkbuild/model.mkbuild
@@ -1,3 +1,8 @@
+#################################################################
+## Generic template for Mkbuild
+##
+## Version 0.9.0 - Alves ( rudsonalves at yahoo d0t com d0t br )
+#################################################################
#--------------------
# Personal variables
#--------------------
@@ -38,6 +43,11 @@
[[EXTENSION]]=""
#
+# Build number.
+# Auto-set to default 1
+[[BUILD NUMBER]]=""
+
+#
# Source Name construction string
# Default value is: $SRC_NAME-$VERSION.tar.$EXTENSION
[[SOURCE NAME CONSTRUCTION STRING]]="$SRC_NAME-$VERSION.tar.$EXTENSION"
diff --git a/trunk/simplepkg.SlackBuild b/trunk/simplepkg.SlackBuild
index c6714d2..7ddaf30 100755
--- a/trunk/simplepkg.SlackBuild
+++ b/trunk/simplepkg.SlackBuild
@@ -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"
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 2f647a7..a08750e 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -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"
diff --git a/trunk/src/lspkg b/trunk/src/lspkg
index c62399c..e772fb3 100755
--- a/trunk/src/lspkg
+++ b/trunk/src/lspkg
@@ -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
#
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index 2ff2435..f9281a2 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -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