svn commit: r307788 - in stable/11: tools/build/mk usr.sbin usr.sbin/etcupdate

Baptiste Daroussin bapt at FreeBSD.org
Sat Oct 22 20:39:19 UTC 2016


Author: bapt
Date: Sat Oct 22 20:39:18 2016
New Revision: 307788
URL: https://svnweb.freebsd.org/changeset/base/307788

Log:
  MFC r303784, r303785, r305620:
  
  r303784:
  etcupdate: directly use diff3(1) instead of merge(1)
  
  During the last attempt to rmeove GNU rcs, 2 blockers were spotted:
  We need an ident(1) and etcupdate(8) uses merge(1).
  
  Now nothing should prevent to remove rcs from base
  
  Reviewed by:	jhb
  Differential Revision:	https://reviews.freebsd.org/D7401
  
  r303785:
  always install etcupdate
  
  Now that etcupdate does not depend on rcs anymore there is no need to
  conditionnally install it
  
  r305620: (by vangyzen )
  etcupdate: preserve the metadata of the destination file
  
  When using diff3 to perform a three-way merge, etcupdate lost the destination
  file's metadata. The metadata from the temporary file were used instead.
  This was unpleasant for rc.d scripts, which require execute permission.
  Use "cat >" to overwrite the destination file's contents while preserving its
  metadata.
  
  Reviewed by:	bapt
  Sponsored by:	Dell Technologies
  Differential Revision:	https://reviews.freebsd.org/D7817

Modified:
  stable/11/tools/build/mk/OptionalObsoleteFiles.inc
  stable/11/usr.sbin/Makefile
  stable/11/usr.sbin/etcupdate/etcupdate.sh
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/tools/build/mk/OptionalObsoleteFiles.inc
==============================================================================
--- stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Sat Oct 22 20:00:39 2016	(r307787)
+++ stable/11/tools/build/mk/OptionalObsoleteFiles.inc	Sat Oct 22 20:39:18 2016	(r307788)
@@ -6800,7 +6800,6 @@ OLD_FILES+=usr/bin/rcsdiff
 OLD_FILES+=usr/bin/rcsfreeze
 OLD_FILES+=usr/bin/rcsmerge
 OLD_FILES+=usr/bin/rlog
-OLD_FILES+=usr/sbin/etcupdate
 OLD_FILES+=usr/share/man/man1/ci.1.gz
 OLD_FILES+=usr/share/man/man1/co.1.gz
 OLD_FILES+=usr/share/man/man1/merge.1.gz
@@ -6812,16 +6811,6 @@ OLD_FILES+=usr/share/man/man1/rcsintro.1
 OLD_FILES+=usr/share/man/man1/rcsmerge.1.gz
 OLD_FILES+=usr/share/man/man1/rlog.1.gz
 OLD_FILES+=usr/share/man/man5/rcsfile.5.gz
-OLD_FILES+=usr/share/man/man8/etcupdate.8.gz
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/Kyuafile
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/always_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/conflicts_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/fbsdid_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/ignore_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/preworld_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/tests_test
-OLD_FILES+=usr/tests/usr.sbin/etcupdate/tzsetup_test
-OLD_DIRS+=usr/tests/usr.sbin/etcupdate
 .endif
 
 #.if ${MK_RESCUE} == no

Modified: stable/11/usr.sbin/Makefile
==============================================================================
--- stable/11/usr.sbin/Makefile	Sat Oct 22 20:00:39 2016	(r307787)
+++ stable/11/usr.sbin/Makefile	Sat Oct 22 20:39:18 2016	(r307788)
@@ -25,6 +25,7 @@ SUBDIR=	adduser \
 	digictl \
 	diskinfo \
 	dumpcis \
+	etcupdate \
 	extattr \
 	extattrctl \
 	fifolog \
@@ -188,7 +189,6 @@ SUBDIR.${MK_QUOTAS}+=	edquota
 SUBDIR.${MK_QUOTAS}+=	quotaon
 SUBDIR.${MK_QUOTAS}+=	repquota
 SUBDIR.${MK_RCMDS}+=	rwhod
-SUBDIR.${MK_RCS}+=	etcupdate
 SUBDIR.${MK_SENDMAIL}+=	editmap
 SUBDIR.${MK_SENDMAIL}+=	mailstats
 SUBDIR.${MK_SENDMAIL}+=	makemap

Modified: stable/11/usr.sbin/etcupdate/etcupdate.sh
==============================================================================
--- stable/11/usr.sbin/etcupdate/etcupdate.sh	Sat Oct 22 20:00:39 2016	(r307787)
+++ stable/11/usr.sbin/etcupdate/etcupdate.sh	Sat Oct 22 20:39:18 2016	(r307788)
@@ -814,15 +814,19 @@ merge_file()
 	local res
 
 	# Try the merge to see if there is a conflict.
-	merge -q -p ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 >/dev/null 2>&3
+	diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > /dev/null 2>&3
 	res=$?
 	case $res in
 		0)
 			# No conflicts, so just redo the merge to the
 			# real file.
-			log "merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1"
+			log "diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1"
 			if [ -z "$dryrun" ]; then
-				merge ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1
+				temp=$(mktemp -t etcupdate)
+				diff3 -E -m ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > ${temp}
+				# Use "cat >" to preserve metadata.
+				cat ${temp} > ${DESTDIR}$1
+				rm -f ${temp}
 			fi
 			post_install_file $1
 			echo "  M $1"
@@ -832,10 +836,10 @@ merge_file()
 			# the conflicts directory.
 			if [ -z "$dryrun" ]; then
 				install_dirs $NEWTREE $CONFLICTS $1
-				log "cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1"
-				cp -Rp ${DESTDIR}$1 ${CONFLICTS}$1 >&3 2>&1
-				merge -A -q -L "yours" -L "original" -L "new" \
-				    ${CONFLICTS}$1 ${OLDTREE}$1 ${NEWTREE}$1
+				log "diff3 -m -A ${DESTDIR}$1 ${CONFLICTS}$1"
+				diff3 -m -A -L "yours" -L "original" -L "new" \
+				    ${DESTDIR}$1 ${OLDTREE}$1 ${NEWTREE}$1 > \
+				    ${CONFLICTS}$1
 			fi
 			echo "  C $1"
 			;;


More information about the svn-src-all mailing list