Discussion:
[PATCH] Protect vgversion.h in a tarball from getting deleted by make clean
Add Reply
Matthias Schwarzott
2017-05-18 05:12:45 UTC
Reply
Permalink
Raw Message
Create a file vgversion_dist.h in the tarball.
This file is not deleted by make clean
Change auxprogs/make_or_upd_vgversion_h to use vgversion_dist.h if it is
available.
Add some missing quotes to auxprogs/make_or_upd_vgversion_h
---
Makefile.am | 2 +-
auxprogs/make_or_upd_vgversion_h | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ea87cc187..fdce3cf9f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -117,7 +117,7 @@ EXTRA_DIST = \
autogen.sh

dist-hook: include/vgversion.h
- cp -p include/vgversion.h $(distdir)/include/vgversion.h
+ cp -p include/vgversion.h $(distdir)/include/vgversion_dist.h

dist_noinst_SCRIPTS = \
vg-in-place
diff --git a/auxprogs/make_or_upd_vgversion_h b/auxprogs/make_or_upd_vgversion_h
index 6bfe6799d..cacbce314 100755
--- a/auxprogs/make_or_upd_vgversion_h
+++ b/auxprogs/make_or_upd_vgversion_h
@@ -14,16 +14,21 @@ extract_svn_version()
fi
}

-srcdir=${1:-.}
+srcdir="${1:-.}"

-cat > include/vgversion.h.tmp <<EOF
+if [ -e "$srcdir"/include/vgversion_dist.h ]
+then
+ cp "$srcdir"/include/vgversion_dist.h include/vgversion.h.tmp
+else
+ cat > include/vgversion.h.tmp <<EOF
/* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
This file defines VGSVN and VEXSVN, used to report SVN revision
when using command line options: -v --version
*/
-#define VGSVN "$(extract_svn_version $srcdir/.)"
-#define VEXSVN "$(extract_svn_version $srcdir/VEX)"
+#define VGSVN "$(extract_svn_version "$srcdir/.")"
+#define VEXSVN "$(extract_svn_version "$srcdir/VEX")"
EOF
+fi

if [ -f include/vgversion.h ]
then
--
2.13.0
Mark Wielaard
2017-05-18 08:40:43 UTC
Reply
Permalink
Raw Message
Post by Matthias Schwarzott
Create a file vgversion_dist.h in the tarball.
This file is not deleted by make clean
Change auxprogs/make_or_upd_vgversion_h to use vgversion_dist.h if it is
available.
Add some missing quotes to auxprogs/make_or_upd_vgversion_h
Thanks that looks good and should make sure the vgversion is always
there in a dist tar ball. And it survived a make distcheck.

Committed as valgrind svn r16398

Cheers,

Mark

Loading...