OS400/initscript.sh: fix db2_name() module name generation
authorYang Tse <yangsita@gmail.com>
Thu, 12 Apr 2012 17:13:23 +0000 (19:13 +0200)
committerYang Tse <yangsita@gmail.com>
Thu, 12 Apr 2012 17:13:23 +0000 (19:13 +0200)
Allow repeatable file name length reduction on file names with underscore or
dash characters. This is done in order to better support libcurl's existing
source file names and allow OS/400 package to build out of the box again.

packages/OS400/initscript.sh

index 97e9781..d28a8db 100644 (file)
@@ -157,6 +157,10 @@ db2_name()
         basename "${1}"                                                 |
         tr 'a-z-' 'A-Z_'                                                |
         sed -e 's/\..*//'                                               \
+            -e 's/\([^_]\)[^_]*_\(.*\)/\1\2/'                                \
+            -e 's/\([^_]\)\([^_]\)[^_]*_\(.*\)/\1\2\3/'                      \
+            -e 's/\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\)/\1\2\3\4/'            \
+            -e 's/\([^_]\)\([^_]\)\([^_]\)\([^_]\)[^_]*_\(.*\)/\1\2\3\4\5/'  \
             -e 's/^\(..........\).*/\1/'
 }