Author: jhb
Date: Fri Nov 15 20:01:07 2013
New Revision: 258185
URL: http://svnweb.freebsd.org/changeset/base/258185

Log:
  Fix a couple of issues with -F:
  - Fix ALWAYS_INSTALL to take precedence over the FreeBSD ID checks.
    In particular, always install a file where the only change was
    the FreeBSD ID even if -F is specified.
  - Fix the -F option in the case that the only upstream change is a
    change in the FreeBSD ID and the local file is removed.
  - Add tests for these two cases.

Modified:
  head/tools/regression/usr.sbin/etcupdate/fbsdid.sh
  head/usr.sbin/etcupdate/etcupdate.sh

Modified: head/tools/regression/usr.sbin/etcupdate/fbsdid.sh
==============================================================================
--- head/tools/regression/usr.sbin/etcupdate/fbsdid.sh  Fri Nov 15 19:58:31 
2013        (r258184)
+++ head/tools/regression/usr.sbin/etcupdate/fbsdid.sh  Fri Nov 15 20:01:07 
2013        (r258185)
@@ -195,6 +195,17 @@ EOF
 
 these are some local mods to the file
 EOF
+
+       # local-remove: A file removed locally changed it's FreeBSD ID
+       # but nothing else
+       store_id $OLD/local-remove ": head/local-remove 12000 jhb "
+       store_id $NEW/local-remove ": head/local-remove 12345 jhb "
+       for i in $OLD $NEW; do
+               cat >> $i/local-remove <<EOF
+
+this is a file
+EOF
+       done
 }
 
 # $1 - relative path to file that should be missing from TEST
@@ -282,6 +293,7 @@ cat > $WORKDIR/correct.out <<EOF
   C /add
 Warnings:
   Modified regular file remains: /remove
+  Removed file changed: /local-remove
 EOF
 
 echo "Differences for regular:"
@@ -299,6 +311,7 @@ conflict /conflict 868452f666fea1c60ffb9
 file /local "" aa33e614b5e749449f230e2a2b0072eb
 conflict /local 3df93e64043c8e348fc625b93ea220f4
 file /local-already "" 0298b958a603049f45ae6a109c4f7fea
+missing /local-remove
 
 # Now test with -F.
 
@@ -329,3 +342,38 @@ file /conflict "" dc27978df125b0daeb7d9b
 conflict /conflict 868452f666fea1c60ffb918ad9ad9607
 file /local "" 3ed5a35e380c8a93fb5f599d4c052713
 file /local-already "" 0298b958a603049f45ae6a109c4f7fea
+missing /local-remove
+
+# Now test with -F and -A forcing all installs.  (-A should have
+# precedence over -F)
+
+build_trees
+
+$COMMAND -A '/*' -rF -d $WORKDIR -D $TEST > $WORKDIR/testAF.out
+
+cat > $WORKDIR/correctAF.out <<EOF
+  D /remove
+  U /already
+  U /conflict
+  U /local
+  U /local-already
+  A /local-remove
+  U /old
+  U /add
+EOF
+
+echo "Differences for -A '/*' -F:"
+diff -u -L "correct" $WORKDIR/correctAF.out -L "test" $WORKDIR/testAF.out
+
+missing /remove
+file /old "" 6a9f34f109d94406a4de3bc5d72de259
+noconflict /old
+file /already "" 21f4eca3aacc702c49878c8da7afd3d0
+noconflict /already
+file /add "" 0208bd647111fedf6318511712ab9e97
+noconflict /add
+file /conflict "" 75ee141c4136beaf14e39de92efa84e4
+noconflict /conflict
+file /local "" 6a8fc5c2755b7a49015089f5e1dbe092
+file /local-already "" 49045f8b51542dd634655301cd296f66
+file /local-remove "" 5c38322efed4014797d7127f5c652d9d

Modified: head/usr.sbin/etcupdate/etcupdate.sh
==============================================================================
--- head/usr.sbin/etcupdate/etcupdate.sh        Fri Nov 15 19:58:31 2013        
(r258184)
+++ head/usr.sbin/etcupdate/etcupdate.sh        Fri Nov 15 20:01:07 2013        
(r258185)
@@ -1026,16 +1026,6 @@ handle_modified_file()
                fi
        fi
 
-       # If the only change in the new file versus the old file is a
-       # change in the FreeBSD ID string and -F is specified, just
-       # update the FreeBSD ID string in the local file.
-       if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
-           fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
-               if update_freebsdid $file; then
-                       continue
-               fi
-       fi
-
        # If the file was removed from the dest tree, just whine.
        if [ $newdestcmp -eq $COMPARE_ONLYFIRST ]; then
                # If the removed file matches an ALWAYS_INSTALL glob,
@@ -1050,6 +1040,14 @@ handle_modified_file()
                        return
                fi
 
+               # If the only change in the new file versus the old
+               # file is a change in the FreeBSD ID string and -F is
+               # specified, don't warn.
+               if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
+                   fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
+                       return
+               fi
+
                case $cmp in
                        $COMPARE_DIFFTYPE)
                                old=`file_type $OLDTREE/$file`
@@ -1080,6 +1078,16 @@ handle_modified_file()
                fi
        fi
 
+       # If the only change in the new file versus the old file is a
+       # change in the FreeBSD ID string and -F is specified, just
+       # update the FreeBSD ID string in the local file.
+       if [ -n "$FREEBSD_ID" -a $cmp -eq $COMPARE_DIFFFILES ] && \
+           fbsdid_only $OLDTREE/$file $NEWTREE/$file; then
+               if update_freebsdid $file; then
+                       continue
+               fi
+       fi
+
        # If the file changed types between the old and new trees but
        # the files in the new and dest tree are both of the same
        # type, treat it like an added file just comparing the new and
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to