diff options
| -rwxr-xr-x | apkg | 24 | ||||
| -rw-r--r-- | doc/apkg.conf.readme | 6 |
2 files changed, 19 insertions, 11 deletions
@@ -842,7 +842,7 @@ main() { parseopts "$@" set -- $(updateopts "$@") - for d in $APKG_PACKAGE_DIR $APKG_SOURCE_DIR $APKG_WORK_DIR; do + for d in $APKG_PACKAGE_DIR $APKG_SOURCE_DIR $APKG_WORK_DIR APKG_LOG_DIR; do [ -d "$d" ] || { msg "Directory '$d' not exist"; exit 1; } [ -w "$d" ] || { msg "Directory '$d' dont have write access"; exit 1; } done @@ -872,7 +872,8 @@ main() { exit 1 } - packagefile=$APKG_PACKAGE_DIR/$name#$version-$release.spm + logfile="$APKG_LOG_DIR"/$name.log + packagefile="$APKG_PACKAGE_DIR"/$name#$version-$release.spm if [ "$install" ] && [ -s "$SPM_PKGDB/${PWD##*/}" ]; then msg "Package '${PWD##*/}' already installed." @@ -916,7 +917,11 @@ main() { fetch_src checksum_src extract_src - build_src + [ "$APKG_LOG" ] && { + build_src 2>&1 | tee -- "$logfile" + } || { + build_src + } fi if [ "$install" ]; then @@ -948,15 +953,15 @@ O_APKG_REPO=$APKG_REPO O_APKG_PACKAGE_DIR=$APKG_PACKAGE_DIR O_APKG_SOURCE_DIR=$APKG_SOURCE_DIR O_APKG_WORK_DIR=$APKG_WORK_DIR +O_APKG_LOG_DIR=$APKG_LOG_DIR # default value APKG_REPO="$PWD" APKG_PACKAGE_DIR="$PWD" APKG_SOURCE_DIR="$PWD" APKG_WORK_DIR="$PWD" -APKG_LOG_DIR=${APKG_LOG_DIR:-/var/log} +APKG_LOG_DIR="$PWD" -log_file="$APKG_LOG_DIR"/"$(basename "$0")_$(date +"%Y%m%d_%T")".log checksum_file="$HERE/.checksum" # source config @@ -969,11 +974,8 @@ APKG_REPO=${O_APKG_REPO:-$APKG_REPO} APKG_PACKAGE_DIR=${O_APKG_PACKAGE_DIR:-$APKG_PACKAGE_DIR} APKG_SOURCE_DIR=${O_APKG_SOURCE_DIR:-$APKG_SOURCE_DIR} APKG_WORK_DIR=${O_APKG_WORK_DIR:-$APKG_WORK_DIR} - -if [ ! "$APKG_LOG" ]; then - main "$@" -else - main "$@" 2>&1 | tee -- "$log_file" -fi +APKG_LOG_DIR=${O_APKG_LOG_DIR:-$APKG_LOG_DIR} + +main "$@" exit 0 diff --git a/doc/apkg.conf.readme b/doc/apkg.conf.readme index 397218f..7b2f83a 100644 --- a/doc/apkg.conf.readme +++ b/doc/apkg.conf.readme @@ -23,6 +23,12 @@ APKG_SOURCE_DIR=<path to source directory> # working directory path, where source is extracted and fakeroot location before packaging #APKG_WORK_DIR=<path to working directory> +# package build logging directory path (log file is $APKG_WORK_DIR/$name.log) +#APKG_LOG_DIR=<path to logging directory> + +# enable package build logging +#APKG_LOG=1 + # keep source when build failed, good to examine what causing build failed #APKG_KEEP_WORKDIR=1 |