From f77e5b6ebe5d702065844db141ebd38ff7802168 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Sat, 26 Apr 2014 20:19:38 -0700 Subject: 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 Reviewed-on: http://review.gluster.org/7572 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- build-aux/xdrgen | 90 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 47 insertions(+), 43 deletions(-) (limited to 'build-aux/xdrgen') 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 <.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] .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 "$@"; -- cgit