aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authorkevans <kevans@FreeBSD.org>2018-01-23 00:42:44 +0800
committerkevans <kevans@FreeBSD.org>2018-01-23 00:42:44 +0800
commite8a7e8637c7426a163d6c4462b2dc21436f9f500 (patch)
treeedcc2f0d7119b28bc51152dff4f3cbce08c6dd21 /Mk
parent2f2887459947e98f3b8496d28c5cf670bc521198 (diff)
downloadfreebsd-ports-gnome-e8a7e8637c7426a163d6c4462b2dc21436f9f500.tar.gz
freebsd-ports-gnome-e8a7e8637c7426a163d6c4462b2dc21436f9f500.tar.zst
freebsd-ports-gnome-e8a7e8637c7426a163d6c4462b2dc21436f9f500.zip
`make makepatch`: Don't replace patches with only metadata changes
Rather than replacing patches that are effectively the same but with different timestamps, drop the new version and let the old version remain in place. This yields a `make makepatch` that doesn't try and produce unwanted churn. Approved by: portmgr (mat) Differential Revision: https://reviews.freebsd.org/D13960
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Scripts/smart_makepatch.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/Mk/Scripts/smart_makepatch.sh b/Mk/Scripts/smart_makepatch.sh
index b84416b235d1..41f96e5e6399 100644
--- a/Mk/Scripts/smart_makepatch.sh
+++ b/Mk/Scripts/smart_makepatch.sh
@@ -230,6 +230,38 @@ stage_patches() {
done
}
+compare_common_patches() {
+ [ -z "${old_patch_list}" ] && return
+ local archive_patch_list
+ local P
+ local ppatch
+ local ppatch_stripped
+ local cpatch
+ local cpatch_stripped
+ for P in ${old_patch_list}; do
+ if [ -e ${DESTDIR}/${P} ]; then
+ ppatch=${PATCHDIR}/${P}
+ cpatch=${DESTDIR}/${P}
+ ppatch_stripped=$(mktemp -t portpatch)
+ cpatch_stripped=$(mktemp -t portpatch)
+ egrep -v -- '--- .+ UTC$' ${ppatch} \
+ > ${ppatch_stripped}
+ egrep -v -- '--- .+ UTC$' ${cpatch} \
+ > ${cpatch_stripped}
+ # Don't replace patches with only metadata changes
+ if ! cmp -s ${ppatch_stripped} ${cpatch_stripped}; then
+ archive_patch_list="${archive_patch_list} ${P}"
+ else
+ echo "${P} only contains metadata changes; not replacing"
+ rm ${cpatch}
+ fi
+ rm ${ppatch_stripped}
+ rm ${cpatch_stripped}
+ fi
+ done
+ old_patch_list=${archive_patch_list}
+}
+
conserve_old_patches() {
mkdir -p ${SAVEDIR}
rm -f ${SAVEDIR}/*
@@ -257,5 +289,6 @@ map_existing_patches
extract_comments
regenerate_patches
stage_patches
+compare_common_patches
conserve_old_patches
install_regenerated_patches