Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Mar 2009 22:32:54 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190223 - stable/7/usr.sbin/mergemaster
Message-ID:  <200903212232.n2LMWslJ049015@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Sat Mar 21 22:32:53 2009
New Revision: 190223
URL: http://svn.freebsd.org/changeset/base/190223

Log:
  MFC r189761, r189763, r189992, r189994:
  1. Fix creation and saving of the new mtree file with the -D option
  2. Clean up usage() and man page so the options are all listed consistently
  3. Add -F option
  4. More man page cleanups for CVS -> VCS, punctuation, etc.

Modified:
  stable/7/usr.sbin/mergemaster/   (props changed)
  stable/7/usr.sbin/mergemaster/mergemaster.8
  stable/7/usr.sbin/mergemaster/mergemaster.sh

Modified: stable/7/usr.sbin/mergemaster/mergemaster.8
==============================================================================
--- stable/7/usr.sbin/mergemaster/mergemaster.8	Sat Mar 21 22:20:55 2009	(r190222)
+++ stable/7/usr.sbin/mergemaster/mergemaster.8	Sat Mar 21 22:32:53 2009	(r190223)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd January 2, 2009
+.Dd March 18, 2009
 .Dt MERGEMASTER 8
 .Os
 .Sh NAME
@@ -32,14 +32,14 @@
 .Nd merge configuration files, et al during an upgrade
 .Sh SYNOPSIS
 .Nm
-.Op Fl achiprsvCPU
-.Op Fl A Ar Target architecture
-.Op Fl D Ar /destdir/path
+.Op Fl scrvahipFCPU
 .Op Fl m Ar /path/to/sources
 .Op Fl t Ar /path/to/temp/root
 .Op Fl d
 .Op Fl u Ar N
 .Op Fl w Ar N
+.Op Fl A Ar Target architecture
+.Op Fl D Ar /destdir/path
 .Sh DESCRIPTION
 The
 .Nm
@@ -82,15 +82,23 @@ merge by hand later.
 By default it creates the temporary root in
 .Pa /var/tmp/temproot
 and compares the
-.Xr cvs 1
-version $Id/$FreeBSD strings for files that have them, deleting
+Version Control System (VCS) Id strings ($FreeBSD$)
+for files that have them, deleting
 the temporary file if the strings match.
 If there is
-no $Id string, or if the strings are different it
+no Id string, or if the strings are different it
 compares the files themselves.
 You can
-also specify that the script ignore the $Id strings and
-compare every file.
+also specify that the script ignore the Id strings and
+compare every file with the
+.Op Fl s
+option.
+Using the
+.Op Fl F
+option
+.Nm
+will install the new file for you if they differ only by
+VCS strings.
 .Pp
 The merge menu option is designed to let you easily combine your
 customizations from the old version of a file into the new one.
@@ -117,11 +125,13 @@ After
 installing an updated version of this file you should
 probably run
 .Xr pwd_mkdb 8
-with the -p option to rebuild your password databases
+with the
+.Op Fl p
+option to rebuild your password databases
 and recreate
 .Pa /etc/passwd .
 .Pp
-The script uses the owner and group id's
+The script uses the owner and group ids
 that the files are created with by
 .Pa /usr/src/etc/Makefile ,
 and file permissions as specified by the umask.
@@ -158,9 +168,9 @@ and therefore can override both files.
 The options are as follows:
 .Bl -tag -width Fl
 .It Fl s
-Perform a strict comparison, diff'ing every pair of files.
+Perform a strict comparison, diffing every pair of files.
 This comparison is performed line by line,
-without regard to CVS $Id's.
+without regard to VCS Ids.
 .It Fl c
 Use context diffs instead of unified diffs.
 .It Fl r
@@ -189,8 +199,11 @@ directory exists, it creates a new one i
 non-existent directory.
 This option unsets the verbose flag,
 but is compatible with all other options.
-Setting -a makes
--w superfluous.
+Setting
+.Op Fl a
+makes
+.Op Fl w
+superfluous.
 .It Fl h
 Display usage and help information.
 .It Fl i
