# - builder -u fetches current version first
# - tries to get new version from distfiles without new md5
# - after fetching new version doesn't update md5
-# - doesn't get sources for specs with %include /usr/lib/rpm/macros.python
+# - doesn't get sources for specs with %include /usr/lib/rpm/macros.python
# when there's no rpm-pythonprov (rpm's fault, but it's ugly anyway)
+# - as above with %include /usr/lib/rpm/macros.perl and no rpm-perlprov
VERSION="\
Build package utility from PLD CVS repository
PACKAGE_RELEASE=""
PACKAGE_VERSION=""
PACKAGE_NAME=""
+PROTOCOL="ftp"
WGET_RETRIES=${MAX_WGET_RETRIES:-0}
CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
RES_FILE=""
CVS_SERVER="cvs.pld-linux.org"
-DISTFILES_SERVER="ftp://distfiles.pld-linux.org"
+DISTFILES_SERVER="://distfiles.pld-linux.org"
DEF_NICE_LEVEL=0
[-bb|--build-binary] [-bs|--build-source] [-u|--try-upgrade]
[{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>] [-g|--get]
- [-h|--help] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
+ [-h|--help] [--http] [{-l,--logtofile} <logfile>] [-m|--mr-proper]
[-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T--tag <cvstag>]
[-Tvs|--tag-version-stable] [-Tvn|--tag-version-nest]
[-Ts|--tag-stable] [-Tn|--tag-nest] [-Tv|--tag-version]
-g, --get - get <package>.spec and all related files from
CVS repo or HTTP/FTP,
-h, --help - this message,
+ --http - use http instead of ftp,
-l <logfile>, --logtofile <logfile>
- log all to file,
-m, --mr-proper - only remove all files related to spec file and
distfiles_url ()
{
- echo "$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
+ echo "$PROTOCOL$DISTFILES_SERVER/by-md5/$(src_md5 "$1" | sed -e 's|^\(.\)\(.\)|\1/\2/&|')/$(basename "$1")"
}
good_md5 ()
fi
fi
for i in $GET_FILES; do
+ FROM_DISTFILES=0
if [ ! -f `nourl $i` ] || [ $ALWAYS_CVSUP = "yes" ]; then
if echo $i | grep -vE '(http|ftp|https|cvs|svn)://' | grep -qE '\.(gz|bz2)$']; then
echo "Warning: no URL given for $i"
fi
target=$(nourl "$i")
url=$(distfiles_url "$i")
- if [ `echo $url | grep -E '^(\.|/)'` ] ; then
+ if [ `echo $url | grep -E '^(\.|/)'` ]; then
${GETLOCAL} $url $target
else
- if [ -z "$NOMIRRORS" ] ; then
+ FROM_DISTFILES=1
+ if [ -z "$NOMIRRORS" ]; then
url="`find_mirror "$url"`"
fi
${GETURI} -O "$target" "$url" || \
fi
if [ -z "$NOURLS" ] && [ ! -f "`nourl $i`" -o -n "$UPDATE" ] && [ `echo $i | grep -E 'ftp://|http://|https://'` ]; then
- if [ -z "$NOMIRRORS" ] ; then
+ if [ -z "$NOMIRRORS" ]; then
im="`find_mirror "$i"`"
else
im="$i"
$SPECS_DIR/$SPECFILE
fi
+ if good_md5 "$i"; then
+ :
+ elif [ "$FROM_DISTFILES" = 1 ]; then
+ # wrong md5 from distfiles: remove the file and try again
+ # but only once ...
+ echo "MD5 sum mismatch. Trying full fetch."
+ FROM_DISTFILES=2
+ rm -f $target
+ ${GETURI} -O "$target" "$url" || \
+ if [ `echo $url | grep -E 'ftp://'` ]; then
+ ${GETURI2} -O "$target" "$url"
+ fi
+ test -s "$target" || rm -f "$target"
+ fi
+
if good_md5 "$i"; then
:
else
COMMAND="get"; shift ;;
-h | --help )
COMMAND="usage"; shift ;;
+ --http )
+ PROTOCOL="http"; shift ;;
-l | --logtofile )
shift; LOGFILE="${1}"; shift ;;
-ni| --nice )