PATH="/bin:/usr/bin:/usr/sbin:/sbin:/usr/X11R6/bin"
COMMAND="build"
+TARGET=""
SPECFILE=""
BE_VERBOSE=""
RPMOPTS=""
BCOND=""
GROUP_BCONDS="no"
+CVSIGNORE_DF="no"
PATCHES=""
SOURCES=""
CVS_SERVER="cvs.pld-linux.org"
DISTFILES_SERVER="://distfiles.pld-linux.org"
-DEF_NICE_LEVEL=0
+DEF_NICE_LEVEL=19
FAIL_IF_NO_SOURCES="yes"
%_without_<feature> macro switch. You may now use
--with feat1 feat2 feat3 --without feat4 feat5 --with feat6
constructions. Set GROUP_BCONDS to yes to make use of it.
+--target <platform>
+ - build for platform <platform>.
"
}
[ "$md5" = "$(md5sum $(nourl "$1") 2> /dev/null | sed -e 's/ .*//')" ]
}
+good_size ()
+{
+ size="$(find $(nourl "$1") -printf "%s" 2>/dev/null)"
+ [ -n "$size" -a "$size" -gt 0 ]
+}
+
+cvsignore_df ()
+{
+ if [ "$CVSIGNORE_DF" != "yes" ]; then
+ return
+ fi
+ cvsignore=${SOURCE_DIR}/.cvsignore
+ if ! grep -q "^$1\$" $cvsignore 2> /dev/null; then
+ echo "$1" >> $cvsignore
+ fi
+}
+
get_files()
{
GET_FILES="$@"
fi
if [ -n "$(src_md5 "$i")" ] && [ -z "$NODIST" ]; then
- if good_md5 "$i"; then
+ if good_md5 "$i" && good_size "$i"; then
echo "$(nourl "$i") having proper md5sum already exists"
continue
fi
fi
fi
fi
- if ! test -s "$target"; then
+ if test -s "$target"; then
+ cvsignore_df $target
+ else
rm -f "$target"
FROM_DISTFILES=0
fi
$SPECS_DIR/$SPECFILE
fi
- if good_md5 "$i"; then
+ if good_md5 "$i" && good_size "$i"; then
:
elif [ "$FROM_DISTFILES" = 1 ]; then
# wrong md5 from distfiles: remove the file and try again
test -s "$target" || rm -f "$target"
fi
- if good_md5 "$i"; then
+ if good_md5 "$i" && good_size "$i" ; then
:
else
- echo "MD5 sum mismatch. Use -U to refetch sources,"
+ echo "MD5 sum mismatch or 0 size. Use -U to refetch sources,"
echo "or -5 to update md5 sums, if you're sure files are correct."
Exit_error err_no_source_in_repo $i
fi
fi
fi
cd "$SPECS_DIR"
-
+
+ if [ -n "$TARGET" ]; then
+ TARGET_SWITCH="--target $TARGET"
+ fi
+
case "$COMMAND" in
build )
BUILD_SWITCH="-ba" ;;
echo "LASTLOG=$LOG" > $LASTLOG_FILE
fi
RES_FILE=~/tmp/$RPMBUILD-exit-status.$RANDOM
- (time nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
+ (time nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH $TARGET_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
RETVAL=`cat $RES_FILE`
rm $RES_FILE
if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
fi
fi
else
- eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE
+ eval nice -n ${DEF_NICE_LEVEL} $RPMBUILD $BUILD_SWITCH $TARGET_SWITCH -v $QUIET $CLEAN $RPMOPTS $BCOND $SPECFILE
RETVAL=$?
fi
if [ "$RETVAL" -ne "0" ]; then
Exit_error err_build_fail;
fi
unset BUILD_SWITCH
+ unset TARGET_SWITCH
}
nourl()
AVAIL_BCONDS_WITH=""
if `grep -q ^%bcond ${SPECFILE}`; then
BCOND_VERSION="NEW"
- elif `grep -q bcond ${SPECFILE}`; then
+ elif `egrep -q ^#\ *_with ${SPECFILE}`; then
BCOND_VERSION="OLD"
else
BCOND_VERSION="NONE"
BCOND="$BCOND $1 $2" ; shift 2 ;;
esac
;;
+ --target )
+ shift; TARGET="${1}"; shift ;;
-q | --quiet )
QUIET="--quiet"; shift ;;
--date )