talloc: Change the way mksysms work
authorSimo Sorce <idra@samba.org>
Wed, 14 Oct 2009 14:20:28 +0000 (10:20 -0400)
committerSimo Sorce <idra@samba.org>
Wed, 14 Oct 2009 15:05:51 +0000 (11:05 -0400)
Make sure we always have a sorted (per file) export file.
This way we can directly compare the real export and the check file w/o having
to further sort things.

Also return error code from abi_checks.sh if warnings were reported

lib/talloc/script/abi_checks.sh
lib/talloc/script/mksyms.awk
lib/talloc/script/mksyms.sh

index ba60ed003a95f9372fb7d667542f57945a80f90f..66c4e60e45cb9bdf869c2cfaf1c91daed8a19b97 100755 (executable)
@@ -33,6 +33,7 @@ LANG=C; export LANG
 LC_ALL=C; export LC_ALL
 LC_COLLATE=C; export LC_COLLATE
 
+exit_status=0
 script=$0
 dir_name=$(dirname ${script})
 
@@ -58,34 +59,22 @@ signatures_file_check=${signatures_file}.check
 
 
 ${dir_name}/mksyms.sh awk ${exports_file_check} ${headers} 2>&1 > /dev/null
+cat ${headers} | ${dir_name}/mksigs.pl | sort| uniq > ${signatures_file_check} 2> /dev/null
 
-cat ${headers} | ${dir_name}/mksigs.pl > ${signatures_file_check} 2> /dev/null
-
-normalize_exports_file() {
-       filename=$1
-       cat ${filename} \
-       | sed -e 's/^[ \t]*//g' \
-       | sed -e 's/^$//g' \
-       | sed -e 's/^#.*$//g' \
-       | sort | uniq > ${filename}.sort
-}
-
-normalize_exports_file ${exports_file}
-normalize_exports_file ${exports_file_check}
-
-normalize_exports_file ${signatures_file}
-normalize_exports_file ${signatures_file_check}
-
-diff -u ${exports_file}.sort ${exports_file_check}.sort
+diff -u ${exports_file} ${exports_file_check}
 if test "x$?" != "x0" ; then
        echo "WARNING: possible ABI change detected in exports!"
+       let exit_status++
 else
        echo "exports check: OK"
 fi
 
-diff -u ${signatures_file}.sort ${signatures_file_check}.sort
+diff -u ${signatures_file} ${signatures_file_check}
 if test "x$?" != "x0" ; then
        echo "WARNING: possible ABI change detected in signatures!"
+       let exit_status++
 else
        echo "signatures check: OK"
 fi
+
+exit $exit_status
index ca14da0f2177bf2005a3e5835d9e6679c813669f..8775faff3feea63784e541ea4128e05fcf7e3866 100644 (file)
@@ -8,25 +8,12 @@
 #
 BEGIN {
        inheader=0;
-       current_file="";
-       print "#"
-       print "# This file is automatically generated with \"make symbols\". DO NOT EDIT "
-       print "#"
-       print "{"
-       print "\tglobal:"
 }
 
 END {
-       print""
-       print "\tlocal: *;"
-       print "};"
 }
 
 {
-       if (FILENAME!=current_file) {
-               print "\t\t# The following definitions come from",FILENAME
-               current_file=FILENAME
-       }
        if (inheader) {
                if (match($0,"[)][^()]*[;][ \t]*$")) {
                        inheader = 0;
@@ -42,7 +29,7 @@ END {
 /^extern[ \t]+[^()]+[;][ \t]*$/ {
        gsub(/[^ \t]+[ \t]+/, "");
        sub(/[;][ \t]*$/, "");
-       printf "\t\t%s;\n", $0;
+       printf "           %s;\n", $0;
        next;
 }
 
@@ -61,7 +48,7 @@ END {
        sub(/[(].*$/, "");
        gsub(/[^ \t]+[ \t]+/, "");
        gsub(/^[*]+/, "");
-       printf "\t\t%s;\n",$0;
+       printf "           %s;\n",$0;
        next;
 }
 
@@ -70,7 +57,7 @@ END {
        sub(/[(].*$/, "");
        gsub(/[^ \t]+[ \t]+/, "");
        gsub(/^[*]/, "");
-       printf "\t\t%s;\n",$0;
+       printf "           %s;\n",$0;
        next;
 }
 
index 714d55abae6a7369e1bb1da1f0d5cc5f7f29734d..089344f8f03a79736779181f4add12c70b42a556 100755 (executable)
@@ -34,7 +34,24 @@ echo creating $symsfile
 
 mkdir -p `dirname $symsfile`
 
-${awk} -f `dirname $0`/mksyms.awk $proto_src > $symsfile_tmp
+#Write header
+cat > $symsfile_tmp << EOF
+# This file is autogenerated, please DO NOT EDIT
+{
+    global:
+EOF
+
+#loop on each header
+for i in $proto_src; do
+${awk} -f `dirname $0`/mksyms.awk $i | sort >> $symsfile_tmp
+done;
+
+#Write tail
+cat >> $symsfile_tmp << EOF
+
+    local: *;
+};
+EOF
 
 if cmp -s $symsfile $symsfile_tmp 2>/dev/null
 then