[libvirt] fix two "make syntax-check" failures

Mark McLoughlin pointed out this failure: ChangeLog-old: if (foo) free (foo) ChangeLog-old: if (foo != NULL) free (foo) maint.mk: found useless "if" before "free" above make: *** [sc_avoid_if_before_free] Error 1 Here's the other: --- po/POTFILES.in +++ po/POTFILES.in @@ -1,3 +1,4 @@ +cfg.mk qemud/qemud.c qemud/remote.c src/bridge.c maint.mk: you have changed the set of files with translatable diagnostics; apply the above patch I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a. Here are the two patches I'm about to push:
From bcf2aed1a91e66fee823e9063050c14bfc4ca29d Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:00:37 +0200 Subject: [PATCH 1/2] avoid a "make syntax-check" failure
* .x-sc_avoid_if_before_free: Ignore *all* ChangeLog files, now, including ChangeLog-old. --- .x-sc_avoid_if_before_free | 6 +----- 1 files changed, 1 insertions(+), 5 deletions(-) diff --git a/.x-sc_avoid_if_before_free b/.x-sc_avoid_if_before_free index 5093ef6..7e6ce62 100644 --- a/.x-sc_avoid_if_before_free +++ b/.x-sc_avoid_if_before_free @@ -1,5 +1 @@ -^gnulib/lib/getaddrinfo\.c$ -^gnulib/lib/printf-parse\.c$ -^gnulib/lib/vasnprintf\.c$ -^build-aux/useless-if-before-free$ -^ChangeLog$ +^ChangeLog -- 1.6.3.3.524.g8586b
From 72978b978991f106dc0e36b10a942d9040a1df00 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:02:31 +0200 Subject: [PATCH 2/2] build: update from gnulib, for latest maint.mk
* gnulib: Update submodule to latest. This fixes the make syntax-check failure whereby sc_po_check would complain about cfg.mk. --- .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb -- 1.6.3.3.524.g8586b

Jim Meyering wrote: ...
I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a.
Here are the two patches I'm about to push: ...
From 72978b978991f106dc0e36b10a942d9040a1df00 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:02:31 +0200 Subject: [PATCH 2/2] build: update from gnulib, for latest maint.mk
* gnulib: Update submodule to latest. This fixes the make syntax-check failure whereby sc_po_check would complain about cfg.mk. --- .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb
Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.

