bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-18 Thread Stefano Lattarini
tags 10997 + patch
close 10997
thanks

On 03/17/2012 08:48 AM, Stefano Lattarini wrote:
> On 03/12/2012 02:43 PM, Stefano Lattarini wrote:
>> On 03/12/2012 12:21 PM, Peter Breitenlohner wrote:
>>>
>>> To summarize: 'nodist_bin_SCRIPTS =' is an extremely convenient way to
>>> ensure that $(bindir) -- or rather $(DESTDIR)$(bindir) -- exists.
>>>
>> I agree, and in fact I regard this as a feature (which automake has been 
>> known
>> to use in its own build system for some time).
>>
> I've now changed my mind, and started to consider this behaviour as a bug; see
> automake bug#11030:
> 
>   
> 
> A fix to that will obviously fix the present bug as well.
> 
This bug has now been fixed by the same patch fixing bug#11030.

Regards,
  Stefano





bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-17 Thread Stefano Lattarini
On 03/12/2012 02:43 PM, Stefano Lattarini wrote:
> On 03/12/2012 12:21 PM, Peter Breitenlohner wrote:
>>
>> To summarize: 'nodist_bin_SCRIPTS =' is an extremely convenient way to
>> ensure that $(bindir) -- or rather $(DESTDIR)$(bindir) -- exists.
>>
> I agree, and in fact I regard this as a feature (which automake has been known
> to use in its own build system for some time).
>
I've now changed my mind, and started to consider this behaviour as a bug; see
automake bug#11030:

  

A fix to that will obviously fix the present bug as well.

Regards,
  Stefano





bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-12 Thread Stefano Lattarini
On 03/12/2012 12:21 PM, Peter Breitenlohner wrote:
>
> Fixing this particular case might be fine, but please watch out.
> In the quite similar (unconditional) case
>   pkglibexec_SCRIPTS =
> one might actually expect that that $(pkglibexecdir) is created
> unconditionally.
>
> [SNIP]
> 
> To summarize: 'nodist_bin_SCRIPTS =' is an extremely convenient way to
> ensure that $(bindir) -- or rather $(DESTDIR)$(bindir) -- exists.
>
I agree, and in fact I regard this as a feature (which automake has been known
to use in its own build system for some time).

But I see (with a simple "grep 'test -d' tests/*" command) that this behaviour
wasn't covered by our testsuite.  I've thus added a new test to ensure we don't
unwittingly break this feature (see attached patch, pushed to maint).

Thanks,
  Stefano
>From e9927ea32d8fe5056123b021ff771cb906b1b3df Mon Sep 17 00:00:00 2001
Message-Id: 
From: Stefano Lattarini 
Date: Mon, 12 Mar 2012 14:41:04 +0100
Subject: [PATCH] coverage: an empty foo_PRIMARY should create directory
 $(foodir)

For example, a Makefile.am containing the definition:

  pkgdata_DATA =

should cause the 'install' rule of the generated Makefile.in to
create the '$(pkgdatadir)' directory (respecting any DESTDIR
setting as well).

Suggestion by Peter Breitenlohner in automake bug#10997.

Signed-off-by: Stefano Lattarini 
---
 tests/instdir-empty.test |   58 ++
 tests/list-of-tests.mk   |1 +
 2 files changed, 59 insertions(+), 0 deletions(-)
 create mode 100644 tests/instdir-empty.test

diff --git a/tests/instdir-empty.test b/tests/instdir-empty.test
new file mode 100644
index 000..f699583
--- /dev/null
+++ b/tests/instdir-empty.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2012 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 .
+
+# An empty "foo_PRIMARY" declaration should cause "make install" to create
+# directory $(foodir).  Suggested in discussion on automake bug#10997.
+
+. ./defs || Exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am << 'END'
+pkgdata_DATA =
+libexec_SCRIPTS =
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+cwd=`pwd`
+./configure --prefix="$cwd/inst"
+
+$MAKE install
+test -d inst/share/$me
+test -d inst/libexec
+rm -rf inst
+
+$MAKE install-exec
+test ! -d inst/share
+test -d inst/libexec
+rm -rf inst
+
+$MAKE install-data
+test -d inst/share/$me
+test ! -d inst/libexec
+rm -rf inst
+
+./configure --prefix=/foo
+$MAKE install DESTDIR=$cwd/dest
+test -d dest/foo/share/$me
+test -d dest/foo/libexec
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 7fd0376..0ee0711 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -460,6 +460,7 @@ instdat2.test \
 instdir.test \
 instdir2.test \
 instdir-cond.test \
+instdir-empty.test \
 instdir-java.test \
 instdir-lisp.test \
 instdir-ltlib.test \
-- 
1.7.9



bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-12 Thread Peter Breitenlohner

On Mon, 12 Mar 2012, Stefano Lattarini wrote:


On 03/12/2012 05:55 AM, Daiki Ueno wrote:

I got a bug report for my package, which conditionally installs some
scripts into pkglibexecdir like this:

