automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: honor nobase and $(transform) in installcheck-%DIR%PROGRAMS and ins


From: Alexandre Duret-Lutz
Subject: FYI: honor nobase and $(transform) in installcheck-%DIR%PROGRAMS and installcheck-%DIR%SCRIPTS
Date: 20 Jul 2002 17:41:09 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

I've found this while running distcheck on fileutils-4.1.10.
fileutils use a $(transform) trick to install `install'.  Unfortunately
installcheck-%DIR%PROGRAMS and installcheck-%DIR%SCRIPTS did not honor
$(transform), nor did they respect our base_/nobase_ conventions.

I'm installing the following fix on HEAD.

2002-07-20  Alexandre Duret-Lutz  <address@hidden>

        * tests/gnits2.test: Use --program-prefix.  Test for scripts too.
        Replace the sed script by calls to grep, easier to debug.
        * lib/am/progs.am (installcheck-%DIR%PROGRAMS): Honor nobase
        and $(transform).
        * lib/am/scripts.am (installcheck-%DIR%SCRIPTS): Likewise.

Index: lib/am/progs.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/progs.am,v
retrieving revision 1.37
diff -u -r1.37 progs.am
--- lib/am/progs.am     20 Jul 2002 15:11:50 -0000      1.37
+++ lib/am/progs.am     20 Jul 2002 15:34:15 -0000
@@ -109,11 +109,16 @@
 .PHONY installcheck-am: installcheck-%DIR%PROGRAMS
 installcheck-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
        bad=0; pid=$$$$; list="$(%DIR%_PROGRAMS)"; for p in $$list; do \
+## Strip the directory and $(EXEEXT) before applying $(transform).
+         f=`echo "$$p" | \
+            sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+## Insert the directory back if nobase_ is used.
+?!BASE?          f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
          for opt in --help --version; do \
-           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
+           if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
                 && test -n "`cat c$${pid}_.out`" \
                 && test -z "`cat c$${pid}_.err`"; then :; \
-           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+           else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
          done; \
        done; rm -f c$${pid}_.???; exit $$bad
 endif %?CK-OPTS%
Index: lib/am/scripts.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/scripts.am,v
retrieving revision 1.46
diff -u -r1.46 scripts.am
--- lib/am/scripts.am   20 Jul 2002 15:11:50 -0000      1.46
+++ lib/am/scripts.am   20 Jul 2002 15:34:15 -0000
@@ -88,11 +88,15 @@
 .PHONY installcheck-am: installcheck-%DIR%SCRIPTS
 installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
        bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
+## Strip any leading directory before applying $(transform).
+         f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \
+## Insert the directory back if nobase_ is used.
+?!BASE?          f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
          for opt in --help --version; do \
-           if $(DESTDIR)$(%NDIR%dir)/$$p $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
+           if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> 
c$${pid}_.err \
                 && test -n "`cat c$${pid}_.out`" \
                 && test -z "`cat c$${pid}_.err`"; then :; \
-           else echo "$$p does not support $$opt" 1>&2; bad=1; fi; \
+           else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
          done; \
        done; rm -f c$${pid}_.???; exit $$bad
 endif %?CK-OPTS%
Index: tests/gnits2.test
===================================================================
RCS file: /cvs/automake/automake/tests/gnits2.test,v
retrieving revision 1.1
diff -u -r1.1 gnits2.test
--- tests/gnits2.test   17 Jun 2002 12:20:25 -0000      1.1
+++ tests/gnits2.test   20 Jul 2002 15:34:17 -0000
@@ -13,45 +13,41 @@
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = gnits
 noinst_PROGRAMS = fubar2
-bin_PROGRAMS = fubar fine
+bin_PROGRAMS = fubar sub/fine
+nobase_bin_PROGRAMS = sub/fubar3
 fubar_SOURCES = fubar.c
-fubar2_SOURCES = fubar2.c
-fine_SOURCES = fine.c
+fubar2_SOURCES = fubar.c
+sub_fubar3_SOURCES = fubar.c
+sub_fine_SOURCES = fine.c
+bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh
 END
 
-echo 'main(int argc, char **argv) { exit(0); }' > fubar.c
-echo 'main(int argc, char **argv) { exit(0); }' > fubar2.c
+echo 'int main () { return 0; }' > fubar.c
 
 cat > fine.c << 'END'
 #include <stdio.h>
-main(int argc, char **argv) {
+int
+main ()
+{
   puts ("Which version? Which usage?");
-  exit(0);
+  return 0;
 }
 END
 
-cat > check.sed << 'END'
-/fubar does not/ {
-  s/.*/0/
-  H
-}
-/fubar2 does not/ {
-  s/.*/1/
-  H
-}
-/fine does not/ {
-  s/.*/1/
-  H
-}
-$!d
+mkdir sub
 
-g
-/^\n0\n0$/! {
-  s/.*/1/
-  q
-}
-s/.*/0/
-END
+cat >sub/scriptok.sh <<EOF
+#!/bin/sh
+echo "Which version? Which usage?"
+EOF
+
+cat >sub/scriptnok.sh <<EOF
+#!/bin/sh
+:
+EOF
+
+chmod +x sub/scriptok.sh
+chmod +x sub/scriptnok.sh
 
 # Files required by Gnits.
 : > INSTALL
@@ -68,11 +64,20 @@
 $AUTOCONF
 $AUTOMAKE -a
 
-mkdir sub
-cd sub
+mkdir build
+cd build
 
-../configure --prefix=`pwd`/../inst-dir
+# Use --program-prefix to make sure the std-options check honors it.
+../configure --prefix=`pwd`/../inst-dir --program-prefix=p
 $MAKE all
 $MAKE install
-exit `$MAKE installcheck 2>&1 | sed -f ../check.sed`
-
+test -f ../inst-dir/bin/pfine
+test ! -f ../inst-dir/bin/fine
+$MAKE -k installcheck 2>stderr && exit 1
+cat stderr
+grep 'pfubar does not support' stderr
+grep 'pfubar3 does not support' stderr
+grep 'pscriptnok.sh does not support' stderr
+# Only three failures please.
+test `grep 'does not support --help' stderr | wc -l` = 3
+test `grep 'does not support --version' stderr | wc -l` = 3

-- 
Alexandre Duret-Lutz




reply via email to

[Prev in Thread] Current Thread [Next in Thread]