changeset 7643:d67f9dc6019d

New option --local-symlink.
author Bruno Haible <bruno@clisp.org>
date Mon, 13 Nov 2006 12:35:01 +0000
parents 0878abcc59c9
children 3c0ece164bab
files ChangeLog gnulib-tool
diffstat 2 files changed, 33 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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.
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -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 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 @@
 # - 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 @@
   do_changelog=:
   doit=:
   symbolic=
+  lsymbolic=
 
   supplied_opts="$@"
 
@@ -608,6 +612,9 @@
       -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 @@
 # - 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 @@
             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 @@
       # 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 @@
         cp -p "$lookedup_file" "$testdir/$g"
       else
         ln "$lookedup_file" "$testdir/$g" 2>/dev/null ||
-        if test -z "$symbolic"; then
+        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"
-        else
-          func_ln "$lookedup_file" "$testdir/$g"
         fi
       fi
     done