Added support for passing extra parameters for autodist and autodist.1.3.2
authorPekka Riikonen <priikone@silcnet.org>
Fri, 1 Jun 2007 08:36:16 +0000 (08:36 +0000)
committerPekka Riikonen <priikone@silcnet.org>
Fri, 1 Jun 2007 08:36:16 +0000 (08:36 +0000)
autodist hook scripts.

apps/autodist/CHANGES
apps/autodist/autodist.in
apps/autodist/autodist.spec.in
apps/autodist/doc/autodist.1.in
apps/autodist/doc/autodist.texi

index 36a0f14ad3eea03b87d6ab2148ea0378f5aea513..a14e56ab6f4dd6a46c12d75669cc4ef47683a1f7 100644 (file)
@@ -1,3 +1,11 @@
+Thu May 31 23:34:00 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+
+       * Autodist 1.3.2.
+
+       * Added support for providing extra parameters to autodist that
+         are passed to the hook scripts.  User can specify whatever
+         extra parameter they want.
+
 Wed Feb 21 15:45:50 EET 2007 Pekka Riikonen <priikone@silcnet.org>
 
        * Autodist 1.3.1.
index 8b30e67f0f5716fc2de52affe9e9f35bfee17f96..517aae779c55401f42ae1d2437e4ae0d26de0442 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # Author: Pekka Riikonen <priikone@silcnet.org>
 #
-# Copyright (C) 2005 Pekka Riikonen
+# Copyright (C) 2005 - 2007 Pekka Riikonen
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
@@ -996,6 +996,7 @@ ad_makedist()
   distribution=`grep "dist:" < autodist.dist | cut -d: -f2` || exit 1
   dist_version=`grep "ver:" < autodist.dist | cut -d: -f2` || exit 1
   am_distdir=`grep "distdir:" < autodist.dist | cut -d: -f2` || exit 1
+  params=`grep "params:" < autodist.dist | cut -d: -f2` || exit 1
   ad_parse_distribution $distribution false
   ad_log "  Distribution: $distribution $dist_version"
   ad_log "  Destination directory: $am_distdir"
@@ -1007,7 +1008,7 @@ ad_makedist()
   fi
 
   # Run pre-dist-hooks
-  ad_run_dist_hooks "$pre_dist_hooks"
+  ad_run_dist_hooks "$pre_dist_hooks" "$params"
 
   # Create distribution directory
   ad_debug "Creating distribution directory $am_distdir"
@@ -1019,7 +1020,7 @@ ad_makedist()
   fi
 
   # Run pre-process-dist-hooks
-  ad_run_dist_hooks "$pre_p_dist_hooks"
+  ad_run_dist_hooks "$pre_p_dist_hooks" "$params"
 
   # Run excludes
   ad_dist_excludes "$excludes" true
@@ -1061,7 +1062,7 @@ ad_makedist()
   ad_process_noprocess false
 
   # Run post-process_dist-hooks
-  ad_run_dist_hooks "$post_p_dist_hooks"
+  ad_run_dist_hooks "$post_p_dist_hooks" "$params"
 
   # Make distribution sane
   ad_makedist_makesane
@@ -1092,7 +1093,7 @@ ad_makedist()
   rm -f $am_distdir.tar
 
   # Run post-dist-hooks
-  ad_run_dist_hooks "$post_dist_hooks"
+  ad_run_dist_hooks "$post_dist_hooks" "$params"
 
   # Cleanup
   rm -rf $am_distdir
@@ -1775,7 +1776,7 @@ ad_process()
 #
 # Run hooks
 #
