INN commit: trunk/support (getrra-c-util)

INN Commit rra at isc.org
Sat Nov 1 21:44:25 UTC 2014


    Date: Saturday, November 1, 2014 @ 14:44:24
  Author: iulius
Revision: 9739

current version of the script used to keep INN in sync with rra-c-util

Modified:
  trunk/support/getrra-c-util

---------------+
 getrra-c-util |  178 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 150 insertions(+), 28 deletions(-)

Modified: getrra-c-util
===================================================================
--- getrra-c-util	2014-10-28 21:31:19 UTC (rev 9738)
+++ getrra-c-util	2014-11-01 21:44:24 UTC (rev 9739)
@@ -5,26 +5,29 @@
 ##  Synchronize INN files maintained in rra-c-util with upstream.
 ##
 ##  This script downloads the latest version of the files maintained
-##  in the rra-c-util package that INN uses.  These files are
-##  available at <http://www.eyrie.org/~eagle/software/rra-c-util/>.
+##  in the rra-c-util package that INN uses for most of its utility and
+##  portability functions.  These files are available at
+##  <http://www.eyrie.org/~eagle/software/rra-c-util/>.
 ##
-##  Running this script automatically downloads the latest version
-##  of the files, and puts them in the expected location in the INN source
-##  code.  The name of the files that have been modified since the last
-##  run of the script are written to standard output.  Have a look at
-##  the changes and, if all looks right, commit the changes.
+##  Running this script permits to keep up-to-date most of INN utility and
+##  portability functions by automatically fetching the latest version of
+##  the upstream files, and putting them in the expected location in the
+##  INN source code.
+##  The name of the files that have been modified since the last run of the
+##  script are written to standard output.  Have a look at the changes and,
+##  if all looks right, commit the changes.
 
 ##  URL where the files can be downloaded.
 URL_START="http://git.eyrie.org/?p=devel/rra-c-util.git;a=blob_plain;hb=HEAD;f="
 
 ##  This function downloads the files and copies them to the expected
-##  location in the INN source code, after having changed "RRA_" to "INN_"
-##  and "rra_" to "inn_" so as to keep a homogeneous naming convention.
-##  If a file is not found in upstream or has been modified, write it
-##  on standard output.
+##  location in the INN source code, after having performed a few minimal
+##  changes to integrate them in the INN build system.
+##  If a file is not found in upstream or has been modified since the last
+##  run of the script, write it on standard output.
 ##
 ##  This function expects the following arguments:
-##    $1 - full path of the file to download in rra-c-util
+##    $1 - full path of the file to download in the upstream package
 ##    $2 - directory where the file should be copied in INN source code
 ##    $3 - name of the file in INN source code
 download ()
@@ -36,34 +39,102 @@
 
   if [ ! -s "${TEMP}" ]
   then
-    echo "File $1 does not exist in rra-c-util"
+    echo "File $1 does not exist in upstream package"
   else
+    # Add the SVN Id keyword at the beginning of source code files,
+    # and update the path of included C header files.
+    # Change "RRA_" to "INN_", "rra_" to "inn_", and "UTIL_" to "INN_"
+    # so as to keep a homogeneous naming convention in INN source code.
+    # Changes in shell, m4 and C files are not the same.
     if [ "$2" = "m4" ]
     then
       sed -i -e 's/RRA_/INN_/g' \
              -e 's/rra_/inn_/g' \
              -e '1 a\
-dnl $Id$' ${TEMP}
+dnl $Id$' \
+             ${TEMP}
     elif [ "$2" = "include/inn" ] || [ "$2" = "include/portable" ] \
-      || [ "$2" = "lib" ]
+      || [ "$2" = "lib" ] || [ "$2" = "tests/lib" ] \
+      || [ "$2" = "tests/lib/network" ] || [ "$2" = "tests/tap" ]
     then