@@ -202,6 +215,9 @@ Compares only files known to be essentia
 {build|install}world,
 including
 .Pa /etc/make.conf .
+.It Fl F
+If the files differ only by VCS Id ($FreeBSD$)
+install the new file.
 .It Fl C
 After a standard
 .Nm
@@ -213,6 +229,8 @@ Preserve files that you replace in
 or another directory you specify in your
 .Nm
 rc file.
+.It Fl U
+Attempt to auto upgrade files that have not been user modified.
 .It Fl m Ar /path/to/sources
 Specify the path to the directory where you want to do the
 .Xr make 1 .
@@ -234,7 +252,9 @@ instead of the default
 .It Fl d
 Add the date and time to the name of the temporary
 root directory.
-If -t is specified, this option must
+If
+.Op Fl t
+is specified, this option must
 follow it if you want the date added too.
 .It Fl u Ar N
 Specify a numeric umask.
@@ -250,8 +270,6 @@ Specify an alternative
 architecture name.
 .It Fl D Ar /path
 Specify the destination directory for the installed files.
-.It Fl U
-Attempt to auto upgrade files that have not been user modified.
 .El
 .Sh ENVIRONMENT
 The
@@ -314,12 +332,15 @@ with all values commented out:
 # Specify the destination directory for the installed files
 #DESTDIR=
 #
-# Strict comparison bypasses the CVS $Id tests and compares every file
+# Strict comparison skips the VCS Id test and compares every file
 #STRICT=no
 #
 # Type of diff, such as unified, context, etc.
 #DIFF_FLAG='-u'
 #
+# Install the new file if it differs only by VCS Id ($FreeBSD$)
+#FREEBSD_ID=
+#
 # Verbose mode includes more details and additional checks
 #VERBOSE=
 #
@@ -345,7 +366,7 @@ with all values commented out:
 #IGNORE_FILES='/etc/motd /etc/printcap foo bar'
 #
 # Additional options for diff.  This will get unset when using -s.
-#DIFF_OPTIONS='-I$\&FreeBSD:.*[$]'	# Ignores CVS Id tags
+#DIFF_OPTIONS='-Bb'	# Ignore changes in whitespace
 #
 # Location to store the list of mtree values for AUTO_UPGRADE purposes
 #MTREEDB='/var/db'
@@ -382,7 +403,7 @@ Typically all you will need to do is typ
 .Nm
 at the prompt and the script will do all the work for you.
 .Pp
-To use context diff's and have
+To use context diffs and have
 .Nm
 explain more things as it goes along, use:
 .Pp
@@ -401,7 +422,6 @@ comparison, use:
 .Pp
 .Dl # mergemaster -sw 110
 .Sh SEE ALSO
-.Xr cvs 1 ,
 .Xr diff 1 ,
 .Xr make 1 ,
 .Xr more 1 ,

