# See LOGFILE example.
DATE=`date +%Y-%m-%d_%H-%M-%S`
+# target arch, can also be used for log file naming
+TARGET=$(rpm -E %{_target})
+
# Example: LOGFILE='../log.$PACKAGE_NAME'
# Example: LOGFILE='../LOGS/log.$PACKAGE_NAME.$DATE'
# Example: LOGFILE='$PACKAGE_NAME/$PACKAGE_NAME.$DATE.log'
PACKAGE_NAME=""
ASSUMED_NAME=""
PROTOCOL="http"
+
+# use lftp by default when available
+USE_LFTP=
+lftp --version > /dev/null 2>&1 && USE_LFTP=yes
+
WGET_RETRIES=${MAX_WGET_RETRIES:-0}
CVS_COMMAND=${CVS_COMMAND:-cvs}
fi
fi
+UPDATE_POLDEK_INDEXES_OPTS=""
# Here we load saved user environment used to
# predefine options set above, or passed to builder
# Example of ~/.builderrc:
#
#UPDATE_POLDEK_INDEXES="yes"
+#UPDATE_POLDEK_INDEXES_OPTS="--mo=nodiff"
#FETCH_BUILD_REQUIRES="yes"
#REMOVE_BUILD_REQUIRES="force"
#GROUP_BCONDS="yes"
GETURI="axel -a $AXEL_OPTS"
GETURI2="$GETURI"
OUTFILEOPT="-o"
+elif [ -n "$USE_LFTP" ]; then
+ GETURI=download_lftp
+ GETURI2=$GETURI
+ OUTFILEOPT=""
else
wget --help 2>&1 | grep -q -- ' --no-check-certificate ' && WGET_OPTS="$WGET_OPTS --no-check-certificate"
wget --help 2>&1 | grep -q -- ' --inet ' && WGET_OPTS="$WGET_OPTS --inet"
GETLOCAL="cp -a"
-if (rpm --version 2>&1 | grep -q '4.0.[0-2]'); then
+if rpm --version 2>&1 | grep -q '4.0.[0-2]'; then
RPM="rpm"
RPMBUILD="rpm"
else
#---------------------------------------------
# functions
+download_lftp() {
+ local outfile=$1 url=$2 retval tmpfile
+ # TODO: use mktemp
+ tmpfile=$outfile.tmp
+ lftp -c "
+ $([ "$DEBUG" = "yes" ] && echo "debug 5;")
+ set ssl:verify-certificate no;
+ set net:max-retries $WGET_RETRIES;
+ set http:user-agent \"$USER_AGENT\";
+ pget -n 10 -c \"$url\" -o \"$tmpfile\"
+ "
+
+ retval=$?
+ if [ $retval -eq 0 ]; then
+ mv -f "$tmpfile" "$outfile"
+ else
+ rm -f "$tmpfile"
+ fi
+ return $retval
+}
+
usage() {
if [ -n "$DEBUG" ]; then set -xv; fi
echo "\
-sd, --source-distfiles - list sources available from distfiles (intended for offline
operations; does not work when Icon field is present
but icon file is absent),
--sc, --source-cvs - list sources available from CVS
+-sc, --source-cvs - list sources available from CVS
-sdp, --source-distfiles-paths - list sources available from distfiles -
paths relative to distfiles directory (intended for offline
operations; does not work when Icon field is present
-u, --try-upgrade - check version, and try to upgrade package
-un, --try-upgrade-with-float-version
- as above, but allow float version
- php-pear-Services_Digg/
+ php-pear-Services_Digg/
--upgrade-version - upgrade to specified version in try-upgrade
--use-greed-sources
- try download source from tag head if don't find it in
--with feat1 feat2 feat3 --without feat4 feat5 --with feat6
constructions. Set GROUP_BCONDS to yes to make use of it.
--target <platform>, --target=<platform>
- - build for platform <platform>.
---init-rpm-dir - initialize ~/rpm directory structure
+ - build for platform <platform>.
+--init-rpm-dir - initialize ~/rpm directory structure
"
}
cd $PACKAGE_DIR
cache_rpm_dump
- if (rpm_dump | grep -qEi ":.*nosource.*1"); then
+ if rpm_dump | grep -qEi ":.*nosource.*1"; then
FAIL_IF_NO_SOURCES="no"
fi
if [ "$NOCVSSPEC" != "yes" ]; then
if [ ! -s CVS/Root -a "$NOCVSSPEC" != "yes" ]; then
- echo "Warning: No CVS access defined - using local .spec file"
+ echo "Warning: No CVS access defined in $(pwd)- using local .spec file"
NOCVSSPEC="yes"
fi
if [ -n "$ADD5" ] && is_url $i || [ -n "$md5" ]; then
local tag="# $srcno-md5:\t"
if [[ "$md5" == *NoSource* ]]; then
- tag="# NoSource$srcno-md5:\t"
+ tag="# No$srcno-md5:\t"
elif [ -n "$USEDIGEST" ]; then
tag="BuildRequires:\tdigest(%SOURCE$srcno) = "
fi
im="$i"
fi
update_shell_title "${GETURI%% *}: $im"
- ${GETURI} "$im" ${OUTFILEOPT} "$target" || \
+ ${GETURI} ${OUTFILEOPT} "$target" "$im" || \
if [ "`echo $im | grep -E 'ftp://'`" ]; then
update_shell_title "${GETURI2%% *}: $im"
- ${GETURI2} "$im" ${OUTFILEOPT} "$target"
+ ${GETURI2} ${OUTFILEOPT} "$target" "$im"
fi
test -s "$target" || rm -f "$target"
fi
return 0;
fi
- TAG=$1
+ local _TAG=$1
# escape some regexp characters if part of TAG
- TAG=$(echo "$TAG" | sed -e 's#\([\+\*\.]\)#\\\1#g')
+ _TAG=$(echo "$_TAG" | sed -e 's#\([\+\*\.]\)#\\\1#g')
cd "$PACKAGE_DIR"
- $CVS_COMMAND status -v $SPECFILE | grep -Eiq "${TAG}.+(branch: [0-9.]+)"
+ $CVS_COMMAND status -v $SPECFILE | grep -Eiq "${_TAG}.+(branch: [0-9.]+)"
return $?
}
# w32codec-installer license_agreement
# php +mysqli
# ---
- if ([ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ])); then
+ if [ -f $HOME/.bcondrc ] || ([ -n $HOME_ETC ] && [ -f $HOME_ETC/.bcondrc ]); then
:
else
return
;;
esac
build_package
- if [ "$UPDATE_POLDEK_INDEXES" = "yes" -a "$COMMAND" != "build-prep" ]; then
- run_poldek --sdir="${POLDEK_INDEX_DIR}" --mkidxz
+ if [ "$UPDATE_POLDEK_INDEXES" = "yes" ] && [ "$COMMAND" = "build" -o "$COMMAND" = "build-binary" ]; then
+ run_poldek --sdir="${POLDEK_INDEX_DIR}" ${UPDATE_POLDEK_INDEXES_OPTS} --mkidxz
fi
remove_build_requires
;;