-      sed -i -e 's/UTIL_/INN_/g' \
-             -e '/^\/\* Default to a hidden visibility for all .* functions\. \*\/$/,+2d' \
-             -e '/^\/\* Undo default visibility change\. \*\/$/,+2d' \
-             -e 's/<config\.h>/"config.h"/g' \
-             -e 's/<portable\/system\.h>/"clibrary.h"/g' \
-             -e 's/<portable\/socket\.h>/"portable\/socket.h"/g' \
-             -e 's/<sys\/time\.h>/"portable\/time.h"/g' \
-             -e '/^#if HAVE_UNISTD_H$/{N;N; s/.*/#include "clibrary.h"/}' \
-             -e '/^#include <portable\/macros\.h>$/d' \
-             -e '1 s/$/ $Id$\n */' ${TEMP}
+      if [ "$3" = "xmalloc.t" ]
+      then
+        # Path should be updated in this shell script.
+        sed -i -e "3 i \\
+# \$Id\$\\
+#" \
+               -e 's/\$BUILD\/util/\$BUILD\/lib/g' \
+               ${TEMP}
+        chmod 755 ${TEMP}
+      else
+        if [ "$3" = "network.c" ]
+        then
+          # Apply specific changes to take into account how sourceaddress
+          # and sourceaddress6 work.
+          sed -i -e "61 i \\
+#include \"inn/innconf.h\"" \
+                 -e '465 s/)$/ \&\& innconf == NULL)/' \
+                 -e '466,467d' \
+                 -e "472 i \\
+        if (source == NULL && innconf != NULL)\\
+            source = innconf->sourceaddress;\\
+        if (source == NULL ||\\
+            strcmp(source, \"all\") == 0 || strcmp(source, \"any\") == 0)\\
+              return true;\\
+" \
+                 -e "485 i \\
+        if (source == NULL && innconf != NULL)\\
+            source = innconf->sourceaddress6;\\
+        if (source == NULL ||\\
+            strcmp(source, \"all\") == 0 || strcmp(source, \"any\") == 0)\\
+              return true;\\
+" \
+               ${TEMP}
+        fi
+
+        sed -i -e 's/UTIL_/INN_/g' \
+               -e '/^\/\* Default to a hidden visibility for all .* functions\. \*\/$/,+2d' \
+               -e '/^\/\* Undo default visibility change\. \*\/$/,+2d' \
+               -e 's/<config\.h>/"config.h"/g' \
+               -e 's/<portable\/system\.h>/"clibrary.h"/g' \
+               -e 's/<util\/\(.*\)>/"inn\/\1"/g' \
+               -e 's/<portable\/\(.*\)>/"portable\/\1"/g' \
+               -e 's/<tests\/tap\/\(.*\)>/"tap\/\1"/g' \
+               -e '1 s/$/ $Id$\n */' \
+               ${TEMP}
+
+        # For compatibility with the integration of C TAP Harness in INN.
+        if [ "$2" = "tests/lib" ] || [ "$2" = "tests/lib/network" ] \
+          || [ "$3" = "process.c" ]
+        then
+          sed -i -e "0,/^$/{s/^$/\n#define LIBTEST_NEW_FORMAT 1\n/}" \
+                 ${TEMP}
+        fi
+
+        # Rename a few symbols defined by autoconf since they're too likely
+        # to conflict with other packages.
+        # Please see support/mksystem for more information.
+        if [ "$2" = "include/inn" ]
+        then
+          sed -i -e 's/\([^_]\)HAVE_C99_VAMACROS/\1INN_HAVE_C99_VAMACROS/g' \
+                 -e 's/\([^_]\)HAVE_GNU_VAMACROS/\1INN_HAVE_GNU_VAMACROS/g' \
+                 -e 's/\([^_]\)HAVE_INET6/\1INN_HAVE_INET6/g' \
+                 -e 's/\([^_]\)HAVE_INTTYPES_H/\1INN_HAVE_INTTYPES_H/g' \
+                 -e 's/\([^_]\)HAVE_MSYNC_3_ARG/\1INN_HAVE_MSYNC_3_ARG/g' \
+                 -e 's/\([^_]\)HAVE_STDBOOL_H/\1INN_HAVE_STDBOOL_H/g' \
+                 -e 's/\([^_]\)HAVE_SYS_BITYPES_H/\1INN_HAVE_SYS_BITYPES_H/g' \
+                 -e 's/\([^_]\)HAVE__BOOL/\1INN_HAVE__BOOL/g' \
+                 ${TEMP}
+        fi
+      fi
     fi
+
     mv -f ${TEMP} ../$2/$3
     svn status ../$2/$3
   fi
 }
 
-# Synchronize Autoconf macros from upstream.
+##  Synchronize Autoconf macros from upstream.
 download m4/bdb.m4 m4 bdb.m4
 download m4/inet-ntoa.m4 m4 inet-ntoa.m4
 download m4/krb5-config.m4 m4 krb5-config.m4
@@ -80,7 +151,7 @@
 download m4/vamacros.m4 m4 vamacros.m4
 download m4/zlib.m4 m4 zlib.m4
 
-# Synchronize portability functions from upstream.
+##  Synchronize portability functions from upstream.
 download portable/asprintf.c lib asprintf.c
 download portable/getaddrinfo.c lib getaddrinfo.c
 download portable/getaddrinfo.h include/portable getaddrinfo.h
@@ -89,16 +160,67 @@
 download portable/inet_aton.c lib inet_aton.c
 download portable/inet_ntoa.c lib inet_ntoa.c
 download portable/inet_ntop.c lib inet_ntop.c
+download portable/macros.h include/portable macros.h
 download portable/mkstemp.c lib mkstemp.c
+download portable/reallocarray.c lib reallocarray.c
 download portable/setenv.c lib setenv.c
 download portable/seteuid.c lib seteuid.c
 download portable/snprintf.c lib snprintf.c
 download portable/socket.h include/portable socket.h
+download portable/stdbool.h include/portable stdbool.h
 download portable/strlcat.c lib strlcat.c
 download portable/strlcpy.c lib strlcpy.c
+download portable/uio.h include/portable uio.h
 
-# Synchronize utility functions from upstream.
+##  Synchronize utility functions from upstream.
 download util/buffer.c lib buffer.c
 download util/buffer.h include/inn buffer.h
 download util/fdflag.c lib fdflag.c
 download util/fdflag.h include/inn fdflag.h
+download util/macros.h include/inn macros.h
+download util/messages.c lib messages.c
+download util/messages.h include/inn messages.h
+download util/network.c lib network.c
+download util/network.h include/inn network.h
+download util/vector.c lib vector.c
+download util/vector.h include/inn vector.h
+download util/xmalloc.c lib xmalloc.c
+download util/xmalloc.h include/inn xmalloc.h
+download util/xwrite.c lib xwrite.c
+download util/xwrite.h include/inn xwrite.h
+
+##  Synchronize test suite files for portability functions from upstream.
+download tests/portable/asprintf-t.c tests/lib asprintf-t.c
+download tests/portable/getaddrinfo-t.c tests/lib getaddrinfo-t.c
+download tests/portable/getnameinfo-t.c tests/lib getnameinfo-t.c
+download tests/portable/inet_aton-t.c tests/lib inet_aton-t.c
+download tests/portable/inet_ntoa-t.c tests/lib inet_ntoa-t.c
+download tests/portable/inet_ntop-t.c tests/lib inet_ntop-t.c
+download tests/portable/mkstemp-t.c tests/lib mkstemp-t.c
+download tests/portable/reallocarray-t.c tests/lib reallocarray-t.c
+download tests/portable/setenv-t.c tests/lib setenv-t.c
+download tests/portable/snprintf-t.c tests/lib snprintf-t.c
+download tests/portable/strlcat-t.c tests/lib strlcat-t.c
+download tests/portable/strlcpy-t.c tests/lib strlcpy-t.c
+
+##  Synchronize test suite files for utility functions from upstream.
+download tests/util/buffer-t.c tests/lib buffer-t.c
+download tests/util/fakewrite.c tests/lib fakewrite.c
+download tests/util/fdflag-t.c tests/lib fdflag-t.c
+download tests/util/messages-t.c tests/lib messages-t.c
+download tests/util/vector-t.c tests/lib vector-t.c
+download tests/util/xmalloc-t tests/lib xmalloc.t
+download tests/util/xmalloc.c tests/lib xmalloc.c
+download tests/util/xwrite-t.c tests/lib xwrite-t.c
+download tests/util/network/addr-ipv4-t.c tests/lib/network addr-ipv4-t.c
+download tests/util/network/addr-ipv6-t.c tests/lib/network addr-ipv6-t.c
+download tests/util/network/client-t.c tests/lib/network client-t.c
+download tests/util/network/server-t.c tests/lib/network server-t.c
+
+##  Synchronize useful utility functions used for the test suite from upstream.
+download tests/tap/messages.c tests/tap messages.c
+download tests/tap/messages.h tests/tap messages.h
+download tests/tap/process.c tests/tap process.c
+download tests/tap/process.h tests/tap process.h
+download tests/tap/string.c tests/tap string.c
+download tests/tap/string.h tests/tap string.h



More information about the inn-committers mailing list