From 081bebded2c4c0007d021038ce2fb93166cf7e99 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Mon, 13 Nov 2006 12:35:01 +0000 Subject: [PATCH] New option --local-symlink. --- ChangeLog | 9 +++++++++ gnulib-tool | 31 ++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5519e86b72..ec49c98b52 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-11-12 Bruno Haible + + * 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 * gnulib-tool (func_ln): New function. diff --git a/gnulib-tool b/gnulib-tool index 22fe4f799b..a60e7f1312 100755 --- 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: 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 ." } @@ -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 -- 2.30.2