-# Arguments: ad_run_hooks <hooks>
+# Arguments: ad_run_hooks <hooks> <params>
 #
 ad_run_hooks()
 {
@@ -1790,8 +1791,8 @@ ad_run_hooks()
     if test '!' -f $i; then
       ad_fatal "Hook script $i does not exist"
     fi
-    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\""
-    sh $i "$distribution" "$dist_version" "$package" || exit 1
+    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$2\""
+    sh $i "$distribution" "$dist_version" "$package" "$2" || exit 1
   done
   ad_log ""
 
@@ -1801,7 +1802,7 @@ ad_run_hooks()
 #
 # Run dist hooks
 #
-# Arguments: ad_run_dist_hooks <hooks>
+# Arguments: ad_run_dist_hooks <hooks> <params>
 #
 ad_run_dist_hooks()
 {
@@ -1817,8 +1818,8 @@ ad_run_dist_hooks()
       ad_fatal "Dist hook script $i does not exist"
     fi
 
-    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\""
-    sh $i "$distribution" "$dist_version" "$package" "$am_distdir" || exit 1
+    ad_log "  sh $i \"$distribution\" \"$dist_version\" \"$package\" \"$am_distdir\" \"$2\""
+    sh $i "$distribution" "$dist_version" "$package" "$am_distdir" "$2" || exit 1
   done
   ad_log ""
 
@@ -1828,7 +1829,7 @@ ad_run_dist_hooks()
 ###############################################################################
 # Autodist code
 
-usage="Usage: autodist [options] [distribution] [version]"
+usage="Usage: autodist [options] [distribution] [version] [params]"
 help="\
 Autodist prepares source tree for configuration, compilation and
 distribution.  Generates Automake.am files from Automake.ad files, 
@@ -1934,7 +1935,7 @@ while test $# -gt 0; do
     echo "@PACKAGE@ (@PACKAGE_NAME@) $ver" 1>&2;
     echo "Written by Pekka Riikonen" 1>&2;
     echo 1>&2;
-    echo "Copyright (C) 2004 - 2005 SILC Project" 1>&2;
+    echo "Copyright (C) 2004 - 2007 SILC Project" 1>&2;
     echo "\
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. " 1>&2;
@@ -1993,10 +1994,13 @@ else
   ad_fatal "DISTDEFS not defined in $distdir/autodist.conf"
 fi
 
+# Get extra parameters from command line
+shift
+
 #
 # Run pre-hooks
 #
-ad_run_hooks "$pre_hooks"
+ad_run_hooks "$pre_hooks" "$@"
 
 #
 # Generate the Makefile.am files from Makefile.ad files
@@ -2030,11 +2034,12 @@ ad_debug "Creating autodist.dist"
 echo "dist:$distfile" > autodist.dist
 echo "ver:$dist_version" >> autodist.dist
 echo "distdir:$package-$dist_version" >> autodist.dist
+echo "params:$@" >> autodist.dist
 
 #
 # Run post-hooks
 #
-ad_run_hooks "$post_hooks"
+ad_run_hooks "$post_hooks" "$@"
 
 ad_log "Source tree processed successfully."
 ad_debug "Done, now run ./configure and make."
index f2342cf7a72783a5e2b649a15e4b891bf7be8be0..4455daaa8704841c597003c91d16dfe01e6c9860 100644 (file)
@@ -1,7 +1,7 @@
 Summary: Source distribution management system
 Name: autodist
 Version: AUTODIST_VERSION
-Release: 0.fc7
+Release: AUTODIST_RELEASE
 License: BSD
 Group: Development/Tools
 URL: http://silcnet.org/software/developers/autodist/
index 90b731211ff27885a1de18170956b53d7802528a..5d877bad1a54ec49892d0f041f38296bc148bcd1 100644 (file)
@@ -3,7 +3,7 @@
 Autodist \- Source distribution management system
 .SH SYNOPSIS
 .B autodist
-[options] [distribution] [version]
+[options] [distribution] [version] [params]
 .PP
 .SH DESCRIPTION
 .PP
index a054dac701185bfb3a39ad51e928f985c4fb31ac..cdb4848191d9f72afcd01c39d3be81851b8e669c 100644 (file)
@@ -821,9 +821,11 @@ Zero or more 'pre-hook' directives may be set for distribution.  The
 'pre-hook' hook will be run immediately after invoking Autodist to start
 preparing the source tree for configuration and compilation (@pxref{Preparing source tree, , , , }).
 
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution.  The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when 
+Autodist executes the script: distribution name, distribution version and 
+package name of distribution.  The script may use these arguments if it 
+needs them.  If user passed any extra parameters to autodist in the 
+command line they will also be passed to the script as last arguments.
 
 
 @section Directive: post-hook <filename> [...]
@@ -836,9 +838,11 @@ Zero or more 'post-hook' directives may be set for distribution.  The
 preparing the source three for configuration and compilation (@pxref{Preparing source tree, , , , }).  The Autodist will exit after it has run the
 'post-hook' scripts.
 
-The scripts will get three (3) command line arguments when Autodist
-executes the script: distribution name, distribution version and package
-name of distribution.  The script may use these arguments if it needs them.
+The scripts will get at least three (3) command line arguments when 
+Autodist executes the script: distribution name, distribution version and 
+package name of distribution.  The script may use these arguments if it 
+needs them.  If user passed any extra parameters to autodist in the 
+command line they will also be passed to the script as last arguments.
 
 
 @section Directive: pre-process-dist-hook <filename> [...]
@@ -851,10 +855,12 @@ directives may be set for distribution.  The 'pre-process-dist-hook' hook
 will be run immediately after the Autodist has created the distribution
 directory but has not yet started any distribution processing.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name.  
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: post-process-dist-hook <filename> [...]
@@ -868,10 +874,12 @@ defined in one 'post-process-dist-hook' directive.  Zero or more
 has finished processing the destination distribution directory but has not
 yet created the distribution package.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name.  
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: pre-dist-hook <filename> [...]
@@ -884,10 +892,12 @@ distribution.  The 'pre-dist-hook' hook will be run immediately after
 the Autodist has started distribution creation, but has not yet created
 the distribution directory.  This hook is run before 'pre-process-dist-hook'.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name. 
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Directive: post-dist-hook <filename> [...]
@@ -900,10 +910,12 @@ be set for distribution.  The 'post-dist-hook' hook will be run
 immediately after the Autodist has finished creating the distribution
 package.  This is the last hook Autodist runs.
 
-The scripts will get four (4) command line arguments when Autodist
-executes the script: distribution name, distribution version, package
-name of distribution and destination distribution directory name.  The
-script may use these arguments if it needs them.
+The scripts will get at least four (4) command line arguments when 
+Autodist executes the script: distribution name, distribution version, 
+package name of distribution and destination distribution directory name. 
+The script may use these arguments if it needs them.  If user passed any 
+extra parameters to autodist in the command line they will also be passed 
+to the script as last arguments.
 
 
 @section Running hooks
@@ -1654,6 +1666,7 @@ include doc/nomad
 define _DIST_NOMAD
 define _DIST_NOMAD_LIB
 undef _DIST_CRYPTO
+pre-dist-hook nomad-pre-dist-hook
 @end example
 
 @example
@@ -1767,11 +1780,18 @@ Then you continue with libfoozbar and Nomad:
 autodist libfoozbar 1.0.5
 makedist
 
-autodist nomad 2.0
+Nomad has also an RPM .spec file that you have written and a pre-dist-hook 
+that will replace the RPM release version with sed tool with the one you 
+give as extra parameter to autodist:
+
+autodist nomad 2.0 0.fc7
 makedist
 @end example
 
-The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz'.
+The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz', and 
+the RPM will have a release version '0.fc7' when you compile the RPM.  Any 
+extra parameter that you pass to autodist will be delivered to your hook 
+scripts.
 
 @page
 @contents