automake-patches
[Top][All Lists]
Advanced

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

Re: bug#8234: check_JAVA built during make


From: Stefano Lattarini
Subject: Re: bug#8234: check_JAVA built during make
Date: Wed, 6 Apr 2011 18:52:24 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

tags 8234 patch
thanks

[adding automake-patches]

Hello Petteri.  Thanks for the report, and sorry for the delay.

On Saturday 12 March 2011, Petteri Räty wrote:
> http://sources.redhat.com/automake/automake.html
> 
> "The special prefix ‘check_’ indicates that the objects in question
> should not be built until the ‘make check’ command is run. Those objects
> are not installed either. "
> 
> It seems this is not how check_JAVA behaves currently. I added a
> Hello.java to the gnu Hello package and it seems to be always built when
> in check_JAVA.
> 
> http://ftp.gnu.org/gnu/hello/
> 
> make[2]: Entering directory `/home/betelgeuse/gsoc/hello-2.6'
> CLASSPATH=.:./.:$CLASSPATH javac -d .    Hello.java
> echo timestamp > classcheck.stamp
> make[2]: Leaving directory `/home/betelgeuse/gsoc/hello-2.6'
> 
> address@hidden ~/gsoc/hello-2.6 $ grep Hello.java Makefile.am
> check_JAVA = Hello.java
> 
> Petteri
> 
The attached patch should fix the bug.  The exposing testcase passes
with the modification to automake.in installed, and fails without.

OK for maint?  I'll push in 72 hours if there is no objection.

Regards,
  Stefano
From 92cb08ae3417b32803aecbf9e4fd4427ba2239ca Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Wed, 6 Apr 2011 18:49:44 +0200
Subject: [PATCH] java: check_JAVA does not cause compilation by "make all" 
anymore
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fixes automake bug#8234.

* automake.in (handle_java): Make stamp of class files built from
java sources in $(check_JAVA) a dependency of `check' target, not
`all' target.
* tests/java-check.test: New test.
* tests/Makefile.am (TESTS): Update.
* THANKS: Update.

Report from Petteri Räty.
---
 ChangeLog             |   12 +++++++++
 THANKS                |    1 +
 automake.in           |   10 ++++++-
 tests/Makefile.am     |    1 +
 tests/Makefile.in     |    1 +
 tests/java-check.test |   67 +++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 90 insertions(+), 2 deletions(-)
 create mode 100755 tests/java-check.test

diff --git a/ChangeLog b/ChangeLog
index 1be7709..6649603 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-04-06  Stefano Lattarini  <address@hidden>
+
+       java: check_JAVA does not cause compilation by "make all" anymore
+       Fixes automake bug#8234.
+       * automake.in (handle_java): Make stamp of class files built from
+       java sources in $(check_JAVA) a dependency of `check' target, not
+       `all' target.
+       * tests/java-check.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * THANKS: Update.
+       Report from Petteri Räty.
+
 2011-04-02  Stefano Lattarini  <address@hidden>
 
        tests: fix timestamp-related failures
diff --git a/THANKS b/THANKS
index 040da98..fafb02c 100644
--- a/THANKS
+++ b/THANKS
@@ -279,6 +279,7 @@ Peter O'Gorman              address@hidden
 Peter Rosin            address@hidden
 Peter Seiderer         address@hidden
 Petter Reinholdtsen    address@hidden
+Petteri Räty            address@hidden
 Phil Edwards           address@hidden
 Phil Nelson            address@hidden
 Philip Fong            address@hidden
diff --git a/automake.in b/automake.in
index d74730d..a8ec749 100755
--- a/automake.in
+++ b/automake.in
@@ -5121,8 +5121,14 @@ sub handle_java
        $dir = $curs;
       }
 
-
-    push (@all, 'class' . $dir . '.stamp');
+    if ($dir eq 'check')
+      {
+        push (@check, "class$dir.stamp");
+      }
+    else
+      {
+        push (@all, "class$dir.stamp");
+      }
 }
 
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index d4d9474..55e2b3e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -420,6 +420,7 @@ interp2.test \
 java.test \
 java2.test \
 java3.test \
+java-check.test \
 javaprim.test \
 javasubst.test \
 ldadd.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 4d4c21f..f256016 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -690,6 +690,7 @@ interp2.test \
 java.test \
 java2.test \
 java3.test \
+java-check.test \
 javaprim.test \
 javasubst.test \
 ldadd.test \
diff --git a/tests/java-check.test b/tests/java-check.test
new file mode 100755
index 0000000..05bc16d
--- /dev/null
+++ b/tests/java-check.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that check_JAVA causes *.class files to be build only with
+# "make check", and not also with "make all".
+# See automake bug#8234.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CHECK_PROG([HAS_JAVAC], [javac], [:], [exit])
+($HAS_JAVAC 77); $HAS_JAVAC 77
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+check_JAVA = One.java Two.java
+END
+
+cat > One.java <<'END'
+class One { }
+END
+
+cat > Two.java <<'END'
+class Two { // Deliberately missing closing bracket.
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+inst=`pwd`/_inst
+
+./configure --prefix="$inst"
+
+$MAKE
+ls | $EGREP '\.(class|stamp)$' && Exit 1
+
+# Make Two.java compilable.
+echo '}' >> Two.java
+
+# "make check" should compile files in $(check_JAVA) ...
+$MAKE check
+ls -l # for debugging
+test -f One.class
+test -f Two.class
+# ... but should *not* install them.
+$FGREP checkdir Makefile && Exit 1
+$MAKE install
+test -d _inst && Exit 1
+
+:
-- 
1.7.2.3


reply via email to

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