if ENABLE_FOO
pkglibexec_SCRIPTS = bar
endif

where pkglibexec* is not referred outside of if...endif.  When "make
install", automake creates pkglibexecdir even when ENABLE_FOO is false.

I'm attaching a prove which demonstrates the behavior.


I agree it would be nice to avoid creating directories that are not actually
needed; still, this is a low-priority bug, and I'm not yet sure how difficult
it would be to fix.  For the moment, I've committed (in your name) the test
case you've sent us (with minor tweakings), so that the bug will at least
remain exposed in the testsuite.  Attached is the patch I've pushed (to maint).


Fixing this particular case might be fine, but please watch out.
In the quite similar (unconditional) case
  pkglibexec_SCRIPTS =
one might actually expect that that $(pkglibexecdir) is created
unconditionally.  (Perhaps because 'install-exec-local' or
'install-data-local' wants to install some files into that directory.)

In the TeX Live build system we actually use something quite analogous:
  nodist_bin_SCRIPTS =
  texmfdir = $(datarootdir)/texmf/scripts/xindy
  nodist_texmf_SCRIPTS = texindy.pl xindy.pl
  install-data-hook: install-perl-links
where 'install-perl-links' installs in $(bindir) the symbolic links
'texindy' and 'xindy' pointing to the respective perl scripts in
$(texmfdir).

To summarize: 'nodist_bin_SCRIPTS =' is an extremely convenient way to
ensure that $(bindir) -- or rather $(DESTDIR)$(bindir) -- exists.

Regards
Peter Breitenlohner 





bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-12 Thread Stefano Lattarini
severity 10997 minor
thanks

Hi Daiki, thanks for the report.

On 03/12/2012 05:55 AM, Daiki Ueno wrote:
> I got a bug report for my package, which conditionally installs some
> scripts into pkglibexecdir like this:
> 
> if ENABLE_FOO
> pkglibexec_SCRIPTS = bar
> endif
> 
> where pkglibexec* is not referred outside of if...endif.  When "make
> install", automake creates pkglibexecdir even when ENABLE_FOO is false.
> 
> I'm attaching a prove which demonstrates the behavior.
>
I agree it would be nice to avoid creating directories that are not actually
needed; still, this is a low-priority bug, and I'm not yet sure how difficult
it would be to fix.  For the moment, I've committed (in your name) the test
case you've sent us (with minor tweakings), so that the bug will at least
remain exposed in the testsuite.  Attached is the patch I've pushed (to maint).

Thanks,
  Stefano
>From b153660787dd7dea409ad969c29393c105e13bf2 Mon Sep 17 00:00:00 2001
Message-Id: 
From: Daiki Ueno 
Date: Mon, 12 Mar 2012 11:46:04 +0100
Subject: [PATCH] coverage: expose automake bug#10997

* tests/instdir-cond.test: New test.
* tests/list-of-tests.mk: Add it.
* tests/Makefile.am (XFAIL_TESTS): Likewise.

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini 
---
 tests/Makefile.am   |1 +
 tests/instdir-cond.test |   49 +++
 tests/list-of-tests.mk  |1 +
 3 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 tests/instdir-cond.test

diff --git a/tests/Makefile.am b/tests/Makefile.am
index b8ede30..9cac904 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ dist-auxfile.test \
 dist-auxfile-2.test \
 dist-pr109765.test \
 gcj6.test \
+instdir-cond.test \
 java-nobase.test \
 objext-pr10128.test \
 pr8365-remake-timing.test \
diff --git a/tests/instdir-cond.test b/tests/instdir-cond.test
new file mode 100644
index 000..8d83f88
--- /dev/null
+++ b/tests/instdir-cond.test
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2012 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 .
+
+# Check against automake bug#10997: directories holding only
+# conditionally-installed files should not be created unconditionally.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([ENABLE_FOO], [false])
+AC_OUTPUT
+END
+
+: > foo
+: > bar
+
+cat > Makefile.am << 'END'
+if ENABLE_FOO
+pkgdata_DATA = foo
+pkglibexec_SCRIPTS = bar
+endif
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/inst"
+
+$MAKE install
+test ! -d inst/share/instdir-cond
+test ! -d inst/libexec/instdir-cond
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 023bf3b..7fd0376 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -459,6 +459,7 @@ instdat.test \
 instdat2.test \
 instdir.test \
 instdir2.test \
+instdir-cond.test \
 instdir-java.test \
 instdir-lisp.test \
 instdir-ltlib.test \
-- 
1.7.9



bug#10997: pkglibexecdir is unconditionally created when make install

2012-03-12 Thread Daiki Ueno
I got a bug report for my package, which conditionally installs some
scripts into pkglibexecdir like this:

if ENABLE_FOO
pkglibexec_SCRIPTS = bar
endif

where pkglibexec* is not referred outside of if...endif.  When "make
install", automake creates pkglibexecdir even when ENABLE_FOO is false.

I'm attaching a prove which demonstrates the behavior.



instdir-cond.test
Description: Binary data
Regards,
-- 
Daiki Ueno