aboutsummaryrefslogtreecommitdiff
path: root/trunk/src
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src')
-rw-r--r--trunk/src/createpkg51
-rwxr-xr-xtrunk/src/lspkg2
-rwxr-xr-xtrunk/src/mkbuild46
3 files changed, 60 insertions, 39 deletions
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