Modified: stable/7/usr.sbin/mergemaster/mergemaster.sh
==============================================================================
--- stable/7/usr.sbin/mergemaster/mergemaster.sh	Sat Mar 21 22:20:55 2009	(r190222)
+++ stable/7/usr.sbin/mergemaster/mergemaster.sh	Sat Mar 21 22:32:53 2009	(r190223)
@@ -15,8 +15,8 @@ PATH=/bin:/usr/bin:/usr/sbin
 display_usage () {
   VERSION_NUMBER=`grep "[$]FreeBSD:" $0 | cut -d ' ' -f 4`
   echo "mergemaster version ${VERSION_NUMBER}"
-  echo 'Usage: mergemaster [-scrvahipCP] [-m /path]'
-  echo '         [-t /path] [-d] [-u N] [-w N] [-D /path]'
+  echo 'Usage: mergemaster [-scrvahipFCPU]'
+  echo '    [-m /path] [-t /path] [-d] [-u N] [-w N] [-A arch] [-D /path]'
   echo "Options:"
   echo "  -s  Strict comparison (diff every pair of files)"
   echo "  -c  Use context diff instead of unified diff"
@@ -26,8 +26,11 @@ display_usage () {
   echo "  -h  Display more complete help"
   echo '  -i  Automatically install files that do not exist in destination directory'
   echo '  -p  Pre-buildworld mode, only compares crucial files'
+  echo '  -F  Install files that differ only by revision control Id ($FreeBSD$)'
   echo '  -C  Compare local rc.conf variables to the defaults'
   echo '  -P  Preserve files that are overwritten'
+  echo "  -U  Attempt to auto upgrade files that have not been user modified"
+  echo ''
   echo "  -m /path/directory  Specify location of source to do the make in"
   echo "  -t /path/directory  Specify temp root directory"
   echo "  -d  Add date and time to directory name (e.g., /var/tmp/temproot.`date +%m%d.%H.%M`)"
@@ -35,7 +38,6 @@ display_usage () {
   echo "  -w N  Specify a screen width in columns to sdiff"
   echo "  -A architecture  Alternative architecture name to pass to make"
   echo '  -D /path/directory  Specify the destination directory to install files to'
-  echo "  -U Attempt to auto upgrade files that have not been user modified."
   echo ''
 }
 
@@ -263,11 +265,14 @@ MTREEFILE="${MTREEDB}/mergemaster.mtree"
 
 # Check the command line options
 #
-while getopts ":ascrvhipCPm:t:du:w:D:A:U" COMMAND_LINE_ARGUMENT ; do
+while getopts ":ascrvhipCPm:t:du:w:D:A:FU" COMMAND_LINE_ARGUMENT ; do
   case "${COMMAND_LINE_ARGUMENT}" in
   A)
     ARCHSTRING='TARGET_ARCH='${OPTARG}
     ;;
+  F)
+    FREEBSD_ID=yes
+    ;;
   U)
     AUTO_UPGRADE=yes
     ;;
@@ -671,7 +676,7 @@ find ${TEMPROOT} -type f -size 0 -delete
 # Build the mtree database in a temporary location.
 MTREENEW=`mktemp -t mergemaster.mtree`
 case "${PRE_WORLD}" in
-'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${DESTDIR}${MTREENEW} 2>/dev/null
+'') mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null
     ;;
 *) # We don't want to mess with the mtree database on a pre-world run.
    ;;
@@ -1020,6 +1025,19 @@ for COMPFILE in `find . -type f -size +0
       # Use more if not.
       # Use unified diffs by default.  Context diffs give me a headache. :)
       #
+      # If the user chose the -F option, test for that before proceeding
+      #
+      if [ -n "$FREEBSD_ID" ]; then
+        if diff -q -I'[$]FreeBSD:.*$' "${DESTDIR}${COMPFILE#.}" "${COMPFILE}" > \
+            /dev/null 2>&1; then
+          if mm_install "${COMPFILE}"; then
+            echo "*** Updated revision control Id for ${DESTDIR}${COMPFILE#.}"
+          else
+            echo "*** Problem installing ${COMPFILE}, it will remain to merge by hand later"
+          fi
+          continue
+        fi
+      fi
       case "${AUTO_RUN}" in
       '')
         # prompt user to install/delete/merge changes
@@ -1032,15 +1050,15 @@ for COMPFILE in `find . -type f -size +0
       esac # Auto run test
     fi # Yes, the files are different
   fi # Yes, the file still remains to be checked
-done # This is for the do way up there at the beginning of the comparison
+done # This is for the for way up there at the beginning of the comparison
 
 echo ''
 echo "*** Comparison complete"
 
-if [ -f "${DESTDIR}${MTREENEW}" ]; then
+if [ -f "${MTREENEW}" ]; then
   echo "*** Saving mtree database for future upgrades"
-  test -e "${MTREEFILE}" && unlink ${MTREEFILE}
-  mv ${DESTDIR}${MTREENEW} ${DESTDIR}${MTREEFILE}
+  test -e "${DESTDIR}${MTREEFILE}" && unlink ${DESTDIR}${MTREEFILE}
+  mv ${MTREENEW} ${DESTDIR}${MTREEFILE}
 fi
 
 echo ''



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200903212232.n2LMWslJ049015>