public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: GDB Patches <gdb-patches@sourceware.org>,
	 Tom Tromey <tom@tromey.com>,
	 Simon Marchi <simon.marchi@polymtl.ca>
Subject: Re: [PATCH] Automatically update "aclocal_m4_deps" when updating gnulib
Date: Mon, 03 Sep 2018 21:18:00 -0000	[thread overview]
Message-ID: <8736uq1drt.fsf@redhat.com> (raw)
In-Reply-To: <bca7e28e-9897-9cfe-9c2b-3775610b8f09@redhat.com> (Pedro Alves's	message of "Mon, 3 Sep 2018 12:14:44 +0100")

[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]

On Monday, September 03 2018, Pedro Alves wrote:

> On 09/02/2018 10:21 PM, Sergio Durigan Junior wrote:
>> When we update gnulib using our "update-gnulib.sh" tool, it doesn't
>> automatically update the list of M4 files present at
>> gnulib/Makefile.in:aclocal_m4_deps.  This patch extends the tool to do
>> that.  It also puts "aclocal_m4_deps" in its own file (a Makefile
>> fragment), so that it's easier to update it programatically.
>> 
>> Tested by generating the file and diff'ing the results against the
>> current version of "aclocal_m4_deps".
>
> Thanks for doing this.

Thanks for the review.

> Three remarks below.
>
>> diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
>> index 3dcafeb3e6..6c10c8a8c4 100755
>> --- a/gdb/gnulib/update-gnulib.sh
>> +++ b/gdb/gnulib/update-gnulib.sh
>> @@ -167,3 +167,9 @@ if [ $? -ne 0 ]; then
>>     exit 1
>>  fi
>>  
>> +# Update aclocal-m4-deps.mk
>> +cat > aclocal-m4-deps.mk <<EOF
>> +aclocal_m4_deps = \\
>> +	configure.ac \\
>> +$(find import/m4 -type f -name "*.m4" | sed 's/^/\t/; s/$/ \\/; $s/ \\//g')
>> +EOF
>
> #1 
>
> I'd find it a little better to make it so that the new file only includes
> the M4 files, and leave adding configure.ac to Makefile.in.  I.e., put
> the m4 files list in a different variable here and them do something like:
>
>  # Fill in $m4_files
>  include $(srcdir)/m4-files.mk
>
>  aclocal_m4_deps = configure.ac $m4_files
>
> in Makefile.in, or, tweak the rule to include configure.ac directly:
>
>   $(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ configure.ac $(m4_files)

Done.

> I think it'll be good practice to generate the file to a temporary
> name, and then use move-if-change to atomically update the destination,
> in case someone Ctrl-Cs just while the script is halfway generated.
>
> I.e.:
>
>  cat > foo.mk.tmp <<EOF
>  .....
>  $(srcdir)/..../move-if-change foo.mk.tmp foo.mk

Done.

> #3 
>
> Could you also make the script emit a header in the new file that
> reads:
>
>   # THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
>
> That would make emacs and vi open the file in read-only mode.

Done.

Here's the updated version of the patch.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Automatically-update-aclocal_m4_deps-when-updating-g.patch --]
[-- Type: text/x-patch, Size: 9833 bytes --]

From 36d5af6256f788f2d6cc3ff4238d24cd2a52bdbc Mon Sep 17 00:00:00 2001
From: Sergio Durigan Junior <sergiodj@redhat.com>
Date: Sun, 2 Sep 2018 17:11:46 -0400
Subject: [PATCH] Automatically update "aclocal_m4_deps" when updating gnulib

When we update gnulib using our "update-gnulib.sh" tool, it doesn't
automatically update the list of M4 files present at
gnulib/Makefile.in:aclocal_m4_deps.  This patch extends the tool to do
that.  It also puts "aclocal_m4_deps" in its own file (a Makefile
fragment), so that it's easier to update it programatically.

Tested by generating the file and diff'ing the results against the
current version of "aclocal_m4_deps".

gdb/ChangeLog:
2018-09-02  Sergio Durigan Junior  <sergiodj@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	* gnulib/Makefile.in (aclocal_m4_deps): Move to
	"aclocal-m4-deps.mk".  Include file here.
	$(srcdir)/aclocal.m4: Add "configure.ac".
	* gnulib/aclocal-m4-deps.mk: New file.
	* gnulib/update-gnulib.sh: Automatically update
	"aclocal-m4-deps.mk".
---
 gdb/gnulib/Makefile.in        | 142 +---------------------------------
 gdb/gnulib/aclocal-m4-deps.mk | 136 ++++++++++++++++++++++++++++++++
 gdb/gnulib/update-gnulib.sh   |  10 +++
 3 files changed, 150 insertions(+), 138 deletions(-)
 create mode 100644 gdb/gnulib/aclocal-m4-deps.mk

diff --git a/gdb/gnulib/Makefile.in b/gdb/gnulib/Makefile.in
index 1602da54b6..df0e611341 100644
--- a/gdb/gnulib/Makefile.in
+++ b/gdb/gnulib/Makefile.in
@@ -205,144 +205,10 @@ config.status: $(srcdir)/configure
 
 ACLOCAL = aclocal
 ACLOCAL_AMFLAGS = -I import/m4 -I ../../config
-aclocal_m4_deps = \
-	configure.ac \
-	import/m4/flexmember.m4 \
-	import/m4/eealloc.m4 \
-	import/m4/mkdir.m4 \
-	import/m4/close.m4 \
-	import/m4/unistd-safer.m4 \
-	import/m4/inttypes-pri.m4 \
-	import/m4/chdir-long.m4 \
-	import/m4/gnulib-common.m4 \
-	import/m4/readdir.m4 \
-	import/m4/stdlib_h.m4 \
-	import/m4/getlogin_r.m4 \
-	import/m4/warn-on-use.m4 \
-	import/m4/getdtablesize.m4 \
-	import/m4/rewinddir.m4 \
-	import/m4/string_h.m4 \
-	import/m4/closedir.m4 \
-	import/m4/canonicalize.m4 \
-	import/m4/stdio_h.m4 \
-	import/m4/fdopendir.m4 \
-	import/m4/getcwd-abort-bug.m4 \
-	import/m4/alloca.m4 \
-	import/m4/strstr.m4 \
-	import/m4/stat-time.m4 \
-	import/m4/builtin-expect.m4 \
-	import/m4/rawmemchr.m4 \
-	import/m4/msvc-nothrow.m4 \
-	import/m4/absolute-header.m4 \
-	import/m4/isnanl.m4 \
-	import/m4/stddef_h.m4 \
-	import/m4/gnulib-tool.m4 \
-	import/m4/realloc.m4 \
-	import/m4/d-type.m4 \
-	import/m4/frexp.m4 \
-	import/m4/getcwd-path-max.m4 \
-	import/m4/dup2.m4 \
-	import/m4/strtok_r.m4 \
-	import/m4/exponentd.m4 \
-	import/m4/std-gnu11.m4 \
-	import/m4/locale-ja.m4 \
-	import/m4/gettimeofday.m4 \
-	import/m4/time_h.m4 \
-	import/m4/malloc.m4 \
-	import/m4/fnmatch_h.m4 \
-	import/m4/codeset.m4 \
-	import/m4/getcwd.m4 \
-	import/m4/readlink.m4 \
-	import/m4/locale-zh.m4 \
-	import/m4/stdint.m4 \
-	import/m4/memrchr.m4 \
-	import/m4/onceonly.m4 \
-	import/m4/pathmax.m4 \
-	import/m4/rename.m4 \
-	import/m4/rmdir.m4 \
-	import/m4/dup.m4 \
-	import/m4/errno_h.m4 \
-	import/m4/mbrtowc.m4 \
-	import/m4/environ.m4 \
-	import/m4/wchar_h.m4 \
-	import/m4/strchrnul.m4 \
-	import/m4/fcntl_h.m4 \
-	import/m4/getpagesize.m4 \
-	import/m4/largefile.m4 \
-	import/m4/openat.m4 \
-	import/m4/save-cwd.m4 \
-	import/m4/stat.m4 \
-	import/m4/include_next.m4 \
-	import/m4/mmap-anon.m4 \
-	import/m4/mode_t.m4 \
-	import/m4/exponentl.m4 \
-	import/m4/sys_types_h.m4 \
-	import/m4/fcntl-o.m4 \
-	import/m4/stdbool.m4 \
-	import/m4/float_h.m4 \
-	import/m4/msvc-inval.m4 \
-	import/m4/wctype_h.m4 \
-	import/m4/gnulib-cache.m4 \
-	import/m4/mbsrtowcs.m4 \
-	import/m4/limits-h.m4 \
-	import/m4/locale-fr.m4 \
-	import/m4/fstatat.m4 \
-	import/m4/inttypes.m4 \
-	import/m4/memchr.m4 \
-	import/m4/glob.m4 \
-	import/m4/fstat.m4 \
-	import/m4/sys_stat_h.m4 \
-	import/m4/off_t.m4 \
-	import/m4/strdup.m4 \
-	import/m4/ssize_t.m4 \
-	import/m4/math_h.m4 \
-	import/m4/unistd_h.m4 \
-	import/m4/fpieee.m4 \
-	import/m4/mempcpy.m4 \
-	import/m4/wint_t.m4 \
-	import/m4/d-ino.m4 \
-	import/m4/setenv.m4 \
-	import/m4/open-cloexec.m4 \
-	import/m4/longlong.m4 \
-	import/m4/multiarch.m4 \
-	import/m4/filenamecat.m4 \
-	import/m4/gnulib-comp.m4 \
-	import/m4/mkstemp.m4 \
-	import/m4/dirfd.m4 \
-	import/m4/getlogin.m4 \
-	import/m4/signal_h.m4 \
-	import/m4/sys_socket_h.m4 \
-	import/m4/dirname.m4 \
-	import/m4/00gnulib.m4 \
-	import/m4/dirent_h.m4 \
-	import/m4/opendir.m4 \
-	import/m4/error.m4 \
-	import/m4/extensions.m4 \
-	import/m4/fchdir.m4 \
-	import/m4/mbsinit.m4 \
-	import/m4/__inline.m4 \
-	import/m4/extern-inline.m4 \
-	import/m4/fnmatch.m4 \
-	import/m4/lstat.m4 \
-	import/m4/nocrash.m4 \
-	import/m4/sys_time_h.m4 \
-	import/m4/localcharset.m4 \
-	import/m4/open.m4 \
-	import/m4/localtime-buffer.m4 \
-	import/m4/getprogname.m4 \
-	import/m4/wchar_t.m4 \
-	import/m4/isnand.m4 \
-	import/m4/double-slash-root.m4 \
-	import/m4/malloca.m4 \
-	import/m4/fcntl.m4 \
-	import/m4/frexpl.m4 \
-	import/m4/strerror.m4 \
-	import/m4/glob_h.m4 \
-	import/m4/tempname.m4 \
-	import/m4/memmem.m4 \
-	import/m4/mbstate_t.m4
-
-$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ $(aclocal_m4_deps)
+
+include $(srcdir)/aclocal-m4-deps.mk
+
+$(srcdir)/aclocal.m4: @MAINTAINER_MODE_TRUE@ configure.ac $(aclocal_m4_deps)
 	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
 
 AUTOCONF = autoconf
diff --git a/gdb/gnulib/aclocal-m4-deps.mk b/gdb/gnulib/aclocal-m4-deps.mk
new file mode 100644
index 0000000000..52d280db30
--- /dev/null
+++ b/gdb/gnulib/aclocal-m4-deps.mk
@@ -0,0 +1,136 @@
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
+aclocal_m4_deps = \
+	import/m4/flexmember.m4 \
+	import/m4/eealloc.m4 \
+	import/m4/mkdir.m4 \
+	import/m4/close.m4 \
+	import/m4/unistd-safer.m4 \
+	import/m4/inttypes-pri.m4 \
+	import/m4/chdir-long.m4 \
+	import/m4/gnulib-common.m4 \
+	import/m4/readdir.m4 \
+	import/m4/stdlib_h.m4 \
+	import/m4/getlogin_r.m4 \
+	import/m4/warn-on-use.m4 \
+	import/m4/getdtablesize.m4 \
+	import/m4/rewinddir.m4 \
+	import/m4/string_h.m4 \
+	import/m4/closedir.m4 \
+	import/m4/canonicalize.m4 \
+	import/m4/stdio_h.m4 \
+	import/m4/fdopendir.m4 \
+	import/m4/getcwd-abort-bug.m4 \
+	import/m4/alloca.m4 \
+	import/m4/strstr.m4 \
+	import/m4/stat-time.m4 \
+	import/m4/builtin-expect.m4 \
+	import/m4/rawmemchr.m4 \
+	import/m4/msvc-nothrow.m4 \
+	import/m4/absolute-header.m4 \
+	import/m4/isnanl.m4 \
+	import/m4/stddef_h.m4 \
+	import/m4/gnulib-tool.m4 \
+	import/m4/realloc.m4 \
+	import/m4/d-type.m4 \
+	import/m4/frexp.m4 \
+	import/m4/getcwd-path-max.m4 \
+	import/m4/dup2.m4 \
+	import/m4/strtok_r.m4 \
+	import/m4/exponentd.m4 \
+	import/m4/std-gnu11.m4 \
+	import/m4/locale-ja.m4 \
+	import/m4/gettimeofday.m4 \
+	import/m4/time_h.m4 \
+	import/m4/malloc.m4 \
+	import/m4/fnmatch_h.m4 \
+	import/m4/codeset.m4 \
+	import/m4/getcwd.m4 \
+	import/m4/readlink.m4 \
+	import/m4/locale-zh.m4 \
+	import/m4/stdint.m4 \
+	import/m4/memrchr.m4 \
+	import/m4/onceonly.m4 \
+	import/m4/pathmax.m4 \
+	import/m4/rename.m4 \
+	import/m4/rmdir.m4 \
+	import/m4/dup.m4 \
+	import/m4/errno_h.m4 \
+	import/m4/mbrtowc.m4 \
+	import/m4/environ.m4 \
+	import/m4/wchar_h.m4 \
+	import/m4/strchrnul.m4 \
+	import/m4/fcntl_h.m4 \
+	import/m4/getpagesize.m4 \
+	import/m4/largefile.m4 \
+	import/m4/openat.m4 \
+	import/m4/save-cwd.m4 \
+	import/m4/stat.m4 \
+	import/m4/include_next.m4 \
+	import/m4/mmap-anon.m4 \
+	import/m4/mode_t.m4 \
+	import/m4/exponentl.m4 \
+	import/m4/sys_types_h.m4 \
+	import/m4/fcntl-o.m4 \
+	import/m4/stdbool.m4 \
+	import/m4/float_h.m4 \
+	import/m4/msvc-inval.m4 \
+	import/m4/wctype_h.m4 \
+	import/m4/gnulib-cache.m4 \
+	import/m4/mbsrtowcs.m4 \
+	import/m4/limits-h.m4 \
+	import/m4/locale-fr.m4 \
+	import/m4/fstatat.m4 \
+	import/m4/inttypes.m4 \
+	import/m4/memchr.m4 \
+	import/m4/glob.m4 \
+	import/m4/fstat.m4 \
+	import/m4/sys_stat_h.m4 \
+	import/m4/off_t.m4 \
+	import/m4/strdup.m4 \
+	import/m4/ssize_t.m4 \
+	import/m4/math_h.m4 \
+	import/m4/unistd_h.m4 \
+	import/m4/fpieee.m4 \
+	import/m4/mempcpy.m4 \
+	import/m4/wint_t.m4 \
+	import/m4/d-ino.m4 \
+	import/m4/setenv.m4 \
+	import/m4/open-cloexec.m4 \
+	import/m4/longlong.m4 \
+	import/m4/multiarch.m4 \
+	import/m4/filenamecat.m4 \
+	import/m4/gnulib-comp.m4 \
+	import/m4/mkstemp.m4 \
+	import/m4/dirfd.m4 \
+	import/m4/getlogin.m4 \
+	import/m4/signal_h.m4 \
+	import/m4/sys_socket_h.m4 \
+	import/m4/dirname.m4 \
+	import/m4/00gnulib.m4 \
+	import/m4/dirent_h.m4 \
+	import/m4/opendir.m4 \
+	import/m4/error.m4 \
+	import/m4/extensions.m4 \
+	import/m4/fchdir.m4 \
+	import/m4/mbsinit.m4 \
+	import/m4/__inline.m4 \
+	import/m4/extern-inline.m4 \
+	import/m4/fnmatch.m4 \
+	import/m4/lstat.m4 \
+	import/m4/nocrash.m4 \
+	import/m4/sys_time_h.m4 \
+	import/m4/localcharset.m4 \
+	import/m4/open.m4 \
+	import/m4/localtime-buffer.m4 \
+	import/m4/getprogname.m4 \
+	import/m4/wchar_t.m4 \
+	import/m4/isnand.m4 \
+	import/m4/double-slash-root.m4 \
+	import/m4/malloca.m4 \
+	import/m4/fcntl.m4 \
+	import/m4/frexpl.m4 \
+	import/m4/strerror.m4 \
+	import/m4/glob_h.m4 \
+	import/m4/tempname.m4 \
+	import/m4/memmem.m4 \
+	import/m4/mbstate_t.m4
diff --git a/gdb/gnulib/update-gnulib.sh b/gdb/gnulib/update-gnulib.sh
index 3dcafeb3e6..5d29e287a4 100755
--- a/gdb/gnulib/update-gnulib.sh
+++ b/gdb/gnulib/update-gnulib.sh
@@ -167,3 +167,13 @@ if [ $? -ne 0 ]; then
    exit 1
 fi
 
+# Update aclocal-m4-deps.mk
+ACLOCAL_M4_DEPS_FILE=aclocal-m4-deps.mk
+cat > ${ACLOCAL_M4_DEPS_FILE}.tmp <<EOF
+# THIS FILE IS GENERATED.  -*- buffer-read-only: t -*- vi :set ro:
+aclocal_m4_deps = \\
+$(find import/m4 -type f -name "*.m4" | sed 's/^/\t/; s/$/ \\/; $s/ \\//g')
+EOF
+
+../../move-if-change ${ACLOCAL_M4_DEPS_FILE}.tmp ${ACLOCAL_M4_DEPS_FILE}
+rm -f ${ACLOCAL_M4_DEPS_FILE}.tmp
-- 
2.17.1


  reply	other threads:[~2018-09-03 21:18 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-28 19:59 [PATCH] Update gnulib to current upstream master Sergio Durigan Junior
2018-08-29 16:19 ` Tom Tromey
2018-08-29 16:29   ` Sergio Durigan Junior
2018-08-29 19:06 ` Pedro Alves
2018-08-29 19:34   ` Sergio Durigan Junior
2018-08-31 13:04     ` Pedro Alves
2018-08-30  0:04   ` Tom Tromey
2018-08-30  3:01     ` Sergio Durigan Junior
2018-08-30 15:57   ` [PATCH] Update gnulib/Makefile.in:aclocal_m4_deps Sergio Durigan Junior
2018-08-30 17:05     ` Simon Marchi
2018-08-30 20:00       ` Sergio Durigan Junior
2018-08-31  7:59         ` Joel Brobecker
2018-08-31 16:02           ` Sergio Durigan Junior
2018-08-31 11:21         ` Pedro Alves
2018-08-31 16:03           ` Sergio Durigan Junior
2018-09-02 21:21           ` [PATCH] Automatically update "aclocal_m4_deps" when updating gnulib Sergio Durigan Junior
2018-09-03 11:15             ` Pedro Alves
2018-09-03 21:18               ` Sergio Durigan Junior [this message]
2018-09-04 11:10                 ` Pedro Alves
2018-09-04 17:58                   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736uq1drt.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).