#
# 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
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"
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"
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
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
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
#
# Run hooks
#
-# Arguments: ad_run_hooks <hooks>
+# Arguments: ad_run_hooks <hooks> <params>
#
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 ""
#
# Run dist hooks
#
-# Arguments: ad_run_dist_hooks <hooks>
+# Arguments: ad_run_dist_hooks <hooks> <params>
#
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 ""
###############################################################################
# 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,
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;
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
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."
'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> [...]
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> [...]
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> [...]
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> [...]
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> [...]
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
define _DIST_NOMAD
define _DIST_NOMAD_LIB
undef _DIST_CRYPTO
+pre-dist-hook nomad-pre-dist-hook
@end example
@example
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