On Thu, Jul 09, 2009 at 08:39:32PM +0200, Jim Meyering wrote:
Jim Meyering wrote: ...
I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a.
Here are the two patches I'm about to push: ...
From 72978b978991f106dc0e36b10a942d9040a1df00 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:02:31 +0200 Subject: [PATCH 2/2] build: update from gnulib, for latest maint.mk
* gnulib: Update submodule to latest. This fixes the make syntax-check failure whereby sc_po_check would complain about cfg.mk. --- .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb
Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Thu, Jul 09, 2009 at 08:39:32PM +0200, Jim Meyering wrote:
Jim Meyering wrote: ...
I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a.
Here are the two patches I'm about to push: ...
From 72978b978991f106dc0e36b10a942d9040a1df00 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:02:31 +0200 Subject: [PATCH 2/2] build: update from gnulib, for latest maint.mk
* gnulib: Update submodule to latest. This fixes the make syntax-check failure whereby sc_po_check would complain about cfg.mk. --- .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync.
I actually just had a brief WTF moment, tripping up on the need to run ./bootstrap with a fresh checkout. autogen.sh fails pretty spectacularly in that case: I can imagine it would send a first time user running for the hills. +1 to any way of integrating this with autogen.sh (or at least clearly warning the user if the necessary steps haven't been taken). - Cole

Cole Robinson wrote:
Daniel P. Berrange wrote:
On Thu, Jul 09, 2009 at 08:39:32PM +0200, Jim Meyering wrote:
Jim Meyering wrote: ...
I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a.
Here are the two patches I'm about to push: ...
From 72978b978991f106dc0e36b10a942d9040a1df00 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Thu, 9 Jul 2009 20:02:31 +0200 Subject: [PATCH 2/2] build: update from gnulib, for latest maint.mk
* gnulib: Update submodule to latest. This fixes the make syntax-check failure whereby sc_po_check would complain about cfg.mk. --- .gnulib | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync.
I actually just had a brief WTF moment, tripping up on the need to run ./bootstrap with a fresh checkout. autogen.sh fails pretty spectacularly in that case: I can imagine it would send a first time user running for the hills.
+1 to any way of integrating this with autogen.sh (or at least clearly warning the user if the necessary steps haven't been taken).
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way: Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options. IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make". Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you. [currently this works only from a srcdir build] diff --git a/cfg.mk b/cfg.mk index 736f7c0..8750751 100644 --- a/cfg.mk +++ b/cfg.mk @@ -230,3 +230,16 @@ sc_libvirt_unmarked_diagnostics: # We don't use this feature of maint.mk. prev_version_file = /dev/null + +ifeq (0,$(MAKELEVEL)) + _curr_status = .git-module-status + __dummy := $(warn MAKELEVEL = $(MAKELEVEL)) + _submodule_check := \ + $(shell t=$$(git submodule status); \ + test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)" \ + || { test -w /dev/tty && echo running bootstrap...>/dev/tty; \ + ./bootstrap && echo "$$t" > $(_curr_status); \ + test -w /dev/tty && echo running autogen.sh...>/dev/tty; \ + ./autogen.sh; \ + }) +endif

Jim Meyering wrote:
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way:
Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options.
IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make".
Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you.
[currently this works only from a srcdir build]
In case you don't mind that and the "run autogen.sh with no options" restriction, here's a complete patch:
From c0a350326f00e1707df47abd6ef3d8fa24841456 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 10:01:04 +0200 Subject: [PATCH] build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the gnulib git submodule, you must rerun the bootstrap and autogen.sh script. With this change, it's done via rules included into GNUmakefile. * cfg.mk: Maintain a new file, .git-module-status, containing the current submodule status. If it doesn't exist or its content is different from what "git submodule status" prints, then rerun ./bootstrap and ./autogen.sh. * .gitignore: Add .git-module-status --- .gitignore | 1 + cfg.mk | 13 +++++++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/.gitignore b/.gitignore index 54c3ba4..17c3975 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *~ .git +.git-module-status ABOUT-NLS COPYING INSTALL diff --git a/cfg.mk b/cfg.mk index 736f7c0..8750751 100644 --- a/cfg.mk +++ b/cfg.mk @@ -230,3 +230,16 @@ sc_libvirt_unmarked_diagnostics: # We don't use this feature of maint.mk. prev_version_file = /dev/null + +ifeq (0,$(MAKELEVEL)) + _curr_status = .git-module-status + __dummy := $(warn MAKELEVEL = $(MAKELEVEL)) + _submodule_check := \ + $(shell t=$$(git submodule status); \ + test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)" \ + || { test -w /dev/tty && echo running bootstrap...>/dev/tty; \ + ./bootstrap && echo "$$t" > $(_curr_status); \ + test -w /dev/tty && echo running autogen.sh...>/dev/tty; \ + ./autogen.sh; \ + }) +endif -- 1.6.3.3.524.g8586b

On Fri, Jul 10, 2009 at 09:42:10AM +0200, Jim Meyering wrote:
Cole Robinson wrote:
Daniel P. Berrange wrote:
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync.
I actually just had a brief WTF moment, tripping up on the need to run ./bootstrap with a fresh checkout. autogen.sh fails pretty spectacularly in that case: I can imagine it would send a first time user running for the hills.
+1 to any way of integrating this with autogen.sh (or at least clearly warning the user if the necessary steps haven't been taken).
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way:
Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options.
IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make".
No I like the way autogen.sh currently works. bootstrap is logically a part of what autogen.sh should be doing, not part of 'make' rules.
Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you.
Running autogen.sh without options is going to causing just as much pain & confusion, because it is pretty common to give options to autogen.sh particularly to change the install loction. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Daniel P. Berrange wrote:
On Fri, Jul 10, 2009 at 09:42:10AM +0200, Jim Meyering wrote:
Cole Robinson wrote:
Daniel P. Berrange wrote:
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync.
I actually just had a brief WTF moment, tripping up on the need to run ./bootstrap with a fresh checkout. autogen.sh fails pretty spectacularly in that case: I can imagine it would send a first time user running for the hills.
+1 to any way of integrating this with autogen.sh (or at least clearly warning the user if the necessary steps haven't been taken).
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way:
Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options.
IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make".
No I like the way autogen.sh currently works. bootstrap is logically a part of what autogen.sh should be doing, not part of 'make' rules.
Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you.
Running autogen.sh without options is going to causing just as much pain & confusion, because it is pretty common to give options to autogen.sh particularly to change the install loction.
Ok, then I'll arrange for "make" to fail in that case, and to give a diagnostic saying "run autogen.sh". And autogen.sh will run bootstrap, if/when needed. So there will no longer be a separately-run bootstrap step.

Daniel P. Berrange wrote:
On Fri, Jul 10, 2009 at 09:42:10AM +0200, Jim Meyering wrote:
Cole Robinson wrote:
Daniel P. Berrange wrote:
diff --git a/.gnulib b/.gnulib index 1203e8d..b653eda 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366 +Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb Note how that patch changed the .gnulib submodule. When you pull such a change, you have to know to run ./bootstrap to pull in updated-from-gnulib files.
Yeah, this is the kind of scenario where I think it'd be good to have autogen.sh somehow notice the .gnulib submodule hash changed, and automatically run bootstrap to re-sync.
I actually just had a brief WTF moment, tripping up on the need to run ./bootstrap with a fresh checkout. autogen.sh fails pretty spectacularly in that case: I can imagine it would send a first time user running for the hills.
+1 to any way of integrating this with autogen.sh (or at least clearly warning the user if the necessary steps haven't been taken).
Actually, we can do even better. Run it via "make". There's only one problem when doing it that way:
Whenever you rerun bootstrap, you also have to rerun autogen.sh. And to automatically run autogen.sh, you need to know what (if any) command line arguments the user would have selected, e.g., --prefix or other ./configure options.
IMHO, this is a good argument for changing autogen.sh so that (like many other autogen scripts) it tells the user to run not "make" directly but "./configure ... && make".
No I like the way autogen.sh currently works. bootstrap is logically a part of what autogen.sh should be doing, not part of 'make' rules.
Anyhow, if you don't mind rerunning ./autogen.sh with *no* options, here's how to make it so after pulling a gnulib submodule update, the next "make" will automatically detect that and run both ./bootstrap and autogen.sh for you.
Running autogen.sh without options is going to causing just as much pain & confusion, because it is pretty common to give options to autogen.sh particularly to change the install loction.
So how about this alternative? With it, you don't need to run ./bootstrap manually any more, and "make" will fail with a message telling you to run ./autogen.sh whenever the gnulib submodule is out of date wrt your current checkout. (not wrt upstream, of course). The first patch isn't technically necessary, but can save unnecessary invocation of some of those programs.
From abc4812c4752bb63cefd1f73d8136903e694034a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 12:06:36 +0200 Subject: [PATCH 1/2] build: make autogen.sh use autoreconf -if
* autogen.sh: Use "autoreconf -if" instead of open-coding it with manual and unconditional invocation of each separate tool. --- autogen.sh | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-) diff --git a/autogen.sh b/autogen.sh index c026112..e6bde33 100755 --- a/autogen.sh +++ b/autogen.sh @@ -57,13 +57,7 @@ fi # Automake requires that ChangeLog exist. touch ChangeLog -autopoint --force -#rm -rf m4 -libtoolize --copy --force -aclocal -I m4 -I gnulib/m4 -autoheader -automake --add-missing -autoconf +autoreconf -if cd $THEDIR -- 1.6.3.3.524.g8586b
From 6870a8cf78cc3216bd38cb997cc27e1eabccc601 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 10:01:04 +0200 Subject: [PATCH 2/2] build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the gnulib git submodule, you must rerun the autogen.sh script. With this change, "make" now fails and tells you to run ./autogen.sh, when needed. * autogen.sh: Maintain a new file, .git-module-status, containing the current submodule status. If it doesn't exist or its content is different from what "git submodule status" prints, then run ./bootstrap * .gitignore: Add .git-module-status * cfg.mk: Diagnose out of date submodule and fail. * README-hacking: Update not to mention bootstrap. * Makefile.am (MAINTAINERCLEANFILES): Add .git-module-status, so that "make maintainerclean" will remove it. --- .gitignore | 1 + Makefile.am | 2 ++ README-hacking | 9 ++------- autogen.sh | 11 +++++++++++ cfg.mk | 10 ++++++++++ 5 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 54c3ba4..17c3975 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *~ .git +.git-module-status ABOUT-NLS COPYING INSTALL diff --git a/Makefile.am b/Makefile.am index f9efff5..beddca7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,8 @@ cov: clean-cov clean-cov: rm -rf $(top_builddir)/coverage +MAINTAINERCLEANFILES = .git-module-status + # disable this check distuninstallcheck: diff --git a/README-hacking b/README-hacking index 99c68fe..4105a3e 100644 --- a/README-hacking +++ b/README-hacking @@ -28,13 +28,8 @@ You can get a copy of the source repository like this: $ git clone git://libvirt.org/libvirt $ cd libvirt -The next step is to get and check other files needed to build, -which are extracted from other source packages: - - $ ./bootstrap - -Then run this to create e.g., Makefiles and ./configure, -and to invoke ./configure: +The next step is to get all required pieces from gnulib, +to run autoreconf, and to invoke ./configure: $ ./autogen.sh diff --git a/autogen.sh b/autogen.sh index e6bde33..415f3ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -54,6 +54,17 @@ if test -z "$*"; then echo "to pass any to it, please specify them on the $0 command line." fi +# Ensure that whenever we pull in a gnulib update or otherwise change to a +# different version (i.e., when switching branches), we also rerun ./bootstrap. +curr_status=.git-module-status +t=$(git submodule status) +if test "$t" = "$(cat $curr_status 2>/dev/null)"; then + : # good, it's up to date +else + echo running bootstrap... + ./bootstrap && echo "$t" > $curr_status +fi + # Automake requires that ChangeLog exist. touch ChangeLog diff --git a/cfg.mk b/cfg.mk index 736f7c0..3b3d57f 100644 --- a/cfg.mk +++ b/cfg.mk @@ -230,3 +230,13 @@ sc_libvirt_unmarked_diagnostics: # We don't use this feature of maint.mk. prev_version_file = /dev/null + +ifeq (0,$(MAKELEVEL)) + _curr_status = .git-module-status + _update_required := \ + $(shell t=$$(git submodule status); \ + test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)"; echo $$?) + ifeq (1,$(_update_required)) + $(error gnulib update required; run ./autogen.sh first) + endif +endif -- 1.6.3.3.524.g8586b

On Fri, Jul 10, 2009 at 12:45:03PM +0200, Jim Meyering wrote:
Daniel P. Berrange wrote:
So how about this alternative? With it, you don't need to run ./bootstrap manually any more, and "make" will fail with a message telling you to run ./autogen.sh whenever the gnulib submodule is out of date wrt your current checkout. (not wrt upstream, of course).
The first patch isn't technically necessary, but can save unnecessary invocation of some of those programs.
From abc4812c4752bb63cefd1f73d8136903e694034a Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 12:06:36 +0200 Subject: [PATCH 1/2] build: make autogen.sh use autoreconf -if
* autogen.sh: Use "autoreconf -if" instead of open-coding it with manual and unconditional invocation of each separate tool. --- autogen.sh | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/autogen.sh b/autogen.sh index c026112..e6bde33 100755 --- a/autogen.sh +++ b/autogen.sh @@ -57,13 +57,7 @@ fi # Automake requires that ChangeLog exist. touch ChangeLog
-autopoint --force -#rm -rf m4 -libtoolize --copy --force -aclocal -I m4 -I gnulib/m4 -autoheader -automake --add-missing -autoconf +autoreconf -if
cd $THEDIR
-- 1.6.3.3.524.g8586b
From 6870a8cf78cc3216bd38cb997cc27e1eabccc601 Mon Sep 17 00:00:00 2001 From: Jim Meyering <meyering@redhat.com> Date: Fri, 10 Jul 2009 10:01:04 +0200 Subject: [PATCH 2/2] build: automatically rerun ./bootstrap when needed
When "git pull" (or any other operation) brings in a new version of the gnulib git submodule, you must rerun the autogen.sh script. With this change, "make" now fails and tells you to run ./autogen.sh, when needed. * autogen.sh: Maintain a new file, .git-module-status, containing the current submodule status. If it doesn't exist or its content is different from what "git submodule status" prints, then run ./bootstrap * .gitignore: Add .git-module-status * cfg.mk: Diagnose out of date submodule and fail. * README-hacking: Update not to mention bootstrap. * Makefile.am (MAINTAINERCLEANFILES): Add .git-module-status, so that "make maintainerclean" will remove it. --- .gitignore | 1 + Makefile.am | 2 ++ README-hacking | 9 ++------- autogen.sh | 11 +++++++++++ cfg.mk | 10 ++++++++++ 5 files changed, 26 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore index 54c3ba4..17c3975 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ *.o *~ .git +.git-module-status ABOUT-NLS COPYING INSTALL diff --git a/Makefile.am b/Makefile.am index f9efff5..beddca7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,8 @@ cov: clean-cov clean-cov: rm -rf $(top_builddir)/coverage
+MAINTAINERCLEANFILES = .git-module-status + # disable this check distuninstallcheck:
diff --git a/README-hacking b/README-hacking index 99c68fe..4105a3e 100644 --- a/README-hacking +++ b/README-hacking @@ -28,13 +28,8 @@ You can get a copy of the source repository like this: $ git clone git://libvirt.org/libvirt $ cd libvirt
-The next step is to get and check other files needed to build, -which are extracted from other source packages: - - $ ./bootstrap - -Then run this to create e.g., Makefiles and ./configure, -and to invoke ./configure: +The next step is to get all required pieces from gnulib, +to run autoreconf, and to invoke ./configure:
$ ./autogen.sh
diff --git a/autogen.sh b/autogen.sh index e6bde33..415f3ec 100755 --- a/autogen.sh +++ b/autogen.sh @@ -54,6 +54,17 @@ if test -z "$*"; then echo "to pass any to it, please specify them on the $0 command line." fi
+# Ensure that whenever we pull in a gnulib update or otherwise change to a +# different version (i.e., when switching branches), we also rerun ./bootstrap. +curr_status=.git-module-status +t=$(git submodule status) +if test "$t" = "$(cat $curr_status 2>/dev/null)"; then + : # good, it's up to date +else + echo running bootstrap... + ./bootstrap && echo "$t" > $curr_status +fi + # Automake requires that ChangeLog exist. touch ChangeLog
diff --git a/cfg.mk b/cfg.mk index 736f7c0..3b3d57f 100644 --- a/cfg.mk +++ b/cfg.mk @@ -230,3 +230,13 @@ sc_libvirt_unmarked_diagnostics:
# We don't use this feature of maint.mk. prev_version_file = /dev/null + +ifeq (0,$(MAKELEVEL)) + _curr_status = .git-module-status + _update_required := \ + $(shell t=$$(git submodule status); \ + test "$$t" = "$$(cat $(_curr_status) 2>/dev/null)"; echo $$?) + ifeq (1,$(_update_required)) + $(error gnulib update required; run ./autogen.sh first) + endif +endif
ACK Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Jul 09, 2009 at 08:09:05PM +0200, Jim Meyering wrote:
Mark McLoughlin pointed out this failure:
ChangeLog-old: if (foo) free (foo) ChangeLog-old: if (foo != NULL) free (foo) maint.mk: found useless "if" before "free" above make: *** [sc_avoid_if_before_free] Error 1
Heh, :-)
Here's the other:
--- po/POTFILES.in +++ po/POTFILES.in @@ -1,3 +1,4 @@ +cfg.mk qemud/qemud.c qemud/remote.c src/bridge.c maint.mk: you have changed the set of files with translatable diagnostics; apply the above patch
I had fixed the latter in gnulib (now that main.mk comes from there), but had forgotten to tell libvirt to use the latest version of gnulib, in order to get that fix. To do that, I ran "git syncsub" (where syncsub is an alias: syncsub = submodule foreach git pull origin master) then git commit -a.
Here are the two patches I'm about to push:
Fine, ACK, thanks ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (4)
-
Cole Robinson
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering