[libvirt] [PATCH] use gnulib via a submodule

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

 



Please NOTE: do not apply the changes below.
They are incomplete because I've removed all the boring, repetitive parts.
If you want to apply something, use this:

  http://meyering.net/code/tmp/libvirt-submodule.patch.bz2

For an overall summary of the process of hooking up
gnulib as a submodule, see the long commit log for 5/7, below:
    Subject: [PATCH 5/7] make .gnulib a submodule

I'm not sure all of 1/7 is welcome, but at least the silent-rules
part seems in line with what people here like, considering
that mylibtool does something similar.  With this, you might
be comfortable removing mylibtool.

Jim

>From 41e0b6942648065dcf00e9aee3f961297464a336 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Mon, 6 Jul 2009 19:06:00 +0200
Subject: [PATCH 1/7] configure.in: use automake-1.11

---
 configure.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/configure.in b/configure.in
index 29c8867..1170958 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,8 @@ AC_CONFIG_SRCDIR([src/libvirt.c])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_CONFIG_HEADER([config.h])
 dnl Make automake keep quiet about wildcards & other GNUmake-isms
-AM_INIT_AUTOMAKE([-Wno-portability])
+AM_INIT_AUTOMAKE([1.11 color-tests parallel-tests -Wno-portability])
+AM_SILENT_RULES([yes]) # make --enable-silent-rules the default.
 AC_CANONICAL_HOST

 LIBVIRT_MAJOR_VERSION=`echo $VERSION | awk -F. '{print $1}'`
--
1.6.3.3.524.g8586b


>From d73c9fc35bdcac3c1f8b24cad226fc879325d3c2 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Mon, 6 Jul 2009 18:23:44 +0200
Subject: [PATCH 2/7] * Makefile.cfg: Rename to...

* cfg.mk: ...this.  New file.
---
 Makefile.cfg => cfg.mk |    0
 1 files changed, 0 insertions(+), 0 deletions(-)
 rename Makefile.cfg => cfg.mk (100%)

diff --git a/Makefile.cfg b/cfg.mk
similarity index 100%
rename from Makefile.cfg
rename to cfg.mk
--
1.6.3.3.524.g8586b


>From 1cacbc7f4c883f763606e0bed36bd8d149add0d9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Mon, 6 Jul 2009 18:28:10 +0200
Subject: [PATCH 3/7] Prepare to use maint.mk from gnulib

Since Makefile.maint will soon come from gnulib's maint.mk,
sync Makefile.maint to have the same contents (modulo minor
things).  In syncing it, we have to remove some libvirt-specific
rules.  Since we want to keep them (of course), put those in cfg.mk.
* Makefile.maint: Merge from gnulib's maint.mk.
* cfg.mk (sc_avoid_write): New rule.  From Makefile.cfg.
(sc_prohibit_strcmp_and_strncmp): Likewise, and rename.
(sc_prohibit_asprintf, sc_prohibit_VIR_ERR_NO_MEMORY): Likewise.
(sc_prohibit_nonreentrant): Likewise.
(sc_prohibit_ctype_h): Likewise.
(sc_TAB_in_indentation, sc_avoid_ctype_macros): Likewise.
(sc_prohibit_virBufferAdd_with_string_literal): Likewise.
(sc_prohibit_gethostby): Likewise.
(sc_libvirt_unmarked_diagnostics): Likewise.  Also, rename the
rule, inserting "_libvirt", since this rule is a specialization of
the one in gnulib.
* GNUmakefile: Include cfg.mk, not Makefile.cfg
* .x-sc_prohibit_strcmp_and_strncmp: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_prohibit_strcmp_and_strncmp

.
---
 .x-sc_prohibit_strcmp_and_strncmp |    1 +
 GNUmakefile                       |    4 +-
 Makefile.am                       |    1 +
 Makefile.maint                    |  734 +++++++++++++++++--------------------
 cfg.mk                            |  163 ++++++++
 5 files changed, 505 insertions(+), 398 deletions(-)
 create mode 100644 .x-sc_prohibit_strcmp_and_strncmp

diff --git a/.x-sc_prohibit_strcmp_and_strncmp b/.x-sc_prohibit_strcmp_and_strncmp
new file mode 100644
index 0000000..b7c456e
--- /dev/null
+++ b/.x-sc_prohibit_strcmp_and_strncmp
@@ -0,0 +1 @@
+^gnulib/
diff --git a/GNUmakefile b/GNUmakefile
index 157f432..e6d4178 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -40,7 +40,7 @@ export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner

 include Makefile

-include $(srcdir)/Makefile.cfg
+include $(srcdir)/cfg.mk
 include $(srcdir)/Makefile.maint

 else
diff --git a/Makefile.am b/Makefile.am
index 681034a..dd98ff2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,6 +16,7 @@ EXTRA_DIST = \
   .x-sc_avoid_if_before_free \
   .x-sc_require_config_h_first \
   .x-sc_prohibit_strcmp \
+  .x-sc_prohibit_strcmp_and_strncmp \
   .x-sc_require_config_h \
   .x-sc_prohibit_nonreentrant \
   Makefile.nonreentrant \
...
--
1.6.3.3.524.g8586b


>From a4b10833246264377c9c0c99a0178c3e9b6af0f7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Mon, 6 Jul 2009 19:17:06 +0200
Subject: [PATCH 4/7] skip some of gnulib's new rules

* cfg.mk (local-checks-to-skip): Add these: sc_error_message_uppercase,
sc_program_name, sc_require_test_exit_idiom, sc_makefile_check.
---
 cfg.mk |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 3c9feb6..35bedd1 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -52,6 +52,10 @@ local-checks-to-skip =			\
   sc_system_h_headers			\
   sc_tight_scope			\
   sc_two_space_separator_in_usage	\
+  sc_error_message_uppercase		\
+  sc_program_name			\
+  sc_require_test_exit_idiom		\
+  sc_makefile_check			\
   sc_useless_cpp_parens

 useless_free_options =		\
--
1.6.3.3.524.g8586b


>From 856172836da7f639323702aff67489e9a74d47d5 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Tue, 7 Jul 2009 11:22:52 +0200
Subject: [PATCH 5/7] make .gnulib a submodule

This makes it so we record (via a git submodule)
a snapshot of whatever version of gnulib we're using,
and none of gnulib sources are in the libvirt repository.
The result is that we have as much reproducibility as when
we version-controlled imported copies of the gnulib sources,
but without the hassle of the manual process we used when
syncing with upstream.

Note that when you clone libvirt, you get only the libvirt
repository, but when you first run ./bootstrap, it clones
gnulib (at the SHA1 recorded via the submodule), creating
the .gnulib/ hierarchy.  Then, the bootstrap script runs
gnulib-tool to populate gnulib/ with the files that make
up the selected modules.

Put the following in your ~/.gitconfig file.
[alias]
  syncsub = submodule foreach git pull origin master

The update procedure is simple:
  git syncsub
  ...build & test...
  git commit -m 'gnulib: sync submodule to latest' .gnulib

