diff --git a/src/share/poudriere/common.sh b/src/share/poudriere/common.sh index ec92f82d..46842ccd 100755 --- a/src/share/poudriere/common.sh +++ b/src/share/poudriere/common.sh @@ -4209,6 +4209,7 @@ gather_distfiles() { local from to local sub dists d specials special origin local dep_originspec pkgname flavor subpkg + local srcsize dstsize doinstall from=$(realpath "$5") to=$(realpath "$6") @@ -4241,10 +4242,26 @@ gather_distfiles() { if [ ! -f "${from}/${sub}/${d}" ]; then continue fi - # XXX: A --relative would be nice - install -pS -m 0644 "${from}/${sub}/${d}" \ - "${to}/${sub}/${d}" || - return 1 + if [ ! -f "${to}/${sub}/${d}" ]; then + msg "GATHER_DISTFILES: missing ${to}/${sub}/${d}" + doinstall=1 + else + dstsize=$(stat -f %z ${to}/${sub}/${d}) + srcsize=$(stat -f %z ${from}/${sub}/${d}) + if [ $srcsize -ne $dstsize ]; then + msg "GATHER_DISTFILES: size mismatch ($srcsize != $dstsize), overwriting ${to}/${sub}/${d}" + doinstall=1 + else + msg "GATHER_DISTFILES: skipping copy ${to}/${sub}/${d}" + doinstall=0 + fi + fi + if [ $doinstall -eq 1 ]; then + # XXX: A --relative would be nice + install -pS -m 0644 "${from}/${sub}/${d}" \ + "${to}/${sub}/${d}" || + return 1 + fi done for special in ${specials}; do