From: Gilles E. <ges...@us...> - 2007-11-30 07:32:30
|
Update of /cvsroot/ipcop/ipcop/lfs In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv17445/lfs Modified Files: Tag: IPCOP_v1_4_0 Config Log Message: Fix LOAD macro broken by recent changes It now load again Be more specific when an error happen Be more explicit on comments I add a WGET macro as loading was needed at various place. Not yet tested to use that macro on MD5 during build. Probably that could be done. I would too rework later how build.othersrc-list is made. Actually we waste space on sourceforge to upload a big package with parts that already come from Sourceforge. That may not be the best way to go. Index: Config =================================================================== RCS file: /cvsroot/ipcop/ipcop/lfs/Config,v retrieving revision 1.7.2.35 retrieving revision 1.7.2.36 diff -C2 -d -r1.7.2.35 -r1.7.2.36 *** Config 21 Nov 2007 07:51:58 -0000 1.7.2.35 --- Config 30 Nov 2007 07:32:27 -0000 1.7.2.36 *************** *** 118,139 **** endef define LOAD @echo -e "$(MESSAGE)Download: $($(notdir $@))" ! # if a file was yet fully loaded on /tmp, but _MD5 was wrong and fixed later, next wget will fail ! # prevent that case ! # check md5 after download to detect page not found answer or download error if [ -s $(DIR_TMP)/$(notdir $@) ]; then \ if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ else \ ! wget -T 120 -t 1 -c -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@); \ ! if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ ! mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ ! else \ ! echo "$(notdir $@) checksum is bad"; \ ! echo "$(notdir $@) may need to be removed from /tmp or download has been interrupt"; \ ! exit 1; \ ! fi; \ fi; \ fi endef --- 118,154 ---- endef + # This macro has to be in one line (so without comment), as called inside if .. then .. else + # check md5 after download to detect various page not found answers or download error + define WGET + wget -T 120 -t 1 -c -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@); \ + if [ "$$?" -ne 0 ]; then \ + echo "URL is wrong or download has been interrupt"; \ + else \ + if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ + mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ + else \ + echo "$(notdir $@) checksum is wrong"; \ + echo "Site answer with a custom error page or $(DIR_TMP)/$(notdir $@) content is corrupted"; \ + exit 1; \ + fi; \ + fi + endef + define LOAD @echo -e "$(MESSAGE)Download: $($(notdir $@))" ! # if a file was yet fully loaded on /tmp, but _MD5 was wrong and fixed later, ! # next wget will fail because of -c, so test md5 before ! # if file is found on /tmp but md5 does not match, continue to load ! # if file is not found on /tmp, load it if [ -s $(DIR_TMP)/$(notdir $@) ]; then \ if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ + echo "$(notdir $@) moved from $(DIR_TMP) to $(DIR_DL)"; \ mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ else \ ! echo "$(DIR_TMP)/$(notdir $@) was incomplete or wrong"; \ ! $(WGET); \ fi; \ + else \ + $(WGET); \ fi endef *************** *** 142,159 **** # error mean file signature don't match the one in lfs script # should be only the case when a md5 change but not the file name ! if [ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ]; then \ ! echo "$@ checksum OK"; \ ! echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log; \ else \ ! echo "A new md5 has been published for $@"; \ ! echo "Previous file is loaded again"; \ ! wget -T 120 -t 1 -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@); \ ! if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ ! mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ echo "$@ checksum OK"; \ echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log; \ else \ ! echo "$@ checksum still bad"; \ ! exit 1; \ fi; \ fi --- 157,178 ---- # error mean file signature don't match the one in lfs script # should be only the case when a md5 change but not the file name ! if [ ! -f $(DIR_DL)/$@ ]; then \ ! echo "$@ missing in $(DIR_DL)"; \ else \ ! if [ "$($@_MD5)" = `md5sum $(DIR_DL)/$@ | awk '{ print $$1 }'` ]; then \ echo "$@ checksum OK"; \ echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log; \ else \ ! echo "A new md5 has been published for $@"; \ ! echo "Previous file is loaded again"; \ ! wget -T 120 -t 1 -nv $($(notdir $@)) -O $(DIR_TMP)/$(notdir $@); \ ! if [ "$($(notdir $@)_MD5)" = `md5sum $(DIR_TMP)/$(notdir $@) | awk '{ print $$1 }'` ]; then \ ! mv $(DIR_TMP)/$(notdir $@) $(DIR_DL); \ ! echo "$@ checksum OK"; \ ! echo "$@" >>$(DIR_INFO)/_build.othersrc-list.log; \ ! else \ ! echo "$@ checksum still bad"; \ ! exit 1; \ ! fi; \ fi; \ fi |