Removed old download POC code.

This commit is contained in:
Manuel Canales Esparcia 2006-05-03 19:17:30 +00:00
parent afa32dafe4
commit c7dbe781ec

View file

@ -759,101 +759,6 @@ get_sources() { # Download file, write name to MISSING_FILES.DMP if
} }
#----------------------------#
get_sourcesX() { # Download file, write name to MISSING_FILES.DMP if an error
#----------------------------#
local saveIFS=$IFS
local IFS line URL1 URL2 FILE MD5 NOMD5
# Test if the packages must be downloaded
if [ "$GETPKG" = "1" ] ; then
[[ ! -d $BUILDDIR/sources ]] && mkdir $BUILDDIR/sources
cd $BUILDDIR/sources
[[ -f MD5SUMS ]] && rm MD5SUMS
[[ -f MD5SUMS-$VERSION ]] && rm MD5SUMS-$VERSION
[[ -f MISSING_FILES.DMP ]] && rm MISSING_FILES.DMP
[[ -f urls.lst ]] && rm urls.lst
# Download a fresh MD5SUMS file
wget $SERVER/pub/lfs/conglomeration/MD5SUMS
# Generate URLs file
create_urls
IFS=$'\x0A' # Modify the 'internal field separator' to break on 'LF' only
for line in `cat urls.lst`; do
IFS=$saveIFS # Restore the system defaults
# Skip some packages if they aren't needed
case $line in
*/tcl* | */expect* | */dejagnu* | */tree* | */gcc-testsuite* )
[[ "$TEST" = "0" ]] && continue
;;
*/vim-*-lang* )
[[ "$VIMLANG" = "0" ]] && continue
;;
esac
URL1=`echo $line | cut -d" " -f1` # Upstream URL
URL2=`echo $line | cut -d" " -f2` # Fallback URL
FILE=`basename $URL2` # File name
# If the file exists in the archive copy it to the $BUILDDIR/sources dir
# MD5SUM is assumed to be correct from previous download
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -f ${SRC_ARCHIVE}/$FILE ]; then
cp ${SRC_ARCHIVE}/$FILE .
echo "$FILE: -- copied from $SRC_ARCHIVE" && continue
fi
# Find the md5 sum for this package.
set +e
MD5=`grep " $FILE" MD5SUMS`
if [ $? -ne 0 ]; then
set -e
echo "${RED}$FILE not found in MD5SUMS${OFF}"
echo "$FILE not found in MD5SUMS" >> MISSING_FILES.DMP
NOMD5=1
fi
set -e
if [ ! -f $FILE ] ; then
wget $URL1 || wget $URL2 || (echo "${RED}$FILE not found on the servers${OFF}" &&
echo "$FILE not found on the servers" >> MISSING_FILES.DMP )
elif [[ "$NOMD5" != "1" ]] && ! echo "$MD5" | md5sum -c - ; then
wget -N $URL1 || wget -N $URL2 || ( echo "${RED}$FILE not found on the servers${OFF}" &&
echo "$FILE not found on the servers" >> MISSING_FILES.DMP )
fi
if [[ "$NOMD5" != "1" ]] && ! echo "$MD5" | md5sum -c - ; then
echo "${RED}$FILE not match MD5SUMS value${OFF}"
echo "$FILE not match MD5SUMS value" >> MISSING_FILES.DMP
fi
echo `grep "$MD5" MD5SUMS` >> MD5SUMS-$VERSION
# Copy the freshly downloaded file
# to the source archive.
if [ ! -z ${SRC_ARCHIVE} ] &&
[ -d ${SRC_ARCHIVE} ] &&
[ -w ${SRC_ARCHIVE} ] &&
[ ! -f ${SRC_ARCHIVE}/$FILE ] ; then
echo "Store file:<$FILE> in package archive"
cp -v $FILE ${SRC_ARCHIVE}
fi
done
if [[ -s MISSING_FILES.DMP ]]; then
echo -e "\n\n${tab_}${RED} One or more files were not retrieved or have a bad MD5SUMS chechsum.\n${tab_} Check ${L_arrow}$BUILDDIR/sources/MISSING_FILES.DMP${R_arrow} for names ${OFF}\n\n"
fi
fi
}
#----------------------------# #----------------------------#
create_urls() { # create_urls() { #
#----------------------------# #----------------------------#