Support for file type in -p to process all kinds of files from
authorPekka Riikonen <priikone@silcnet.org>
Sun, 1 May 2005 17:07:48 +0000 (17:07 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 1 May 2005 17:07:48 +0000 (17:07 +0000)
command line.

apps/autodist/autodist.in
apps/autodist/doc/autodist.1.in
apps/autodist/doc/autodist.texi
apps/autodist/tests/autodist1.test
apps/autodist/tests/autodist7.test

index 72a86a1c25f66f1ba8b9d81cf4e174670968b16a..2e600820d2080f9e25b35872a822deceb4352a28 100755 (executable)
@@ -533,7 +533,7 @@ EOF
 
 # S_AD_ENABLE_DEPENDENCIES
 \$(srcdir)/Makefile.am: Makefile.ad
-       cd \$(top_srcdir) && autodist -p \$(subdir)/Makefile.ad \$(subdir)/Makefile.am && cd \$(subdir)
+       cd \$(top_srcdir) && autodist -p makefile \$(subdir)/Makefile.ad \$(subdir)/Makefile.am && cd \$(subdir)
 # E_AD_ENABLE_DEPENDENCIES
 EOF
   fi
@@ -1713,13 +1713,13 @@ ad_process_source_file()
 }
 
 #
-# Processes a non-source file.  This is the -p, --process option.
+# Processes a file.  This is the -p, --process option.
 #
-# Arguments: ad_process <src> <dst>
+# Arguments: ad_process <type> <src> <dst>
 #
 ad_process()
 {
-  ad_debug "Starting process: $1 $2"
+  ad_debug "Starting process: $1 $2 $3"
 
   nolog=true
 
@@ -1729,13 +1729,41 @@ ad_process()
 
   # Parse distribution
   distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
+  dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
   ad_parse_distribution $distribution false
   ad_process_distdefs
 
   # Process file
-  ad_make_makefile_am $1 $2
+  case "$1" in
+    makefile)
+      if test -z $3; then
+       ad_fatal "File type $1 requires <dst> argument"
+      fi
+      ad_make_makefile_am $2 $3
+      exit 0;;
+
+    configure)
+      ad_make_configure_ac $2
+      exit 0;;
+
+    non-source)
+      if test -z $3; then
+       ad_fatal "File type $1 requires <dst> argument"
+      fi
+      ad_process_file $2 $3 false
+      exit 0;;
+
+    source)
+      if test -z $3; then
+       ad_fatal "File type $1 requires <dst> argument"
+      fi
+      ad_process_source_file $2 $3 false
+      exit 0;;
 
-  ad_debug "Ending process: $1 $2"
+    *)
+      ad_fatal "Unknown file type: $1";
+      ;;
+  esac
 }
 
 #
@@ -1811,8 +1839,10 @@ Operation modes:
   -s, --distdefs [<dist>]   print distribution defines of <dist>, then exit
   -i, --init                initialize Autodist environment, create default
                             distribution directory and distribution, then exit
-  -p, --process <src> <dst> process Makefile.ad file <src> into <dst> for 
-                            distribution, the exit
+  -p, --process <type> <src> [<dst>]
+                            process file <src> into <dst> for distribution,
+                            <type> is 'makefile', 'configure', 'non-source'
+                            or 'source' and defines the type of <src>
   -m, --makedist            create and package distribution
       --gzip                create package compressed with gzip (default)
       --bzip2               create also package compressed with bzip2
@@ -1857,8 +1887,8 @@ while test $# -gt 0; do
 
   -p | --process)
     shift;
-    if test $# -eq 2; then
-      ad_process $1 $2
+    if test $# -ge 2; then
+      ad_process $1 $2 $3
     else
       echo "${usage}" 1>&2;
     fi
index 45a7b0f22c17a01908e40afd3fec303ec5961076..90b731211ff27885a1de18170956b53d7802528a 100644 (file)
@@ -57,8 +57,9 @@ directory 'distdir', 'autodist.conf' configuration file and the
 default distribution 'default', then exits.
 .PP
 .TP
-\fB\-p\fR, \fB\-\-process\fR \fB<src>\fR \fB<dst>\fR
-Process Makefile.ad file <src> into <dst> for distribution, the exits.
+\fB\-p\fR, \fB\-\-process\fR \fB<type>\fR \fB<src>\fR \fB<dst>\fR
+Process file <src> into <dst> for distribution, <type> is 'makefile', 
+'configure', 'non-source' or 'source' and defines the type of <src>.
 .PP
 .TP
 \fB\-m\fR, \fB\-\-makedist\fR
index c5350622f5d73e374e06595a713d9063d70acd25..2d2cd57358ab6ce9234682930676d36f8a5a9fc3 100644 (file)
@@ -1329,8 +1329,10 @@ directory 'distdir', 'autodist.conf' configuration file and the
 default distribution 'default', then exits.
 
 @item -p
-@itemx --process <src> <dst>
-process Makefile.ad file <src> into <dst> for distribution, the exits.
+@itemx --process <type> <src> <dst>
+Process file <src> into <dst> for distribution, <type> is 'makefile',
+'configure', 'non-source' or 'source' and defines the type of <src>,
+then exits.
 
 @item -m
 @itemx --makedist
index f475436d5f060cfec41d8800ec8dd842a00d1fda..f1b70935f12bee7733f4f6c310fe5d438bac5188 100755 (executable)
@@ -72,8 +72,12 @@ $AUTODIST || exit 1
 make || exit 1
 echo make ok
 
+echo update test
+touch Makefile.ad
+make || exit 1
+echo update test ok
+
 echo test ok
 
 # Cleanup
 rm -rf subdir distdir
-
index 00c8c794ecfa2b8c6bc1b90d506514d467eeffcd..6570cab2080091111f4d2e2bb75da4923848a610 100755 (executable)
@@ -11,7 +11,7 @@ chmod +x $AUTODIST || exit 1
 
 cat << EOF > configure.ad
 AD_INIT
-AD_ENABLE_DEPENDENCIES
+AD_DISABLE_DEPENDENCIES
 #ifdef _DIST_DEFAULT
 AC_CANONICAL_BUILD
 AM_INIT_AUTOMAKE