aboutsummaryrefslogtreecommitdiff
path: root/branches/0.6/src
diff options
context:
space:
mode:
Diffstat (limited to 'branches/0.6/src')
-rw-r--r--branches/0.6/src/createpkg43
-rwxr-xr-xbranches/0.6/src/mkbuild101
2 files changed, 76 insertions, 68 deletions
diff --git a/branches/0.6/src/createpkg b/branches/0.6/src/createpkg
index 860a684..373c8cc 100644
--- a/branches/0.6/src/createpkg
+++ b/branches/0.6/src/createpkg
@@ -31,7 +31,7 @@
# Createpkg functions
#---------------------------------------------------
-CREATEPKG_VERSION="1.1.0"
+CREATEPKG_VERSION="1.1.1"
function error_codes {
@@ -152,7 +152,8 @@ function check_config {
#
SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/slackbuilds}
SVN=${SVN:=svn://slack.sarava.org/slackbuilds}
- SYNC=${SYNC:=no}
+ SYNC=${SYNC:=$no}
+ SYNC=`convert_boolean $SYNC`
BASEDIR="`dirname $SLACKBUILDS_DIR`"
}
@@ -174,7 +175,7 @@ function solve_dep {
if [ $CHECK -ne 0 ]; then
# Check package in SlackBuilds tree
eecho $messag "$BASENAME: processing $PACKAGE dependency $PACK"
- SYNC=no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK
+ SYNC=$no CREATEPKG_CHILD=$CREATEPKG_CHILD createpkg --install $PACK
# check if the package was built and installed
EXIT_CODE="$?"
@@ -297,11 +298,11 @@ function load_parameters {
SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/simplaret/slackbuilds`"
COLOR_MODE="`eval_parameter COLOR_MODE none`"
- CREATE_ARCH="`eval_parameter CREATE_ARCH i486`"
- CREATE_CLEANUP="`eval_parameter CREATE_CLEANUP 'yes'`"
+ CREATE_ARCH="`eval_parameter CREATE_ARCH $(default_arch)`"
+ CREATE_CLEANUP="`eval_boolean_parameter CREATE_CLEANUP $yes`"
- REMOVE_OLD_PACKAGE="`eval_parameter REMOVE_OLD_PACKAGE off`"
- MOVE_BIN_PACKAGE="`eval_parameter MOVE_BIN_PACKAGE off`"
+ REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE $off`"
+ MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE $off`"
}
#---------------------------------------------------
@@ -319,6 +320,8 @@ else
mk_exit 0
fi
+set_constants
+
# Load simplepkg.conf variables
load_parameters
#eval_config $BASENAME
@@ -326,13 +329,6 @@ load_parameters
# Loading error codes
error_codes
-# First load simplepkg helper functions
-#source $COMMON && source $SIMPLEPKG_CONF
-#if [ $? -ne 0 ]; then
-# eecho $error "error: file $COMMON not found, check your $BASENAME installation"
-# exit 1
-#fi
-
# Load slackbuildrc definitions
if [ -f ~/.slackbuildrc ]; then
source ~/.slackbuildrc
@@ -355,7 +351,8 @@ BASENAME="`basename $0`[$CREATEPKG_CHILD]"
check_config
check_repo
-INSTALL=off
+INSTALL=$off
+NO_DEPS=$off
case $1 in
'--search'|'-s')
@@ -372,11 +369,11 @@ case $1 in
'--install'|'-i')
[ $# -ne 2 ] && handle_error 2 # two parameters is required
PACKAGE="$2"
- INSTALL="on"
+ INSTALL=$on
;;
'--no-deps'|'-nd')
[ $# -ne 2 ] && handle_error 2 # two parameters is required
- NO_DEPS="1"
+ NO_DEPS=$on
PACKAGE="$2"
;;
'--sync')
@@ -401,7 +398,7 @@ case $1 in
esac
# Synchronize repository
-[ "$SYNC" == "yes" ] && sync_repo
+[ $SYNC -eq $yes ] && sync_repo
# Get SlackBuild script
BUILD_SCRIPT="`find_slackbuild $PACKAGE`"
@@ -446,7 +443,7 @@ elif [ -f "$SCRIPT_BASE/slack-required" ]; then
SLACK_REQUIRED="$SCRIPT_BASE/slack-required"
fi
-if [ ! -z "$SLACK_REQUIRED" -a "$NO_DEPS" != "1" ]; then
+if [ ! -z "$SLACK_REQUIRED" -a $NO_DEPS -ne $on ]; then
# this routine checks for dependencies in package's slack-required
( grep '^[^#]' $SLACK_REQUIRED | while read dep; do
if [ ! -z "$dep" ]; then
@@ -492,19 +489,19 @@ handle_error $? $PACKAGE
PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`"
# Select repository directory
-[ $MOVE_BIN_PACKAGE == on ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS
+[ $MOVE_BIN_PACKAGE -eq $on ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS
# Create repository directory
[ ! -e $NEW_REPOS ] && mkdir -p $NEW_REPOS 2>/dev/null
# Remove old packages from repository tree
-[ $REMOVE_OLD_PACKAGE == on ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null
+[ $REMOVE_OLD_PACKAGE -eq $on ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null
# Move package to SlackBuilds-like tree
-[ $MOVE_BIN_PACKAGE == on ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/
+[ $MOVE_BIN_PACKAGE -eq $on ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/
# Install package
-if [ $INSTALL == on ]; then
+if [ "$INSTALL" -eq $on ]; then
# as we dont have the full package file name, we'll
# use the newer file name that matches our wildcard:
diff --git a/branches/0.6/src/mkbuild b/branches/0.6/src/mkbuild
index 365bcd0..60566dd 100755
--- a/branches/0.6/src/mkbuild
+++ b/branches/0.6/src/mkbuild
@@ -18,8 +18,8 @@
#
# Based in model generic.SlackBuild of Luiz
#
-# Version 0.9.9
-PROG_VERSION=0.9.9
+# Version 1.0.0
+PROG_VERSION=1.0.0
PROG_NAME=`basename $0`
#--------------------------------------------------------------------
@@ -121,6 +121,9 @@ function mkbuild_error {
"$ERROR_INPUT_PAR")
echo "Input parameter $2 error. See \"mkbuild --help\"."
;;
+ "$NULL_STRING")
+ mkbuild_use
+ ;;
*)
echo "Unknow error!"
;;
@@ -146,7 +149,7 @@ function set_parameters {
case $PAR in
'-c'|'--commit')
# Commit directory
- COMMIT=1
+ COMMIT=$on
;;
'-d'|'--debug')
# Debug mode
@@ -441,17 +444,24 @@ function commit_slackbuild {
return 1
fi
+ # check SlackBuilds directory
+ [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync
+
# Get SlackBuild path
+ # Get SlackBuild path in parameter file
SLACKBUILD_PATH=`validate_parameter "$SLACKBUILD_PATH" "SLACKBUILD PATH" ""`
- if [ $? != 0 ]; then
+ # Get SlackBuild path in slackbuild local tree
+ if [ $? -ne 0 ]; then
+ SLACKBUILD_PATH=`find $SLACKBUILDS_DIR -name $SLACKBUILD | xargs dirname`
+ fi
+ # Get SlackBuild path in gentoo-portage tree
+ if [ "$SLACKBUILD_PATH" == "" ]; then
# Mount SlackBuild path
- [ $VERBOSE -ne 0 ] && echo -e "\nFind SlackBuild PATH in Slack.Sarava tree..."
- AUX=`lynx -dump http://gentoo-portage.com/Search?search=$PKG_NAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "`
+ [ $VERBOSE -eq $on ] && echo -e "\nFind SlackBuild PATH in Slack.Sarava tree..."
+ AUX=`lynx -connect_timeout=10 -dump http://gentoo-portage.com/Search?search=$PKG_NAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "`
[ ! -z $AUX ] && SLACKBUILD_PATH="`dirname $AUX | tr - /`/`basename $AUX`" || SLACKBUILD_PATH="others/unclassified/$PKG_NAME"
fi
- # check SlackBuilds directory
- [ ! -e $SLACKBUILDS_DIR ] && createpkg --sync
# change to SlackBuilds directory
cd $SLACKBUILDS_DIR/
@@ -532,7 +542,7 @@ function decompress_find {
case $EXTENSION in
'gz'|'GZ')
DECOMPRESSOR="gunzip"
- DECOMPRESSOR_TEST_FLAG="-t"
+ DECOMPRESSOR_TEST_FLAG="-t"$NULL_STRING
;;
'bz2'|'BZ2')
DECOMPRESSOR="bunzip2"
@@ -557,8 +567,6 @@ COMMON="/usr/libexec/simplepkg/common.sh"
SIMPLEPKG_CONF="/etc/simplepkg/simplepkg.conf"
WORK=`pwd`
LANG=en_US
-COMMIT=0
-VERBOSE=0
if [ -f "$COMMON" ]; then
source $COMMON
@@ -567,12 +575,15 @@ else
mk_exit 0
fi
+# Start constants
+set_constants
+
+# Set commit off
+COMMIT=$off
+# Set verbose off
+VERBOSE=$off
# Createpkg and mkbuild section
SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/slackbuilds`"
-#-----------------------------
-
-# Start variables
-DOWNLOAD_SOURCE=0 # desable download source
# Auxiliar file
AUX_TMP=/tmp/mkbuild_tmp.$RANDOM
# Derectory to SlackBuild models
@@ -583,27 +594,27 @@ SLACKDESC_LEN=78
# Load error codes
error_codes
-[ $# -eq 0 ] && mkbuild_use && exit 1
+[ $# -eq 0 ] && mk_exit $NULL_STRING
# Configure input parameters
set_parameters $@
-[ $VERBOSE -ne 0 ] && echo -e "$PROG_NAME version $PROG_VERSION\n"
+[ $VERBOSE -eq $on ] && echo -e "$PROG_NAME version $PROG_VERSION\n"
# Get values
# Author name
AUTHOR=${AUTHOR:="`get_variable "SLACKBUILD AUTHOR"`"}
[ -z "$AUTHOR" ] && mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR"
-[ $VERBOSE -ne 0 ] && echo "[[SLACKBUILD AUTHOR]]=\"$AUTHOR\""
+[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR]]=\"$AUTHOR\""
# Author initials
STR_MOUNT=`echo $AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]`
AUTHOR_INITIALS="`validate_parameter "$AUTHOR_INITIALS" "SLACKBUILD AUTHOR INITIALS" "$STR_MOUNT"`" || mkbuild_error $ERROR_CONSTRUCTION "SLACKBUILD AUTHOR INITIALS"
-[ $VERBOSE -ne 0 ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\""
+[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD AUTHOR INITIALS]]=\"$AUTHOR_INITIALS\""
# URL program
URL=`validate_parameter "$URL" "DOWNLOAD FOLDER URL" ""` || mkbuild_error $ERROR_CONSTRUCTION "URL"
-[ $VERBOSE -ne 0 ] && echo "[[URL]]=\"$URL\""
+[ $VERBOSE -eq $on ] && echo "[[URL]]=\"$URL\""
STR_MOUNT="`echo $URL | rev | cut -c1-3 | rev | tr -d '.'`"
if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT = "zip" ]; then
@@ -612,96 +623,96 @@ if [ $STR_MOUNT = "gz" -o $STR_MOUNT = "tgz" -o $STR_MOUNT = "bz2" -o $STR_MOUNT
else
URL_BASE=$URL
fi
-[ $VERBOSE -ne 0 ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\""
+[ $VERBOSE -eq $on ] && echo "[[DOWNLOAD FOLDER URL]]=\"$URL_BASE\""
# Extension
EXTENSION=`validate_parameter "$EXTENSION" "EXTENSION" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "EXTENSION"
-[ $VERBOSE -ne 0 ] && echo "[[EXTENSION]]=\"$EXTENSION\""
+[ $VERBOSE -eq $on ] && echo "[[EXTENSION]]=\"$EXTENSION\""
# Build archteture
ARCH=`validate_parameter "$ARCH" "ARCH" "i486"`
-[ $VERBOSE -ne 0 ] && echo "[[ARCH]]=\"$ARCH\""
+[ $VERBOSE -eq $on ] && echo "[[ARCH]]=\"$ARCH\""
# Source name
STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'`
SRC_NAME=`validate_parameter "$SRC_NAME" "SOURCE NAME" "$STR_MOUNT"` || mkbuild_error $ERROR_CONSTRUCTION "SOURCE NAME"
-[ $VERBOSE -ne 0 ] && echo "[[SOURCE NAME]]=\"$SRC_NAME\""
+[ $VERBOSE -eq $on ] && echo "[[SOURCE NAME]]=\"$SRC_NAME\""
# Package name
STR_MOUNT=`echo $SRC_NAME | tr [A-Z_] [a-z\-]`
PKG_NAME=`validate_parameter "$PKG_NAME" "PACKAGE NAME" "$STR_MOUNT"`
-[ $VERBOSE -ne 0 ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\""
+[ $VERBOSE -eq $on ] && echo "[[PACKAGE NAME]]=\"$PKG_NAME\""
# Version
STR_MOUNT=`echo $SOURCE_NAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'`
VERSION=`validate_parameter "$VERSION" "VERSION" $STR_MOUNT` || mkbuild_error $ERROR_CONSTRUCTION "VERSION"
-[ $VERBOSE -ne 0 ] && echo "[[VERSION]]=\"$VERSION\""
+[ $VERBOSE -eq $on ] && echo "[[VERSION]]=\"$VERSION\""
# Construction source name string
CONST_STRING="`validate_parameter "$CONST_STRING" "SOURCE NAME CONSTRUCTION STRING" "\\\$SRC_NAME-\\\$VERSION.tar.$EXTENSION"`"
-[ $VERBOSE -ne 0 ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\""
+[ $VERBOSE -eq $on ] && echo "[[SOURCE NAME CONSTRUCTION STRING]]=\"$CONST_STRING\""
# Build Source Name
[ -z $SOURCE_NAME ] && SOURCE_NAME=`eval "echo $CONST_STRING"`
-[ $VERBOSE -ne 0 ] && echo "SOURCE_NAME=\"$SOURCE_NAME\""
+[ $VERBOSE -eq $on ] && echo "SOURCE_NAME=\"$SOURCE_NAME\""
# Decompressor program and test flag
DECOMPRESSOR=`validate_parameter "$DECOMPRESSOR" "DECOMPRESSOR" ""` || decompress_find
-[ $VERBOSE -ne 0 ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\""
+[ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR]]=\"$DECOMPRESSOR\""
DECOMPRESSOR_TEST_FLAG=`validate_parameter "$DECOMPRESSOR_TEST_FLAG" "DECOMPRESSOR TEST FLAG" ""` || mkbuild_error $ERROR_CONSTRUCTION "DECOMPRESSOR TEST FLAG"
-[ $VERBOSE -ne 0 ] && echo "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\""
+[ $VERBOSE -eq $on ] && echo "[[DECOMPRESSOR TEST FLAG]]=\"$DECOMPRESSOR_TEST_FLAG\""
# Documentations list
DOCFILES=`validate_parameter "$DOCFILES" "DOCUMENTATION FILES" "NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING readme.*"`
-[ $VERBOSE -ne 0 ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\""
+[ $VERBOSE -eq $on ] && echo "[[DOCUMENTATION FILES]]=\"$DOCFILES\""
# ./configure option
OPTIONS=`validate_parameter "$OPTIONS" "OTHER CONFIGURE ARGS" ""`
-[ $VERBOSE -ne 0 ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\""
+[ $VERBOSE -eq $on ] && echo "[[OTHER CONFIGURE ARGS]]=\"$OPTIONS\""
# PREFIX
PREFIX=`validate_parameter "$PREFIX" "PREFIX" "/usr"`
-[ $VERBOSE -ne 0 ] && echo "[[PREFIX]]=\"$PREFIX\""
+[ $VERBOSE -eq $on ] && echo "[[PREFIX]]=\"$PREFIX\""
# Number of jobs
NUMJOBS=`validate_parameter "$NUMJOBS" "NUMBER OF JOBS" ""`
-[ $VERBOSE -ne 0 ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
+[ $VERBOSE -eq $on ] && echo "[[NUMBER OF JOBS]]=\"$NUMJOBS\""
# Make slack-required file.
SLACK_REQUIRED=`validate_parameter "$SLACK_REQUIRED" "SLACK REQUIRED" ""`
-[ $VERBOSE -ne 0 ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\""
+[ $VERBOSE -eq $on ] && echo "[[SLACK REQUIRED]]=\"$SLACK_REQUIRED\""
# SlackBuild model
MODEL=`validate_parameter "$MODEL" "SLACKBUILD MODEL" "generic.mkSlackBuild"`
-[ $VERBOSE -ne 0 ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\""
+[ $VERBOSE -eq $on ] && echo "[[SLACKBUILD MODEL]]=\"$MODEL\""
#
# Start build SlackBuild
SLACKBUILD=${PKG_NAME}.SlackBuild
SLACKBUILD_TEMP=$SLACKBUILD.tmp
cp $MODEL_DIR/$MODEL $SLACKBUILD_TEMP
-[ $VERBOSE -ne 0 ] && echo -en "\nStart SlackBuild make"
+[ $VERBOSE -eq $on ] && echo -en "\nStart SlackBuild make"
# Change strings from model
start_build $SLACKBUILD_TEMP
-[ $VERBOSE -ne 0 ] && echo -en "\nEdit mkSlackBuild model .."
+[ $VERBOSE -eq $on ] && echo -en "\nEdit mkSlackBuild model .."
# On/Off sections
activate_sections
-[ $VERBOSE -ne 0 ] && echo -en ".\nEnable and desable sections .."
+[ $VERBOSE -eq $on ] && echo -en ".\nEnable and desable sections .."
# Change sections
section_edit
-[ $VERBOSE -ne 0 ] && echo -en ".\nChange sections .."
+[ $VERBOSE -eq $on ] && echo -en ".\nChange sections .."
# Remove off sections
build_slackbuild
-[ $VERBOSE -ne 0 ] && echo -en ".\nRemove off sections .."
+[ $VERBOSE -eq $on ] && echo -en ".\nRemove off sections .."
# Make slack-required file
make_slack_required
-[ $VERBOSE -ne 0 ] && echo -en ".\nMake slack-required file .."
+[ $VERBOSE -eq $on ] && echo -en ".\nMake slack-required file .."
if [ -e slack-required ]; then
DEPENDENCY_LIST="`cat slack-required | awk '{print $1}' | grep '^[a-z]' | tr '\012' ' '`"
@@ -712,10 +723,10 @@ fi
# Others changes
change_others_parameters
-[ $VERBOSE -ne 0 ] && echo -en ".\nEdit others [[]] parameters .."
+[ $VERBOSE -eq $on ] && echo -en ".\nEdit others [[]] parameters .."
# Clear temporary files
clear_files
-[ $VERBOSE -ne 0 ] && echo -e ".\nRemove temporary files ..."
+[ $VERBOSE -eq $on ] && echo -e ".\nRemove temporary files ..."
-[ $COMMIT -eq 1 ] && commit_slackbuild
+[ $COMMIT -eq $on ] && commit_slackbuild