X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=gnulib-tool;h=72fa60eb669cfc21ead216a6fa27e600a5c2a807;hb=c63680ec113137bebde908d1193bc5b3b51e2e19;hp=eadd98dc90a3185f1566dd9715c11fc15e4bd32a;hpb=719a72d0a3a1b23be0d4c18f9d692d28d160e959;p=gnulib.git diff --git a/gnulib-tool b/gnulib-tool index eadd98dc9..72fa60eb6 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -22,7 +22,7 @@ progname=$0 package=gnulib -cvsdatestamp='$Date: 2007-03-06 03:38:30 $' +cvsdatestamp='$Date: 2007-05-28 15:46:55 $' last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'` version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'` nl=' @@ -826,6 +826,7 @@ func_all_modules () -e '/^COPYING$/d' -e '/\/COPYING$/d' \ -e '/^README$/d' -e '/\/README$/d' \ -e '/^TEMPLATE$/d' \ + -e '/^TEMPLATE-EXTENDED$/d' \ -e '/^TEMPLATE-TESTS$/d' \ -e '/^\..*/d' \ -e '/~$/d' \ @@ -848,6 +849,7 @@ func_verify_module () && test "COPYING" != "$module" \ && test "README" != "$module" \ && test "TEMPLATE" != "$module" \ + && test "TEMPLATE-EXTENDED" != "$module" \ && test "TEMPLATE-TESTS" != "$module"; then # OK, $module is a correct module name. # Verify that building the module description with 'patch' succeeds. @@ -1173,7 +1175,9 @@ ba done # Add the dummy module, to make sure the library will be non-empty. if test -z "$have_lib_SOURCES"; then - func_append modules " dummy" + if func_acceptable "dummy"; then + func_append modules " dummy" + fi fi } @@ -1562,6 +1566,7 @@ func_import () cached_m4base= cached_docbase= cached_testsbase= + cached_inctests= cached_libname= cached_lgpl= cached_makefile_name= @@ -1595,6 +1600,9 @@ func_import () /gl_TESTS_BASE(/ { s,^.*gl_TESTS_BASE([[ ]*\([^])]*\).*$,cached_testsbase="\1",p } + /gl_WITH_TESTS/ { + s,^.*$,cached_inctests=true,p + } /gl_LIB(/ { s,^.*gl_LIB([[ ]*\([^])]*\).*$,cached_libname="\1",p } @@ -1683,6 +1691,10 @@ func_import () func_fatal_error "missing --tests-base option" fi fi + # Require the tests if specified either way. + if test -z "$inctests"; then + inctests="$cached_inctests" + fi # The libname defaults to the cached one. if test -z "$supplied_libname"; then libname="$cached_libname" @@ -1835,6 +1847,8 @@ func_import () } # Copy files or make symbolic links. Remove obsolete files. + added_files='' + removed_files='' delimiter=' ' # Construct a table with 2 columns: rewritten-file-name original-file-name, # representing the files according to the last gnulib-tool invocation. @@ -1859,6 +1873,7 @@ func_import () else echo "Remove file $g (backup in ${g}~)" fi + func_append removed_files "$g$nl" fi done # func_add_or_update handles a file that ought to be present afterwards. @@ -1927,6 +1942,7 @@ func_import () else echo "Copy file $g" fi + func_append added_files "$g$nl" fi rm -f "$tmpfile" } @@ -1969,6 +1985,9 @@ func_import () func_append actioncmd " --m4-base=$m4base" func_append actioncmd " --doc-base=$docbase" func_append actioncmd " --aux-dir=$auxdir" + if test -n "$inctests"; then + func_append actioncmd " --with-tests" + fi for module in $avoidlist; do func_append actioncmd " --avoid=$module" done @@ -2020,6 +2039,7 @@ func_import () echo "Create $sourcebase/$makefile_am" rm -f "$tmpfile" fi + func_append added_files "$sourcebase/$makefile_am$nl" fi # Create m4/gnulib-cache.m4. @@ -2057,6 +2077,7 @@ func_import () echo "gl_M4_BASE([$m4base])" echo "gl_DOC_BASE([$docbase])" echo "gl_TESTS_BASE([$testsbase])" + test -z "$inctests" || echo "gl_WITH_TESTS" echo "gl_LIB([$libname])" test -z "$lgpl" || echo "gl_LGPL" echo "gl_MAKEFILE_NAME([$makefile_name])" @@ -2245,9 +2266,86 @@ func_import () echo "Create $testsbase/$makefile_am" rm -f "$tmpfile" fi + func_append added_files "$testsbase/$makefile_am$nl" fi fi + # Update the .cvsignore and .gitignore files. + { echo "$added_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|A|\1,' + echo "$removed_files" | sed -e '/^$/d' -e 's,\([^/]*\)$,|R|\1,' + } | LC_ALL=C sort -t'|' -k1,1 > "$tmp"/fileset-changes + { # Rearrange file descriptors. Needed because "while ... done < ..." + # constructs are executed in a subshell e.g. by Solaris 10 /bin/sh. + exec 5<&0 < "$tmp"/fileset-changes + func_update_ignorelist () + { + ignore="$1" + if test -f "$destdir/$dir$ignore"; then + if test -n "$dir_added" || test -n "$dir_removed"; then + LC_ALL=C sort "$destdir/$dir$ignore" > "$tmp"/ignore + echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u \ + | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-added + echo "$dir_removed" | sed -e '/^$/d' | LC_ALL=C sort -u \ + | LC_ALL=C join -v 2 "$tmp"/ignore - > "$tmp"/ignore-removed + if test -s "$tmp"/ignore-added || test -s "$tmp"/ignore-removed; then + if $doit; then + echo "Updating $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)" + mv -f "$destdir/$dir$ignore" "$destdir/$dir$ignore"~ + sed -e 's,^,/^,' -e 's,$,\$/d,' < "$tmp"/ignore-removed > "$tmp"/sed-ignore-removed + cat "$destdir/$dir$ignore"~ "$tmp"/ignore-added \ + | sed -f "$tmp"/sed-ignore-removed \ + > "$destdir/$dir$ignore" + else + echo "Update $destdir/$dir$ignore (backup in $destdir/$dir${ignore}~)" + fi + fi + fi + else + if test -n "$dir_added"; then + if $doit; then + echo "Creating $destdir/$dir$ignore" + echo "$dir_added" | sed -e '/^$/d' | LC_ALL=C sort -u > "$destdir/$dir$ignore" + else + echo "Create $destdir/$dir$ignore" + fi + fi + fi + } + func_done_dir () + { + dir="$1" + dir_added="$2" + dir_removed="$3" + if test -d "$destdir/${dir}CVS" || test -f "$destdir/${dir}.cvsignore"; then + func_update_ignorelist .cvsignore + fi + if test -d "$destdir/.git" || test -f "$destdir/${dir}.gitignore"; then + func_update_ignorelist .gitignore + fi + } + last_dir= + last_dir_added= + last_dir_removed= + while read line; do + # Why not ''read next_dir op file'' ? Because the dir column can be empty. + next_dir=`echo "$line" | sed -e 's,|.*,,'` + op=`echo "$line" | sed -e 's,^[^|]*|\([^|]*\)|.*$,\1,'` + file=`echo "$line" | sed -e 's,^[^|]*|[^|]*|,,'` + if test "$next_dir" != "$last_dir"; then + func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed" + last_dir="$next_dir" + last_dir_added= + last_dir_removed= + fi + case $op in + A) func_append last_dir_added "$file$nl";; + R) func_append last_dir_removed "$file$nl";; + esac + done + func_done_dir "$last_dir" "$last_dir_added" "$last_dir_removed" + exec 0<&5 5<&- + } + echo "Finished." echo echo "You may need to add #include directives for the following .h files." @@ -2739,15 +2837,15 @@ func_create_testdir () fi # Need to run configure and make once, to create built files that are to be # distributed (such as getdate.c). - # Extract the value of "CLEANFILES += ...". + # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...". cleaned_files=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \ - | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p'` - cleaned_files=" "`for file in $cleaned_files; do echo "$file"; done`" " + | sed -n -e 's,^CLEANFILES[ ]*+=\([^#]*\).*$,\1,p' -e 's,^MOSTLYCLEANFILES[ ]*+=\([^#]*\).*$,\1,p'` + cleaned_files=`for file in $cleaned_files; do echo " $file "; done` # Extract the value of "BUILT_SOURCES += ...". Remove variable references # such $(FOO_H) because they don't refer to distributed files. sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g' built_sources=`sed -e "$sed_remove_backslash_newline" < "$testdir/$sourcebase/Makefile.am" \ - | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \ + | sed -n -e 's,^BUILT_SOURCES[ ]*+=\([^#]*\).*$,\1,p' \ | sed -e "$sed_remove_make_variables"` distributed_built_sources=`for file in $built_sources; do case "$cleaned_files" in @@ -2792,12 +2890,50 @@ func_create_megatestdir () func_create_testdir "$megatestdir/ALL" "$allmodules" func_append megasubdirs "ALL" + # Create autobuild. + cvsdate=`sh "$gnulib_dir/build-aux/mdate-sh" "$gnulib_dir/CVS/Entries" \ + | sed -e 's,January,01,' -e 's,Jan,01,' \ + -e 's,February,02,' -e 's,Feb,02,' \ + -e 's,March,03,' -e 's,Mar,03,' \ + -e 's,April,04,' -e 's,Apr,04,' \ + -e 's,May,05,' \ + -e 's,June,06,' -e 's,Jun,06,' \ + -e 's,July,07,' -e 's,Jul,07,' \ + -e 's,August,08,' -e 's,Aug,08,' \ + -e 's,September,09,' -e 's,Sep,09,' \ + -e 's,October,10,' -e 's,Oct,10,' \ + -e 's,November,11,' -e 's,Nov,11,' \ + -e 's,December,12,' -e 's,Dec,12,' \ + | sed -e 's,^,00,' | sed -e 's,^[0-9]*\([0-9][0-9] \),\1,' \ + | sed -e 's,^\([0-9]*\) \([0-9]*\) \([0-9]*\),\3\2\1,'` + (echo '#!/bin/sh' + echo "CVSDATE=$cvsdate" + echo "test -d logs || mkdir logs" + echo "for module in $megasubdirs; do" + echo " echo \"Working on module \$module...\"" + echo " safemodule=\`echo \$module | sed -e 's|/|-|g'\`" + echo " (echo \"To: gnulib@autobuild.josefsson.org\"" + echo " echo" + echo " set -x" + echo " : autobuild project... \$module" + echo " : autobuild revision... cvs-\$CVSDATE-000000" + echo " : autobuild timestamp... \`date \"+%Y%m%d-%H%M%S\"\`" + echo " : autobuild hostname... \`hostname\`" + echo " cd \$module && ./configure \$CONFIGURE_OPTIONS && make && make check && make distclean" + echo " echo rc=\$?" + echo " ) 2>&1 | { if test -n \"\$AUTOBUILD_SUBST\"; then sed -e \"\$AUTOBUILD_SUBST\"; else cat; fi; } > logs/\$safemodule" + echo "done" + ) > "$megatestdir/do-autobuild" + chmod a+x "$megatestdir/do-autobuild" + # Create Makefile.am. (echo "## Process this file with automake to produce Makefile.in." echo echo "AUTOMAKE_OPTIONS = 1.5 foreign" echo echo "SUBDIRS = $megasubdirs" + echo + echo "EXTRA_DIST = do-autobuild" ) > "$megatestdir/Makefile.am" # Create configure.ac. @@ -2956,7 +3092,8 @@ case $mode in # Perform func_import in a subshell, so that variable values # such as # local_gnulib_dir, avoidlist, sourcebase, m4base, docbase, - # testsbase, libname, lgpl, makefile_name, libtool, macro_prefix + # testsbase, inctests, libname, lgpl, makefile_name, libtool, + # macro_prefix # don't propagate from one directory to another. (func_import) || func_exit 1 done