From: Peter Rosin Date: Thu, 1 Mar 2012 08:30:45 +0000 (+0100) Subject: scripts: recognize the "q", "s" and "S" actions/modifiers in ar-lib X-Git-Tag: v1.11b~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d0391c50b8205ea6388cba13c16c09c18e57974;p=thirdparty%2Fautomake.git scripts: recognize the "q", "s" and "S" actions/modifiers in ar-lib * lib/ar-lib: Implement the "q" (quick) action as a synonym for "r" (replace). Ignore "s" (symbol index) and "S" (no symbol index) when used as modifiers and "s" when used as a command, there is simply no way for Microsoft lib to not update the symbol table index in the archive. (scriptversion): Update. * tests/ar-lib.test: Check the added behavior. Also add checks for the recently added "u" (update) and "v" (verbose) modifiers. --- diff --git a/lib/ar-lib b/lib/ar-lib index c698ac5dd..67f5f36f1 100755 --- a/lib/ar-lib +++ b/lib/ar-lib @@ -2,7 +2,7 @@ # Wrapper for Microsoft lib.exe me=ar-lib -scriptversion=2012-01-30.22; # UTC +scriptversion=2012-03-01.08; # UTC # Copyright (C) 2010-2012 Free Software Foundation, Inc. # Written by Peter Rosin . @@ -153,7 +153,9 @@ action=${action#-} delete= extract= list= +quick= replace= +index= create= while test -n "$action" @@ -162,7 +164,10 @@ do d*) delete=yes ;; x*) extract=yes ;; t*) list=yes ;; + q*) quick=yes ;; r*) replace=yes ;; + s*) index=yes ;; + S*) ;; # the index is always updated implicitly c*) create=yes ;; u*) ;; # TODO: don't ignore the update modifier v*) ;; # TODO: don't ignore the verbose modifier @@ -173,8 +178,8 @@ do action=${action#?} done -case $delete$extract$list$replace in - yes) +case $delete$extract$list$quick$replace,$index in + yes,* | ,yes) ;; yesyes*) func_error "more than one action specified" @@ -225,7 +230,7 @@ elif test -n "$extract"; then done fi -elif test -n "$replace"; then +elif test -n "$quick$replace"; then if test ! -f "$orig_archive"; then if test -z "$create"; then echo "$me: creating $orig_archive" diff --git a/tests/ar-lib.test b/tests/ar-lib.test index 035064588..1ddec64d8 100755 --- a/tests/ar-lib.test +++ b/tests/ar-lib.test @@ -45,6 +45,23 @@ touch foo.lib opts=`./ar-lib ./lib r foo.lib foo.obj` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" +# Check if ar-lib can update an existing archive with "q". +opts=`./ar-lib ./lib q foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "u" as a modifier. +# NOTE: "u" should have an effect, but currently doesn't. +opts=`./ar-lib ./lib ru foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "s" as a modifier. +opts=`./ar-lib ./lib rs foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + +# Check if ar-lib accepts "S" as a modifier. +opts=`./ar-lib ./lib rS foo.lib foo.obj` +test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib foo.obj" + # Check if ar-lib passes on @FILE with "r" opts=`./ar-lib ./lib r foo.lib @list` test x"$opts" = x"lib -NOLOGO -OUT:foo.lib foo.lib @list" @@ -62,6 +79,11 @@ test x"$opts" = x"lib -NOLOGO -REMOVE:foo.obj foo.lib" opts=`./ar-lib ./lib t foo.lib` test x"$opts" = x"lib -NOLOGO -LIST foo.lib" +# Check if ar-lib accepts "v" as a modifier. +# NOTE: "v" should have an effect, but currently doesn't. +opts=`./ar-lib ./lib tv foo.lib` +test x"$opts" = x"lib -NOLOGO -LIST foo.lib" + # Check if ar-lib can extract archive members with "x". touch fake.lib opts=`./ar-lib ./lib x fake.lib` @@ -84,4 +106,8 @@ touch fake2.lib opts=`./ar-lib ./lib x fake2.lib` test x"$opts" = x"lib -NOLOGO -EXTRACT:dir\\fake2.obj fake2.lib" +# Check if ar-lib accepts "s" as an action. +opts=`./ar-lib ./lib s foo.lib` +test x"$opts" = x + :