svn commit: r459675 - head/Mk/Scripts

Kyle Evans kevans at FreeBSD.org
Mon Jan 22 16:42:45 UTC 2018


Author: kevans (src committer)
Date: Mon Jan 22 16:42:44 2018
New Revision: 459675
URL: https://svnweb.freebsd.org/changeset/ports/459675

Log:
  `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

Modified:
  head/Mk/Scripts/smart_makepatch.sh

Modified: head/Mk/Scripts/smart_makepatch.sh
==============================================================================
--- head/Mk/Scripts/smart_makepatch.sh	Mon Jan 22 16:40:46 2018	(r459674)
+++ head/Mk/Scripts/smart_makepatch.sh	Mon Jan 22 16:42:44 2018	(r459675)
@@ -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


More information about the svn-ports-all mailing list