New option --local-symlink.
authorBruno Haible <bruno@clisp.org>
Mon, 13 Nov 2006 12:35:01 +0000 (12:35 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 13 Nov 2006 12:35:01 +0000 (12:35 +0000)
ChangeLog
gnulib-tool

index 5519e86..ec49c98 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2006-11-12  Bruno Haible  <bruno@clisp.org>
 
+       * gnulib-tool: New option --local-symlink.
+       (func_usage): Document it.
+       (lsymbolic): New variable.
+       (func_import, func_create_testdir): If --symlink was not specified,
+       test whether --local-symlink was specified and the file comes from
+       the local_gnulib_dir.
+
+2006-11-12  Bruno Haible  <bruno@clisp.org>
+
        * gnulib-tool (func_ln): New function.
        (func_ln_if_changed, func_create_testdir): Use it instead of "ln -s".
 
index 22fe4f7..a60e7f1 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-11-13 12:34:33 $'
+cvsdatestamp='$Date: 2006-11-13 12:35:01 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -159,6 +159,8 @@ Options for --import:
 Options for --import and --update:
       --dry-run             For --import, only print what would have been done.
   -s, --symbolic, --symlink Make symbolic links instead of copying files.
+      --local-symlink       Make symbolic links instead of copying files, only
+                            for files from the local override directory.
 
 Report bugs to <bug-gnulib@gnu.org>."
 }
@@ -424,7 +426,8 @@ func_ln_if_changed ()
 # - autoconf_minversion  minimum supported autoconf version
 # - do_changelog    false if --no-changelog was given, : otherwise
 # - doit            : if actions shall be executed, false if only to be printed
-# - symbolic        true if --symbolic was given, blank otherwise
+# - symbolic        true if --symlink was given, blank otherwise
+# - lsymbolic       true if --local-symlink was given, blank otherwise
 {
   mode=
   destdir=
@@ -445,6 +448,7 @@ func_ln_if_changed ()
   do_changelog=:
   doit=:
   symbolic=
+  lsymbolic=
 
   supplied_opts="$@"
 
@@ -608,6 +612,9 @@ func_ln_if_changed ()
       -s | --symbolic | --symboli | --symbol | --symbo | --symb | --symlink | --symlin | --symli | --syml | --sym | --sy )
         symbolic=true
         shift ;;
+      --local-symlink | --local-symlin | --local-symli | --local-syml | --local-sym | --local-sy | --local-s )
+        lsymbolic=true
+        shift ;;
       --help | --hel | --he | --h )
         func_usage
         func_exit $? ;;
@@ -1450,6 +1457,8 @@ func_emit_initmacro_done ()
 # - autoconf_minversion  minimum supported autoconf version
 # - doit            : if actions shall be executed, false if only to be printed
 # - symbolic        true if files should be symlinked, copied otherwise
+# - lsymbolic       true if files from local_gnulib_dir should be symlinked,
+#                   copied otherwise
 func_import ()
 {
   # Get the cached settings.
@@ -1790,7 +1799,10 @@ func_import ()
             echo "Replacing file $g (non-gnulib code backuped in ${g}~) !!"
           fi
           mv -f "$destdir/$g" "$destdir/${g}~" || func_fatal_error "failed"
-          if test -n "$symbolic" && test -z "$lookedup_tmp" \
+          if { test -n "$symbolic" \
+               || { test -n "$lsymbolic" \
+                    && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
+             && test -z "$lookedup_tmp" \
              && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
             func_ln_if_changed "$lookedup_file" "$destdir/$g"
           else
@@ -1810,7 +1822,10 @@ func_import ()
       # frequently that developers don't put autogenerated files into CVS.
       if $doit; then
         echo "Copying file $g"
-        if test -n "$symbolic" && test -z "$lookedup_tmp" \
+        if { test -n "$symbolic" \
+             || { test -n "$lsymbolic" \
+                  && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; } \
+           && test -z "$lookedup_tmp" \
            && cmp "$lookedup_file" "$tmpfile" > /dev/null; then
           func_ln_if_changed "$lookedup_file" "$destdir/$g"
         else
@@ -2267,10 +2282,12 @@ func_create_testdir ()
         cp -p "$lookedup_file" "$testdir/$g"
       else
         ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
-        if test -z "$symbolic"; then
-          cp -p "$lookedup_file" "$testdir/$g"
-        else
+        if { test -n "$symbolic" \
+             || { test -n "$lsymbolic" \
+                  && test "$lookedup_file" = "$local_gnulib_dir/$f"; }; }; then
           func_ln "$lookedup_file" "$testdir/$g"
+        else
+          cp -p "$lookedup_file" "$testdir/$g"
         fi
       fi
     done