aboutsummaryrefslogtreecommitdiff
path: root/trunk/src/createpkg
diff options
context:
space:
mode:
Diffstat (limited to 'trunk/src/createpkg')
-rw-r--r--trunk/src/createpkg139
1 files changed, 14 insertions, 125 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg
index 03c25d0..2f647a7 100644
--- a/trunk/src/createpkg
+++ b/trunk/src/createpkg
@@ -26,102 +26,7 @@
# Createpkg functions
#---------------------------------------------------
-CREATEPKG_VERSION="1.1.5"
-
-function error_codes {
-
- # Slackbuilds error codes
- ERROR_WGET=31 # wget error
- ERROR_MAKE=32 # make source error
- ERROR_INSTALL=33 # make install error
- ERROR_MD5=34 # md5sum error
- ERROR_CONF=35 # ./configure error
- ERROR_HELP=36 # dasable
- ERROR_TAR=37 # tar error
- ERROR_MKPKG=38 # makepkg error
- ERROR_GPG=39 # gpg check error
- ERROR_PATCH=40 # patch error
- ERROR_VCS=41 # cvs error
- ERROR_MKDIR=42 # make directory error
-
- # Createpkg error codes
- ERROR_INSTPKG=200 # installpkg error
- ERROR_DEPEN=201 # dependency error
- SCRIPT_OR_PACKAGE_NOT_FOUND=202 # Script or package not found
-}
-
-function handle_error {
-
- # This function deals with internal createpkg errors
- # and also with non-zero exit codes from slackbuilds
- # Input: $1 - error code
- # Output: Error mensage
- #
- # check slackbuild exit status are:
- #
- # ERROR_WGET=31; ERROR_MAKE=32; ERROR_INSTALL=33
- # ERROR_MD5=34; ERROR_CONF=35; ERROR_HELP=36
- # ERROR_TAR=37; ERROR_MKPKG=38 ERROR_GPG=39
- # ERROR_PATCH=40; ERROR_VCS=41; ERROR_MKDIR=42
- #
- # thanks to rudsonalves at yahoo.com.br for this spec.
-
- # we don't want to process when exit status = 0
- [ "$1" == "0" ] && return
-
- # Exit codes
- case $1 in
- 2) usage ;;
- 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)
- eecho $error "$BASENAME: error downloading source/package for $2" ;;
- $ERROR_MAKE)
- eecho $error "$BASENAME: error compiling $2 source code" ;;
- $ERROR_INSTALL)
- eecho $error "$BASENAME: error installing $2" ;;
- $ERROR_MD5)
- eecho $error "$BASENAME: error on source code integrity check for $2" ;;
- $ERROR_CONF)
- eecho $error "$BASENAME: error configuring the source code for $2" ;;
- $ERROR_HELP)
- exit 0 ;; # its supposed to never happen here :P
- $ERROR_TAR)
- eecho $error "$BASENAME: error decompressing source code for $2" ;;
- $ERROR_MKPKG)
- eecho $error "$BASENAME: error creating package $2" ;;
- $ERROR_GPG)
- eecho $error "$BASENAME: error verifying GPG signature the source code for $2" ;;
- $ERROR_PATCH)
- eecho $error "$BASENAME: error patching the source code for $2" ;;
- $ERROR_VCS)
- eecho $error "$BASENAME: error downloading $2 source from version control system" ;;
- $ERROR_MKDIR)
- eecho $error "$BASENAME: make directory $2 error, aborting" ;;
- $ERROR_INSTPKG)
- eecho $error "$BASENAME: install package $2 error, aborting" ;;
- $ERROR_DEPEN)
- eecho $error "$BASENAME: dependency solve error, aborting" ;;
- *) eecho $error "$BASENAME: unknown error or user interrupt" ;;
- $SCRIPT_OR_PACKAGE_NOT_FOUND)
- eecho $error "$BASENAME: SlackBuild or package not found" ;;
- esac
-
- exit $1
-
-}
-
-function build_repo {
-
- # Checkout a new slackbuild working copy
- BASEDIR="`dirname $SLACKBUILDS_DIR`"
- mkdir -p $BASEDIR || handle_error 4 $BASEDIR
- cd $BASEDIR
- svn checkout $SVN
- cd $SLACKBUILDS_DIR
-
-}
+CREATEPKG_VERSION="1.1.8"
function usage {
@@ -134,6 +39,7 @@ function usage {
eecho $commun " createpkg --list/-l"
eecho $commun " createpkg --sync"
eecho $commun " createpkg --help/-h"
+ exit
}
function check_config {
@@ -150,7 +56,7 @@ function check_config {
[ ! -e $MAKEPKG_REPOS ] && mkdir -p $MAKEPKG_REPOS
#
SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/slackbuilds}
- SVN=${SVN:=svn://slack.sarava.org/slackbuilds}
+ #
SYNC=${SYNC:=$no}
SYNC=`convert_boolean $SYNC`
BASEDIR="`dirname $SLACKBUILDS_DIR`"
@@ -180,14 +86,13 @@ function solve_dep {
EXIT_CODE="$?"
if [ "$EXIT_CODE" == "5" ]; then
-
# exit code 5 == slackbuild not found
# try to use simplaret
ARCH=$CREATE_ARCH simplaret --update
ARCH=$CREATE_ARCH simplaret --install $PACK
EXIT_CODE="$?"
if [ "$EXIT_CODE" != "0" ]; then
- handle_error $SCRIPT_OR_PACKAGE_NOT_FOUND $PACK
+ handle_error $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND $PACK
fi
elif [ "$EXIT_CODE" != "0" ]; then
@@ -199,22 +104,6 @@ function solve_dep {
}
-function check_repo {
-
- # Verify if repository exist
- [ ! -d "$SLACKBUILDS_DIR" ] && build_repo
-
-}
-
-function sync_repo {
-
- # Synchronize repository
- cd $SLACKBUILDS_DIR
- svn update || build_repo
- #simplaret --update
-
-}
-
function find_slackbuild {
# Find SlackBuild script in the repository
@@ -295,6 +184,7 @@ function load_parameters {
MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplaret/repos`"
SOURCE_DIR="`eval_parameter SOURCE_DIR /var/simplaret/sources`"
SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`"
+ SLACKBUILDS_SVN="`eval_parameter SLACKBUILDS_DIR svn://slack.sarava.org/slackbuilds`"
COLOR_MODE="`eval_parameter COLOR_MODE none`"
CREATE_ARCH="`eval_parameter CREATE_ARCH $(default_arch)`"
@@ -323,7 +213,6 @@ set_constants
# Load simplepkg.conf variables
load_parameters
-#eval_config $BASENAME
# Loading error codes
error_codes
@@ -348,35 +237,35 @@ fi
BASENAME="`basename $0`[$CREATEPKG_CHILD]"
check_config
-check_repo
+check_repo $SLACKBUILDS_DIR $SLACKBUILDS_SVN
INSTALL=$off
NO_DEPS=$off
case $1 in
'--search'|'-s')
- [ $# -ne 2 ] && handle_error 2 # two parameters is required
+ [ $# -ne 2 ] && usage # two parameters is required
find_slackbuild $2
exit
;;
'--info'|'-f')
- [ $# -ne 2 ] && handle_error 2 # two parameters is required
+ [ $# -ne 2 ] && usage # two parameters is required
PKG_PATH=`find_slackbuild $2`
info_builds
exit
;;
'--install'|'-i')
- [ $# -ne 2 ] && handle_error 2 # two parameters is required
+ [ $# -ne 2 ] && usage # two parameters is required
PACKAGE="$2"
INSTALL=$on
;;
'--no-deps'|'-nd')
- [ $# -ne 2 ] && handle_error 2 # two parameters is required
+ [ $# -ne 2 ] && usage # two parameters is required
NO_DEPS=$on
PACKAGE="$2"
;;
'--sync')
- sync_repo
+ sync_repo $SLACKBUILDS_DIR $SLACKBUILDS_SVN
exit 0
;;
'--help'|'-h'|'')
@@ -391,20 +280,20 @@ case $1 in
if [ "${1:0:1}" != "-" ]; then
PACKAGE="$1"
else
- handle_error 2
+ usage
fi
;;
esac
# Synchronize repository
-[ $SYNC -eq $yes ] && sync_repo
+[ $SYNC -eq $yes ] && sync_repo $SLACKBUILDS_DIR $SLACKBUILDS_SVN
# Get SlackBuild script
BUILD_SCRIPT="`find_slackbuild $PACKAGE`"
# Check SlackBuild script found
if [ -z "$BUILD_SCRIPT" ]; then
- handle_error 5 $PACKAGE
+ handle_error $ERROR_CREATEPKG_SLACKBUILD_NOTFOUND $PACKAGE
fi
# Select one SlackBuild