aboutsummaryrefslogtreecommitdiff
path: root/trunk
diff options
context:
space:
mode:
Diffstat (limited to 'trunk')
-rw-r--r--trunk/src/createpkg135
-rwxr-xr-xtrunk/src/mkbuild4
2 files changed, 75 insertions, 64 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 756b472..e87b37a 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -31,7 +31,7 @@
# Createpkg functions
#---------------------------------------------------
-CREATEPKG_VERSION="1.0.3"
+CREATEPKG_VERSION="1.0.4"
function error_codes {
@@ -55,6 +55,16 @@ function error_codes {
SCRIPT_OR_PACKAGE_NOT_FOUND=202 # Script or package not found
}
+function eecho {
+
+ # echoes a message
+ # usage: eecho <message-type> <message>
+ # message-type can be: commun, messag, error, normal
+
+ echo -e "${1}${2}${normal}"
+
+}
+
function handle_error {
# This function deals with internal createpkg errors
@@ -77,40 +87,40 @@ function handle_error {
# Exit codes
case $1 in
2) usage ;;
- 3) echo -e "$CL_ALERT $BASENAME: could not update the repository $2 $CL_OFF" ;;
- 4) echo -e "$CL_ALERT $BASENAME: could not create folder $2 $CL_OFF" ;;
- 5) echo -e "$CL_ALERT $BASENAME: script not found for $2 $CL_OFF" ;;
+ 3) eecho $alert "$BASENAME: could not update the repository $2" ;;
+ 4) eecho $alert "$BASENAME: could not create folder $2" ;;
+ 5) eecho $alert "$BASENAME: script not found for $2" ;;
$ERROR_WGET)
- echo -e "$CL_ERROR $BASENAME: error downloading source/package for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error downloading source/package for $2" ;;
$ERROR_MAKE)
- echo -e "$CL_ERROR $BASENAME: error compiling $2 source code $CL_OFF" ;;
+ eecho $error "$BASENAME: error compiling $2 source code" ;;
$ERROR_INSTALL)
- echo -e "$CL_ERROR $BASENAME: error installing $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error installing $2" ;;
$ERROR_MD5)
- echo -e "$CL_ERROR $BASENAME: error on source code integrity check for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error on source code integrity check for $2" ;;
$ERROR_CONF)
- echo -e "$CL_ERROR $BASENAME: error configuring the source code for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error configuring the source code for $2" ;;
$ERROR_HELP)
exit 0 ;; # its supposed to never happen here :P
$ERROR_TAR)
- echo -e "$CL_ERROR $BASENAME: error decompressing source code for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error decompressing source code for $2" ;;
$ERROR_MKPKG)
- echo -e "$CL_ERROR $BASENAME: error creating package $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error creating package $2" ;;
$ERROR_GPG)
- echo -e "$CL_ERROR $BASENAME: error verifying GPG signature the source code for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error verifying GPG signature the source code for $2" ;;
$ERROR_PATCH)
- echo -e "$CL_ERROR $BASENAME: error patching the source code for $2 $CL_OFF" ;;
+ eecho $error "$BASENAME: error patching the source code for $2" ;;
$ERROR_VCS)
- echo -e "$CL_ERROR $BASENAME: error downloading $2 source from version control system $CL_OFF" ;;
+ eecho $error "$BASENAME: error downloading $2 source from version control system" ;;
$ERROR_MKDIR)
- echo -e "$CL_ERROR $BASENAME: make directory $2 error, aborting $CL_OFF" ;;
+ eecho $error "$BASENAME: make directory $2 error, aborting" ;;
$ERROR_INSTPKG)
- echo -e "$CL_ERROR $BASENAME: install package $2 error, aborting $CL_OFF" ;;
+ eecho $error "$BASENAME: install package $2 error, aborting" ;;
$ERROR_DEPEN)
- echo -e "$CL_ERROR $BASENAME: dependency solve error, aborting $CL_OFF" ;;
- *) echo -e "$CL_ERROR $BASENAME: unknown error or user interrupt $CL_OFF" ;;
+ eecho $error "$BASENAME: dependency solve error, aborting" ;;
+ *) eecho $error "$BASENAME: unknown error or user interrupt" ;;
$SCRIPT_OR_PACKAGE_NOT_FOUND)
- echo -e "$CL_ERROR $BASENAME: SlackBuild or package not found $CL_OFF" ;;
+ eecho $error "$BASENAME: SlackBuild or package not found" ;;
esac
exit $1
@@ -131,14 +141,14 @@ function build_repo {
function usage {
# Help mensage
- echo -e "$CL_COMMU Createpkg version $CREATEPKG_VERSION $CL_OFF\n"
- echo -e "$CL_COMMU Usage: createpkg [--install/-i] package-name $CL_OFF"
- echo -e "$CL_COMMU createpkg --no-deps/-np package-name $CL_OFF"
- echo -e "$CL_COMMU createpkg --search/-s package-name $CL_OFF"
- echo -e "$CL_COMMU createpkg --info/-f package-name $CL_OFF"
- echo -e "$CL_COMMU createpkg --list/-l $CL_OFF"
- echo -e "$CL_COMMU createpkg --sync $CL_OFF"
- echo -e "$CL_COMMU createpkg --help/-h $CL_OFF"
+ eecho $commun "Createpkg version $CREATEPKG_VERSION\n"
+ eecho $commun "Usage: createpkg [--install/-i] package-name"
+ eecho $commun " createpkg --no-deps/-np package-name"
+ eecho $commun " createpkg --search/-s package-name"
+ eecho $commun " createpkg --info/-f package-name"
+ eecho $commun " createpkg --list/-l"
+ eecho $commun " createpkg --sync"
+ eecho $commun " createpkg --help/-h"
}
function check_config {
@@ -164,14 +174,15 @@ function solve_dep {
local VER="$3"
# Check package in local system
- INSTALLED=`eval "ls /var/log/packages/ | egrep '^$PACK-[^-]+-[^-]+-[^-]+$'"`
+ PACK="`echo $PACK | sed -e 's/\+/\\\+/'`"
+ INSTALLED=`eval "ls /var/log/packages/ | egrep -E '^$PACK-[^-]+-[^-]+-[^-]+$'"`
CHECK=$?
# TODO: Make check version procedures
if [ -z "$INSTALLED" ]; then
if [ $CHECK -ne 0 ]; then
# Check package in SlackBuilds tree
- echo -e "$CL_MENSG $BASENAME: processing $PACKAGE dependency $PACK $CL_OFF"
+ eecho $messag "$BASENAME: processing $PACKAGE dependency $PACK"
SYNC=no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK
# check if the package was built and installed
@@ -227,19 +238,19 @@ function info_builds {
for i in $PKG_PATH; do
PACKAGE=`basename $i .SlackBuild`
NAME_UP=`echo $PACKAGE | tr [a-z] [A-Z]`
- echo -e "$CL_COMMU $NAME_UP: $CL_OFF"
+ eecho $commun "$NAME_UP: "
PKG_DIR=`dirname $i`
if [ -e $PKG_DIR/slack-desc ]; then
eval "cat $PKG_DIR/slack-desc | grep '^$PACKAGE:' | cut -f2- -d:"
- echo -e "$CL_OFF"
+ eecho $normal
else
eval "cat $i | grep '^$PACKAGE:' | cut -f2- -d:"
- echo -e "$CL_OFF"
+ eecho $normal
fi
if [ -e $PKG_DIR/slack-required ]; then
- echo -e "$CL_COMMU slack-required $CL_OFF"
+ eecho $commun "slack-required"
cat $PKG_DIR/slack-required | sed 's/^/ /'
fi
done
@@ -261,21 +272,21 @@ function list_builds {
# level 2
for j in *; do
if [ -d $j ]; then
- echo -e "$CL_COMMU $j $CL_OFF"
+ eecho $commun " $j"
(
cd $j
BUILD="`ls *.SlackBuild 2>/dev/null`"
if [ "$BUILD" != "" ]; then
# level 3
for k in $BUILD; do
- echo -e "$CL_MENSG $k $CL_OFF"
+ eecho $messag " $k"
done
else
BUILD=""
fi
for k in *; do
if [ -d $k ]; then
- echo -e "$CL_MENSG $k.SlackBuild $CL_OFF"
+ eecho $messag " $k.SlackBuild"
fi
done
)
@@ -288,31 +299,31 @@ function list_builds {
function color_select {
# Select color mode: gray, color or none (*)
- # CL_COMMU - Communication
- # CL_MENSG - Commum messages
- # CL_ERROR - Error messages
- # CL_OFF - turn off color
+ # commun - Communication
+ # messag - Commum messages
+ # error - Error messages
+ # normal - turn off color
case "$1" in
'gray')
- CL_COMMU="\033[37;1m"
- CL_MENSG="\033[37;1m"
- CL_ERROR="\033[30;1m"
- CL_ALERT="\033[37m"
- CL_OFF="\033[m"
+ commun="\033[37;1m"
+ messag="\033[37;1m"
+ error="\033[30;1m"
+ alert="\033[37m"
+ normal="\033[m"
;;
'color')
- CL_COMMU="\033[34;1m" # green
- CL_MENSG="\033[32;1m" # blue
- CL_ERROR="\033[31;1m" # red
- CL_ALERT="\033[33;1m" # yellow
- CL_OFF="\033[m" # normal
+ commun="\033[34;1m" # green
+ messag="\033[32;1m" # blue
+ error="\033[31;1m" # red
+ alert="\033[33;1m" # yellow
+ normal="\033[m" # normal
;;
*)
- CL_COMMU=""
- CL_MENSG=""
- CL_ERROR=""
- CL_ALERT=""
- CL_OFF=""
+ commun=""
+ messag=""
+ error=""
+ alert=""
+ normal=""
;;
esac
}
@@ -330,7 +341,7 @@ error_codes
# First load simplepkg helper functions
source $COMMON && source $SIMPLEPKG_CONF
if [ $? -ne 0 ]; then
- echo -e "$CL_ERROR error: file $COMMON not found, check your $BASENAME installation $CL_OFF"
+ eecho $error "error: file $COMMON not found, check your $BASENAME installation"
exit 1
fi
@@ -419,7 +430,7 @@ if [ "`echo $BUILD_SCRIPT | wc -w`" -gt 1 ]; then
break
done
if [ "$PACKAGE" = "EXIT" ]; then
- echo -e "$CL_ERROR error: None package select $CL_OFF"
+ eecho $error "error: None package select"
exit 1
fi
# Select only one SlackBuild in BUILD_SCRIPT
@@ -433,7 +444,7 @@ fi
# Get dirname and script name from slackbuild
SCRIPT_BASE="`dirname $BUILD_SCRIPT`"
SCRIPT_NAME="`basename $BUILD_SCRIPT`"
-echo -e "$CL_MENSG $BASENAME: found script $PACKAGE.SlackBuild, now checking for dependencies $CL_OFF"
+eecho $messag "$BASENAME: found script $PACKAGE.SlackBuild, now checking for dependencies"
# Sets the package's slack-required
if [ -f "$SCRIPT_BASE/$PACKAGE.slack-required" ]; then
@@ -454,15 +465,15 @@ if [ ! -z "$SLACK_REQUIRED" -a "$NO_DEPS" != "1" ]; then
true
done )
if [ $? -ne 0 ]; then
- echo -e "$CL_MENSG $BASENAME: dependency solve error $CL_OFF"
+ eecho $messag "$BASENAME: dependency solve error"
exit 1
fi
- echo -e "$CL_MENSG $BASENAME: done checking for $PACKAGE dependencies $CL_OFF"
+ eecho $messag "$BASENAME: done checking for $PACKAGE dependencies"
else
- echo -e "$CL_MENSG $BASENAME: no unmet dependencies for $PACKAGE $CL_OFF"
+ eecho $messag "$BASENAME: no unmet dependencies for $PACKAGE"
fi
-echo -e "$CL_MENSG $BASENAME: processing $SCRIPT_NAME $CL_OFF"
+eecho $messag "$BASENAME: processing $SCRIPT_NAME"
# Built package
cd $SCRIPT_BASE
diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild
index dc3dceb..cae7224 100755
--- a/trunk/src/mkbuild
+++ b/trunk/src/mkbuild
@@ -12,8 +12,8 @@
# Turn off debug
set +x
#
-# Version 0.9.17
-PROG_VERSION=0.9.17
+# Version 0.9.18
+PROG_VERSION=0.9.18
#--------------------------------------------------------------------
# Functions