From b6e0f5409b1f137f27df56cd5a82fe03054db3ae Mon Sep 17 00:00:00 2001 From: Pekka Riikonen Date: Sun, 17 Apr 2005 20:18:24 +0000 Subject: [PATCH] Added [pre|post]-process-dist-hook hooks. --- apps/autodist/CHANGES | 9 ++++ apps/autodist/autodist.in | 24 +++++++-- apps/autodist/doc/autodist.texi | 92 ++++++++++++++++++++++++++------- 3 files changed, 101 insertions(+), 24 deletions(-) create mode 100644 apps/autodist/CHANGES diff --git a/apps/autodist/CHANGES b/apps/autodist/CHANGES new file mode 100644 index 0000000..b9fe82d --- /dev/null +++ b/apps/autodist/CHANGES @@ -0,0 +1,9 @@ +Sun Apr 17 20:08:28 EEST 2005 Pekka Riikonen + + * Added TODO. + + * Added pre-process-dist-hook and post-process-dist-hook. + +Sun Apr 16 23:00:02 EEST 2005 Pekka Riikonen + + * First release, Autodist 1.0. diff --git a/apps/autodist/autodist.in b/apps/autodist/autodist.in index 27e6c22..33c49f6 100755 --- a/apps/autodist/autodist.in +++ b/apps/autodist/autodist.in @@ -74,11 +74,13 @@ excludes= # All noprocesses noprocess= -# All pre, post pre-dist and post-dist hooks +# All hooks pre_hooks= post_hooks= pre_dist_hooks= post_dist_hooks= +pre_p_dist_hooks= +post_p_dist_hooks= # Distribution license and license header license= @@ -784,6 +786,9 @@ ad_makedist() ad_fatal "The '$distribution' distribution cannot be packaged" fi + # Run pre-dist-hooks + ad_run_dist_hooks "$pre_dist_hooks" + # Create distribution directory ad_debug "Creating distribution directory $am_distdir" $MAKE distdir || exit 1 @@ -793,8 +798,8 @@ ad_makedist() ad_fatal "Distribution directory $am_distdir not created" fi - # Run pre-dist-hooks - ad_run_dist_hooks "$pre_dist_hooks" + # Run pre-process-dist-hooks + ad_run_dist_hooks "$pre_p_dist_hooks" # Run excludes ad_dist_excludes "$excludes" @@ -818,8 +823,8 @@ ad_makedist() ad_debug "Process distribution tree" ad_process_tree $am_distdir - # Run post-dist-hooks - ad_run_dist_hooks "$post_dist_hooks" + # Run post-process_dist-hooks + ad_run_dist_hooks "$post_p_dist_hooks" # Make distribution sane ad_makedist_makesane @@ -845,6 +850,9 @@ ad_makedist() fi rm -f $am_distdir.tar + # Run post-dist-hooks + ad_run_dist_hooks "$post_dist_hooks" + # Cleanup rm -rf $am_distdir rm -f autodist.noprocess @@ -1032,11 +1040,17 @@ ad_parse_distribution() | grep "pre-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-` local podh=`cat $distdir/$1 | grep -v "^#" \ | grep "post-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-` + local prpdh=`cat $distdir/$1 | sed 's/^[ ]*//' | grep -v "^#" \ + | grep "pre-process-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-` + local popdh=`cat $distdir/$1 | grep -v "^#" \ + | grep "post-process-dist-hook " | sed 's/^[ ]*//' | cut -d' ' -f2-` pre_hooks="$pre_hooks $prh" post_hooks="$post_hooks $poh" pre_dist_hooks="$pre_dist_hooks $prdh" post_dist_hooks="$post_dist_hooks $podh" + pre_p_dist_hooks="$pre_p_dist_hooks $prpdh" + post_p_dist_hooks="$post_p_dist_hooks $popdh" options="$options $opts" ad_handle_options "$options" diff --git a/apps/autodist/doc/autodist.texi b/apps/autodist/doc/autodist.texi index 870cc91..dc1190b 100644 --- a/apps/autodist/doc/autodist.texi +++ b/apps/autodist/doc/autodist.texi @@ -805,6 +805,39 @@ executes the script: distribution name, distribution version and package name of distribution. The script may use these arguments if it needs them. +@section Directive: pre-process-dist-hook [...] + +The 'pre-process-dist-hook' directive can be used define additional +scripts that will be run when Autodist has started distribution creation. +This directive is optional. One or more scripts may be defined in one +'pre-process-dist-hook' directive. Zero or more 'pre-process-dist-hook' +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. + + +@section Directive: post-process-dist-hook [...] + +The 'post-process-dist-hook' directive can be used define additional +scripts that will be run when Autodist has finished distribution +processing. This directive is optional. One or more scripts may be +defined in one 'post-process-dist-hook' directive. Zero or more +'post-process-dist-hook' directives may be set for distribution. The +'post-process-dist-hook' hook will be run immediately after the Autodist +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. + + @section Directive: pre-dist-hook [...] The 'pre-dist-hook' directive can be used define additional scripts that @@ -812,8 +845,8 @@ will be run when Autodist has started distribution creation. This directive is optional. One or more scripts may be defined in one 'pre-dist-hook' directive. Zero or more 'pre-dist-hook' directives may be set for distribution. The 'pre-dist-hook' hook will be run immediately after -the Autodist has created the distribution directory but has not yet -started any distribution processing. +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 @@ -823,13 +856,13 @@ script may use these arguments if it needs them. @section Directive: post-dist-hook [...] -The 'post-dist-hook' directive can be used define additional scripts that -will be run when Autodist has finished distribution processing. This -directive is optional. One or more scripts may be defined in one -'post-dist-hook' directive. Zero or more 'post-dist-hook' directives may -be set for distribution. The 'post-dist-hook' hook will be run immediately -after the Autodist has finished processing the destination distribution -directory but has not yet created the distribution package. +The 'post-dist-hook' directive can be used define additional scripts that +will be run when Autodist has finished distribution creation. This +directive is optional. One or more scripts may be defined in one +'post-dist-hook' directive. Zero or more 'post-dist-hook' directives may +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 @@ -837,6 +870,27 @@ name of distribution and destination distribution directory name. The script may use these arguments if it needs them. +@section Running hooks + +The Autodist runs the hooks in the following order: + +Preparing source tree for configuration and compilation: +@example +pre-hook +post-hook +@end example + +Creating distribution: +@example +pre-dist-hook +pre-process-dist-hook +post-process-dist-hook +post-dist-hook +@end example + +When creating distribution the 'pre-hook' and 'post-hook' are not run. + + @section Example distfile The following is a simple distfile example. The example assumes that the @@ -856,8 +910,8 @@ define SILC_DIST_IRSSI undef SILC_DIST_MPI exclude doc/draft* pre-hook scripts/client-pre-run -post-dist-hook scripts/client-post-dist-run -post-dist-hook scripts/client-post-dist-kludge +post-process-dist-hook scripts/client-post-process +post-dist-hook scripts/client-post-dist-bin @end example @menu @@ -1235,7 +1289,7 @@ or using 'autogen.sh' script is not necessary. By default the 'autodist.conf' (@pxref{autodist.conf, , , , }) has defined the tools that will be run by the Autodist when preparing the source tree. These are 'aclocal', 'autoheader', 'autoconf', 'automake' and -'libtoolize'. If you do not whish that Autodist runs some or any of these +'libtoolize'. If you do not wish that Autodist runs some or any of these tools automatically, do not set them in the 'autodist.conf'. You would then need to run them manually. However, this is not recommended. If you need to run additional preparation scripts you may set your scripts either @@ -1262,10 +1316,10 @@ distribution run Autodist without any arguments. The Autodist will prepare your source tree. After that you may run './configure' and continue to compile with 'make'. -If you do not whish to use the 'default' distribution, or you whish +If you do not wish to use the 'default' distribution, or you wish to do the development in a tree specificly prepared for some specific distribution, or you are preparing to create a new distribution package, -you will need to run the Autodist with the distribution you whish to +you will need to run the Autodist with the distribution you wish to prepare. @example @@ -1309,7 +1363,7 @@ Before creating a new distribution package, you will need to prepare the source tree for the distribution you want to create. After preparing your source tree you will be ready to create a new distribution. The Autodist package provides a simple helper script 'makedist' that may -be used to create the distribution. However, if you whish, you may +be used to create the distribution. However, if you wish, you may run the Autodist yourself, as the 'makedist' will call Autodist anyway. To create a new distribution for the distribution you have prepared for @@ -1320,7 +1374,7 @@ run makedist. @end example This will run the Autodist and create a new distribution package that -is archived with 'tar' and compressed with 'gzip'. If you whish to +is archived with 'tar' and compressed with 'gzip'. If you wish to create packages also compressed with 'bzip2', 'compress' and/or 'zip' you may give one or all of the following options: @@ -1332,7 +1386,7 @@ This example would create, in addition of 'tar.gz' package, also a 'tar.bz2', 'tar.Z' and '.zip' packages. Current version of Autodist does not support archiving with 'shar'. -If you whish to run additional processing for your distributions when +If you wish to run additional processing for your distributions when they are being packaged you may set 'pre-dist-hook' and/or 'post-dist-hook' in your distribution file. Also note that any hooks provided by Automake in Makefiles will be run in normal manner. @@ -1356,7 +1410,7 @@ For additional help, you may give: @section Single distribution tree example, start to finish Lets suppose you have a simple source tree with one application, -called 'foozbar' you whish to release. While you would probably suffice +called 'foozbar' you wish to release. While you would probably suffice using Autoconf and Automake features you may still use Autodist. First, you create the default 'distdir' into your software package: @@ -1387,7 +1441,7 @@ define _DIST_FOOZBAR This distribution file go into 'distdir/foozbar'. And there you go. You have succesfully integrated Autodist into your -source tree. If you need to do development and you whish to use the +source tree. If you need to do development and you wish to use the 'default' distribution for that, you should inherit the new 'foozbar' distribution in it. Add the following line in 'distdir/default': -- 2.24.0