* .gitmodules: New file.
* .gnulib: Initialize.
* bootstrap: Set up to use the new submodule.
Stop using --no-vc-files.
Don't remove .gitignore files.
Don't use or create .cvsignore.
Diagnose an invalid --gnulib-srcdir=DIR argument.
* build-aux/vc-list-files: Delete file, now pulled from gnulib.
* build-aux/useless-if-before-free: Likewise.
* po/POTFILES.in: Remove gnulib/lib/gai_strerror.c, since
it no longer contains translatable strings.
* gnulib/*: Remove gnulib/ hierarchy.
---
 .gitignore                             |    1 +
 .gitmodules                            |    3 +
 .gnulib                                |    1 +
 bootstrap                              |   45 +-
 build-aux/useless-if-before-free       |  180 --
 build-aux/vc-list-files                |  107 -
 gnulib/lib/.cvsignore                  |   26 -
 gnulib/lib/.gitignore                  |   26 -
 gnulib/lib/Makefile.am                 | 1241 --------
 gnulib/lib/alloca.c                    |  489 ----
 gnulib/lib/alloca.in.h                 |   56 -
 gnulib/lib/arpa/.cvsignore             |    1 -
 gnulib/lib/arpa/.gitignore             |    1 -
 gnulib/lib/arpa_inet.in.h              |   90 -
 ...

diff --git a/.gitignore b/.gitignore
index ca73a98..964580c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,3 +34,4 @@ stamp-h
 stamp-h.in
 stamp-h1
 update.log
+tests/*.log
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..7acb1ea
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "gnulib"]
+	path = .gnulib
+	url = git://git.sv.gnu.org/gnulib.git
diff --git a/.gnulib b/.gnulib
new file mode 160000
index 0000000..1203e8d
--- /dev/null
+++ b/.gnulib
@@ -0,0 +1 @@
+Subproject commit 1203e8d1f62dec3d2436dffadd5c20793cf84366
diff --git a/bootstrap b/bootstrap
index baf52e7..7ce28da 100755
--- a/bootstrap
+++ b/bootstrap
@@ -40,25 +40,31 @@ do
   esac
 done

-cleanup_gnulib() {
-  st=$?
-  rm -fr .gnulib
-  exit $st
-}
+# Get gnulib files.

 case ${GNULIB_SRCDIR--} in
 -)
-  if [ ! -d .gnulib ]; then
+  echo "$0: getting gnulib files..."
+  git submodule init || exit $?
+  git submodule update || exit $?
+  GNULIB_SRCDIR=.gnulib
+  ;;
+*)
+  # Redirect the gnulib submodule to the directory on the command line
+  # if possible.
+  if test -d "$GNULIB_SRCDIR"/.git && \
+	git config --file .gitmodules submodule.gnulib.url >/dev/null; then
+    git submodule init
+    GNULIB_SRCDIR=`cd $GNULIB_SRCDIR && pwd`
+    git config --replace-all submodule.gnulib.url $GNULIB_SRCDIR
     echo "$0: getting gnulib files..."
-
-    trap cleanup_gnulib 1 2 13 15
-
-    git clone --depth 1 git://git.sv.gnu.org/gnulib .gnulib ||
-      cleanup_gnulib
-
-    trap - 1 2 13 15
+    git submodule update || exit $?
+    GNULIB_SRCDIR=.gnulib
+  else
+    echo >&2 "$0: invalid gnulib srcdir: $GNULIB_SRCDIR"
+    exit 1
   fi
-  GNULIB_SRCDIR=.gnulib
+  ;;
 esac

 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
@@ -103,20 +109,9 @@ vc-list-files
 #   put *.[ch] files in new gnulib/lib/ dir.

 $gnulib_tool			\
-  --no-vc-files			\
   --lgpl=2			\
   --with-tests			\
   --m4-base=gnulib/m4		\
   --source-base=gnulib/lib	\
   --tests-base=gnulib/tests	\
   --import $modules
-
-rm -f				\
-    .gitignore			\
-    gnulib/lib/.gitignore	\
-    gnulib/m4/.gitignore	\
-    gnulib/tests/.gitignore
-
-(cd gnulib/lib &&
- (cat .cvsignore; \
-  ls -1 *.in.h|sed 's/\.in\.h/.h/') | sort -u > .t; mv .t .cvsignore)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 973f580..357cd70 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,3 @@
-gnulib/lib/gai_strerror.c
 qemud/qemud.c
 qemud/remote.c
 src/bridge.c

...
--
1.6.3.3.524.g8586b


>From ab811737a6914133bf12a46d4c5b5a2a2bdd9ee9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Tue, 7 Jul 2009 12:05:18 +0200
Subject: [PATCH 6/7] remove all .cvsignore files

---
 .cvsignore                                 |   34 -------------------------
 build-aux/.cvsignore                       |   10 -------
 build-aux/.gitignore                       |    2 +
 docs/.cvsignore                            |    4 ---
 docs/devhelp/.cvsignore                    |    3 --
 docs/examples/.cvsignore                   |    7 -----
 docs/examples/python/.cvsignore            |    2 -
 docs/schemas/.cvsignore                    |    2 -
 examples/domain-events/events-c/.cvsignore |    6 ----
 examples/hellolibvirt/.cvsignore           |    5 ----
 include/.cvsignore                         |    2 -
 include/libvirt/.cvsignore                 |    2 -
 m4/.cvsignore                              |   37 ----------------------------
 po/.cvsignore                              |   15 -----------
 proxy/.cvsignore                           |    5 ----
 python/.cvsignore                          |   15 -----------
 python/tests/.cvsignore                    |    2 -
 qemud/.cvsignore                           |   12 ---------
 src/.cvsignore                             |   20 ---------------
 tests/.cvsignore                           |   28 ---------------------
 tests/confdata/.cvsignore                  |    2 -
 tests/sexpr2xmldata/.cvsignore             |    2 -
 tests/xencapsdata/.cvsignore               |    2 -
 tests/xmconfigdata/.cvsignore              |    2 -
 tests/xml2sexprdata/.cvsignore             |    2 -
 tools/.cvsignore                           |    4 ---
 26 files changed, 2 insertions(+), 225 deletions(-)

...
--
1.6.3.3.524.g8586b


>From b718b0763f8fbfc35af586fa6d132d39259d0e11 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@xxxxxxxxxx>
Date: Tue, 7 Jul 2009 18:08:45 +0200
Subject: [PATCH 7/7] use gnumakefile and maintainer-makefile modules from gnulib

* bootstrap (modules): Add gnumakefile and maintainer-makefile.
* GNUmakefile: Remove file, now provided by gnulib.
* Makefile.maint: Remove.  Replaced by maint.mk from gnulib.
.gitignore: Add GNUmakefile and maint.mk.
* cfg.mk (prev_version_file): Disable this feature.
Setting this to /dev/null avoids an otherwise harmless diagnostic.
---
 .gitignore     |    2 +
 GNUmakefile    |   60 -----
 Makefile.maint |  770 --------------------------------------------------------
 bootstrap      |    2 +
 cfg.mk         |    3 +
 5 files changed, 7 insertions(+), 830 deletions(-)
 delete mode 100644 GNUmakefile
 delete mode 100644 Makefile.maint

...
diff --git a/bootstrap b/bootstrap
index 7ce28da..b0de3df 100755
--- a/bootstrap
+++ b/bootstrap
@@ -78,8 +78,10 @@ getaddrinfo
 gethostname
 getpass
 gettext
+gnumakefile
 inet_pton
 ioctl
+maintainer-makefile
 mkstemp
 mktempd
 perror
diff --git a/cfg.mk b/cfg.mk
index 35bedd1..736f7c0 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -227,3 +227,6 @@ sc_libvirt_unmarked_diagnostics:
 	   | grep '[	 ]"' &&						\
 	  { echo '$(ME): found unmarked diagnostic(s)' 1>&2;		\
 	    exit 1; } || :
+
+# We don't use this feature of maint.mk.
+prev_version_file = /dev/null
--
1.6.3.3.524.g8586b

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]