aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-12 10:03:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-12 10:03:30 +0000
commit6c9815756b157005151d2203cd5765ed79da33cc (patch)
tree87b9312603d4cdefd58c691dd1e539000ef9a70a
parent9a2c41a771a6d3985c55542b1bfd71793af29b7a (diff)
downloadpaludis-6c9815756b157005151d2203cd5765ed79da33cc.tar.gz
paludis-6c9815756b157005151d2203cd5765ed79da33cc.tar.xz
Check digests
-rw-r--r--ebuild/builtin_fetch.bash59
1 files changed, 59 insertions, 0 deletions
diff --git a/ebuild/builtin_fetch.bash b/ebuild/builtin_fetch.bash
index 9249bec..62a6df1 100644
--- a/ebuild/builtin_fetch.bash
+++ b/ebuild/builtin_fetch.bash
@@ -62,6 +62,65 @@ builtin_fetch()
echo
die "builtin_fetch failed"
fi
+
+ local badfetch=
+ if [[ -f "${FILESDIR}/digest-${PN}-${PVR%-r0}" ]] ; then
+ local line items sum
+ while read line ; do
+ line=( ${line} )
+ if ! hasq "${line[2]}" ${A} ; then
+ ebuild_section "Skipping check for ${line[2]}"
+ continue
+ fi
+ case ${line[0]} in
+ MD5)
+ if [[ -f "${DISTDIR}/${line[2]}" ]] ; then
+ ebegin "Checking md5 for ${line[2]}"
+ sum=$(md5sum ${DISTDIR}/${line[2]} | cut -d ' ' -f1 )
+ if [[ "${sum}" == "${line[1]}" ]] ; then
+ eend 0
+ else
+ eend 1
+ badfetch="${badfetch} ${line[2]}"
+ fi
+ fi
+ ;;
+
+ RMD160)
+ if [[ -f "${DISTDIR}/${line[2]}" ]] ; then
+ ebegin "Checking rmd160 for ${line[2]}"
+ sum=$(openssl dgst -rmd160 ${DISTDIR}/${line[2]} | cut -d '=' -f2 )
+ if [[ "${sum# }" == "${line[1]}" ]] ; then
+ eend 0
+ else
+ eend 1
+ badfetch="${badfetch} ${line[2]}"
+ fi
+ fi
+ ;;
+
+ SHA256)
+ ;;
+
+ *)
+ ebuild_section "Skipping unknown digest '${line[0]}'"
+ ;;
+ esac
+ done < "${FILESDIR}"/digest-${PN}-${PVR%-r0}
+ else
+ ebuild_section "No digest file, skipping integrity checks"
+ fi
+
+ if [[ -n "${badfetch}" ]] ; then
+ local c
+ echo
+ eerror "Bad digests encountered for the following components:"
+ for c in ${badfetch} ; do
+ eerror " * ${c}"
+ done
+ echo
+ die "builtin_fetch failed"
+ fi
}
ebuild_f_fetch()