summaryrefslogtreecommitdiffstats
path: root/build-aux
diff options
context:
space:
mode:
authorHarshavardhana <harsha@harshavardhana.net>2014-04-26 20:19:38 -0700
committerAnand Avati <avati@redhat.com>2014-04-27 10:40:56 -0700
commitf77e5b6ebe5d702065844db141ebd38ff7802168 (patch)
tree1ea7ad07da9b82cbc7aa46f46912c5db3d56f836 /build-aux
parentfbef3a51c501c67ce6814dd16efb87758d855d48 (diff)
rpcgen: After recent changes parallel builds failed
Parallel builds failed due to make file would overrun xdrgen (internally xdrgen uses tempfiles to add License header). Seperate out header and source generation and add explicit dependency to fix it. Change-Id: Id20f548493540b0f17a2300f0775646f9f20789c BUG: 1090807 Signed-off-by: Harshavardhana <harsha@harshavardhana.net> Reviewed-on: http://review.gluster.org/7572 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/xdrgen90
1 files changed, 47 insertions, 43 deletions
diff --git a/build-aux/xdrgen b/build-aux/xdrgen
index b5f33d37229..e826111b9cc 100755
--- a/build-aux/xdrgen
+++ b/build-aux/xdrgen
@@ -1,23 +1,9 @@
#!/bin/bash
-_init ()
-{
- xfile="$1";
-
- cfile="${1%.x}.c";
- hfile="${1%.x}.h";
-
- tmp_cfile="$1.c";
-
- tmp1_hfile="$1.h.tmp";
- tmp1_cfile="$1.c.tmp";
-
-}
-
append_licence_header ()
{
- src_file=$1;
- dst_file=$2;
+ local src_file=$1;
+ local dst_file=$2;
cat >$dst_file <<EOF
/*
@@ -47,47 +33,65 @@ EOF
}
-main ()
+gen_sources ()
{
- if [ $# -ne 1 ]; then
- echo "wrong number of arguments given"
- echo " $0 <XDR-definition-file>.x"
- exit 1;
- fi
+ local xfile="$1";
+
+ local cfile="${1%.x}.c";
+ local hfile="${1%.x}.h";
+ local tmp_cfile="$1.c.tmp";
+ local tmp_hfile="$1.h.tmp";
- echo -n "writing the XDR routine file ($tmp_cfile) ... ";
+ rm -f $cfile;
+ rpcgen -c -o $cfile $xfile;
+ append_licence_header $cfile $tmp_cfile;
+ mv $tmp_cfile $cfile;
+ # remove unwanted temporary files (if any)
rm -f $tmp_cfile;
- rpcgen -c -o $tmp_cfile $xfile;
+ echo "Generated $cfile"
+ return
+}
+
+gen_headers ()
+{
+ local xfile="$1";
+
+ local cfile="${1%.x}.c";
+ local hfile="${1%.x}.h";
- echo "OK";
+ local tmp_cfile="$1.c.tmp";
+ local tmp_hfile="$1.h.tmp";
# no need for a temporary file here as there are no changes from glusterfs
- echo -n "writing the XDR header file ($hfile) ... ";
rm -f $hfile;
rpcgen -h -o $hfile $xfile;
-
# the '#ifdef' part of file should be fixed
sed -i -e 's/-/_/g' $hfile;
-
- echo "OK";
-
- echo -n "writing licence header to the generated files ... ";
- # Write header to temp file and append generated file
- append_licence_header $hfile $tmp1_hfile;
- append_licence_header $tmp_cfile $tmp1_cfile;
- echo "OK"
-
+ # Gen header to temp file and append generated file
+ append_licence_header $hfile $tmp_hfile;
# now move the destination file to actual original file
- echo -n "updating existing files ... ";
- mv $tmp1_hfile $hfile;
- mv $tmp1_cfile $cfile;
+ mv $tmp_hfile $hfile;
+ rm -f $tmp_hfile;
+ echo "Generated $hfile";
+ return
+}
- # remove unwanted temporary files (if any)
- rm -f $tmp_cfile $tmp1_cfile $tmp1_hfile
+main ()
+{
+ if [ $# -ne 2 ]; then
+ echo "wrong number of arguments given"
+ echo " $0 [header|source] <XDR-definition-file>.x"
+ exit 1;
+ fi
- echo "OK"
+ if [ $1 == "header" ]; then
+ gen_headers $2
+ fi
+ if [ $1 == "source" ]; then
+ gen_sources $2
+ fi
}
-_init "$@" && main "$@";
+main "$@";