From ef49517418cd469582a85250bedbdf07f3964ccd Mon Sep 17 00:00:00 2001 From: rudson Date: Wed, 11 Jul 2007 17:23:07 +0000 Subject: createpkg-1.1.0: reduzido a dependência com o .slackbuildrc adicionando as variáveis ao simplepkg.conf; substituído a chamada ao eval_config por função local: load_parameters; alterado a chamada ao SlackBuild com a passagem das variáveis; substituído valor de flags de 0 e 1 por on e off; pré-atualização ao common.sh no branch 0.6. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@400 04377dda-e619-0410-9926-eae83683ac58 --- branches/0.6/conf/simplepkg.conf.new | 20 +++++----- branches/0.6/lib/common.sh | 23 ++++++----- branches/0.6/src/createpkg | 75 ++++++++++++++++++++++++------------ 3 files changed, 74 insertions(+), 44 deletions(-) (limited to 'branches/0.6') diff --git a/branches/0.6/conf/simplepkg.conf.new b/branches/0.6/conf/simplepkg.conf.new index 67c8d56..70aa70b 100644 --- a/branches/0.6/conf/simplepkg.conf.new +++ b/branches/0.6/conf/simplepkg.conf.new @@ -127,26 +127,28 @@ TEMPLATE_STORAGE_STYLE="own-folder" # MKBUILD AND CREATEPKG SECTION #--------------------------------------------------------------------- # Set SlackBuilds default directory from scripts -SLACKBUILDS_DIR="/var/slackbuilds" +SLACKBUILDS_DIR="/var/simplaret/slackbuilds" # Set binaries default repository directory -MAKEPKG_REPOS="/var/createpkg" +MAKEPKG_REPOS="/var/simplaret/repos" # Set sources default directory -SOURCE_DIR="/var/sources" +SOURCE_DIR="/var/simplaret/sources" # Set color style # possible values are: color,gray, none COLOR_MODE="none" +# Createpkg architecture +CREATE_ARCH="i486" + +# Remove build files +CREATE_CLEANUP="yes" + # Remove old packages from repository tree by createpkg -# 0 enable -# 1 desable -REMOVE_OLD_PACKAGE=1 +REMOVE_OLD_PACKAGE="off" # Move package to SlackBuilds-like tree -# 0 enable -# 1 desable -MOVE_BIN_PACKAGE=1 +MOVE_BIN_PACKAGE="off" #--------------------------------------------------------------------- diff --git a/branches/0.6/lib/common.sh b/branches/0.6/lib/common.sh index e4ff2ff..4e18dfa 100644 --- a/branches/0.6/lib/common.sh +++ b/branches/0.6/lib/common.sh @@ -259,11 +259,16 @@ function eval_config { # ---------------------------------------------------------------- # createpkg and mkbuild section - SLACKBUILDS_DIR="`eval_parameter SLACKBUILDS_DIR /var/slackbuilds`" - MAKEPKG_REPOS="`eval_parameter MAKEPKG_REPOS /var/simplaret/binaries`" - SOURCE_DIR="`eval_parameter SOURCE_DIR /var/sources`" - REMOVE_OLD_PACKAGE="`eval_boolean_parameter REMOVE_OLD_PACKAGE 1`" - MOVE_BIN_PACKAGE="`eval_boolean_parameter MOVE_BIN_PACKAGE 1`" + #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`" + + #COLOR_MODE="`eval_parameter COLOR_MODE none`" + #CREATE_ARCH="`eval_parameter CREATE_ARCH i486`" + #CREATE_CLEANUP="`eval_parameter CREATE_CLEANUP 'yes'`" + + #REMOVE_OLD_PACKAGE="`eval_parameter REMOVE_OLD_PACKAGE off`" + #MOVE_BIN_PACKAGE="`eval_parameter MOVE_BIN_PACKAGE off`" # ---------------------------------------------------------------- else @@ -581,13 +586,11 @@ function svn_add_meta { } function gen_filelist { - # generate FILELIST.TXT - # usage: gen_filelist - - local cwd + # usage: gen_filelist - for file in `find | grep -e ".tgz$"`; do ls -l $file; done > FILELIST.TXT + find . -type f -name *.tgz -follow -print | sort | tr '\n' '\0' | \ + xargs -0r ls -ldL --time-style=long-iso > FILELIST.TXT echo "Created new FILELIST.TXT" } diff --git a/branches/0.6/src/createpkg b/branches/0.6/src/createpkg index ae3b153..860a684 100644 --- a/branches/0.6/src/createpkg +++ b/branches/0.6/src/createpkg @@ -31,7 +31,7 @@ # Createpkg functions #--------------------------------------------------- -CREATEPKG_VERSION="1.0.5.4" +CREATEPKG_VERSION="1.1.0" function error_codes { @@ -145,7 +145,7 @@ function check_config { # check the configuration TMP=${TMP:=/tmp}; - REPOS=${REPOS:=$TMP}; + REPOS=${REPOS:=$MAKEPKG_REPOS}; # Create $TMP and $REPOS if need [ ! -e $TPM ] && mkdir $TMP [ ! -e $REPOS ] && mkdir $REPOS @@ -183,8 +183,8 @@ function solve_dep { # exit code 5 == slackbuild not found # try to use simplaret - ARCH=$DEFAULT_ARCH simplaret --update - ARCH=$DEFAULT_ARCH simplaret --install $PACK + 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 @@ -289,6 +289,21 @@ function list_builds { } +function load_parameters { + + # Load Createpkg 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`" + + COLOR_MODE="`eval_parameter COLOR_MODE none`" + CREATE_ARCH="`eval_parameter CREATE_ARCH i486`" + CREATE_CLEANUP="`eval_parameter CREATE_CLEANUP 'yes'`" + + REMOVE_OLD_PACKAGE="`eval_parameter REMOVE_OLD_PACKAGE off`" + MOVE_BIN_PACKAGE="`eval_parameter MOVE_BIN_PACKAGE off`" +} + #--------------------------------------------------- # Starting createpkg #--------------------------------------------------- @@ -305,20 +320,18 @@ else fi # Load simplepkg.conf variables -eval_config $BASENAME - -# Enable debug mode -#set -x +load_parameters +#eval_config $BASENAME # 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 +#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 @@ -332,7 +345,7 @@ color_select $COLOR_MODE # This is used to show how many children process we have if [ -z "$CREATEPKG_CHILD" ]; then - CREATEPKG_CHILD="1" + CREATEPKG_CHILD=1 else let CREATEPKG_CHILD++ fi @@ -342,6 +355,8 @@ BASENAME="`basename $0`[$CREATEPKG_CHILD]" check_config check_repo +INSTALL=off + case $1 in '--search'|'-s') [ $# -ne 2 ] && handle_error 2 # two parameters is required @@ -357,7 +372,7 @@ case $1 in '--install'|'-i') [ $# -ne 2 ] && handle_error 2 # two parameters is required PACKAGE="$2" - INSTALL="1" + INSTALL="on" ;; '--no-deps'|'-nd') [ $# -ne 2 ] && handle_error 2 # two parameters is required @@ -459,12 +474,16 @@ cd $SCRIPT_BASE # Make MAKEPKG_REPOS [ ! -e $MAKEPKG_REPOS ] && mkdir -p $MAKEPKG_REPOS -# Execute SlackBuild script with variables protection -if grep '^REPOS=' $SCRIPT_NAME 2>&1 >/dev/null ; then - ( REPOS=$MAKEPKG_REPOS INTERACT=no sh ./$SCRIPT_NAME ) -else - ( INTERACT=no sh ./$SCRIPT_NAME ) -fi +# Run SlackBuild script +( + SRC_DIR=${SRC_DIR:=$SOURCE_DIR} \ + SRC=${SRC_DIR:=$SOURCE_DIR} \ + ARCH=${ARCH:=$CREATE_ARCH} \ + COLOR=${COLOR:=$COLOR_MODE} \ + REPOS=${REPOS:=$MAKEPKG_REPOS} \ + CLEANUP=${CLEANUP:=$CREATE_CLEANUP} \ + INTERACT=no sh ./$SCRIPT_NAME +) # Check if package was built handle_error $? $PACKAGE @@ -473,21 +492,27 @@ handle_error $? $PACKAGE PKG_NAME="`ls -1 -c $MAKEPKG_REPOS/$PACKAGE-*-*-*.tgz | head -n 1 | xargs basename`" # Select repository directory -[ $MOVE_BIN_PACKAGE -eq 0 ] && NEW_REPOS=$MAKEPKG_REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) || NEW_REPOS=$MAKEPKG_REPOS +[ $MOVE_BIN_PACKAGE == 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 -eq 0 ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null +[ $REMOVE_OLD_PACKAGE == on ] && rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null # Move package to SlackBuilds-like tree -[ $MOVE_BIN_PACKAGE -eq 0 ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/ +[ $MOVE_BIN_PACKAGE == on ] && mv $MAKEPKG_REPOS/$PKG_NAME $NEW_REPOS/ # Install package -if [ "$INSTALL" == "1" ]; then +if [ $INSTALL == on ]; then # as we dont have the full package file name, we'll # use the newer file name that matches our wildcard: upgradepkg --install-new $NEW_REPOS/$PKG_NAME fi + +# Update repository FILELIST.TXT, ... +( + cd $MAKEPKG_REPOS + gen_filelist +) -- cgit v1.2.3