diff options
author | Peter Powell <petpow@saberuk.com> | 2014-10-01 19:52:28 +0100 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2014-12-07 22:36:42 +0000 |
commit | 541a66de7adbfe57dd4d3e998e8cc0db5585a266 (patch) | |
tree | ec7c11b5a1b1e5f47a7d6d974cc94bc5db10fdb7 | |
parent | 2adb94db3032332ad2235aa032bb195aba89687c (diff) |
Implement support for distribution specific version labels.
This will help us determine whether a version has been packaged by
a downstream distribution who quite often make arbitrary changes
which are a pain to provide support for.
Debian, we're looking at you.
-rwxr-xr-x | configure | 35 | ||||
-rw-r--r-- | make/configure.pm | 18 |
2 files changed, 32 insertions, 21 deletions
@@ -47,6 +47,7 @@ my ($opt_binary_dir, $opt_config_dir, $opt_data_dir, $opt_disable_interactive, + $opt_distribution_label, $opt_gid, $opt_log_dir, $opt_manual_dir, @@ -70,18 +71,19 @@ GetOptions( 'help' => \&cmd_help, 'update' => \&cmd_update, - 'disable-interactive' => \$opt_disable_interactive, - 'binary-dir=s' => \$opt_binary_dir, - 'config-dir=s' => \$opt_config_dir, - 'data-dir=s' => \$opt_data_dir, - 'gid=s' => \$opt_gid, - 'log-dir=s' => \$opt_log_dir, - 'manual-dir=s' => \$opt_manual_dir, - 'module-dir=s' => \$opt_module_dir, - 'prefix=s' => \$opt_prefix, - 'socketengine=s' => \$opt_socketengine, - 'system' => \$opt_system, - 'uid=s' => \$opt_uid, + 'disable-interactive' => \$opt_disable_interactive, + 'distribution-label=s' => \$opt_distribution_label, + 'binary-dir=s' => \$opt_binary_dir, + 'config-dir=s' => \$opt_config_dir, + 'data-dir=s' => \$opt_data_dir, + 'gid=s' => \$opt_gid, + 'log-dir=s' => \$opt_log_dir, + 'manual-dir=s' => \$opt_manual_dir, + 'module-dir=s' => \$opt_module_dir, + 'prefix=s' => \$opt_prefix, + 'socketengine=s' => \$opt_socketengine, + 'system' => \$opt_system, + 'uid=s' => \$opt_uid, # TODO: when the modulemanager rewrite is done these should be removed. 'disable-extras=s@' => \@opt_disableextras, @@ -106,6 +108,7 @@ our $interactive = !( defined $opt_config_dir || defined $opt_data_dir || defined $opt_disable_interactive || + defined $opt_distribution_label || defined $opt_gid || defined $opt_log_dir || defined $opt_manual_dir || @@ -178,6 +181,12 @@ if (defined $opt_socketengine) { } } +# If the user has specified a distribution label then we use it in +# place of the label from src/version.sh or Git. +if (defined $opt_distribution_label) { + $version{LABEL} = $opt_distribution_label; +} + if (defined $opt_system) { $config{BASE_DIR} = $opt_prefix || '/var/lib/inspircd'; $config{BINARY_DIR} = $opt_binary_dir || '/usr/sbin'; @@ -292,7 +301,7 @@ if (<src/modules/m_ssl_*.cpp> && prompt_bool $interactive, 'Would you like to ge } write_configure_cache %config if $interactive; -parse_templates \%config, \%compiler; +parse_templates \%config, \%compiler, \%version; print_format <<"EOM"; diff --git a/make/configure.pm b/make/configure.pm index 02e3a88c3..a5cb05c60 100644 --- a/make/configure.pm +++ b/make/configure.pm @@ -66,10 +66,10 @@ sub __get_socketengines { # TODO: when buildtool is done this can be mostly removed with # the remainder being merged into parse_templates. -sub __get_template_settings($$) { +sub __get_template_settings($$$) { # These are actually hash references - my ($config, $compiler) = @_; + my ($config, $compiler, $version) = @_; # Start off by populating with the config my %settings = %$config; @@ -80,8 +80,7 @@ sub __get_template_settings($$) { } # Version information - my %version = get_version(); - while (my ($key, $value) = each %version) { + while (my ($key, $value) = each %{$version}) { $settings{'VERSION_' . $key} = $value; } @@ -143,6 +142,8 @@ MISC OPTIONS --clean Remove the configuration cache file and start the interactive configuration wizard. --disable-interactive Disables the interactive configuration wizard. + --distribution-label=[text] Sets a distribution specific version label in + the build configuration. --gid=[id|name] Sets the group to run InspIRCd as. --help Show this message and exit. --socketengine=[name] Sets the socket engine to be used. Possible @@ -169,7 +170,8 @@ sub cmd_update { print "Updating...\n"; my %config = read_configure_cache(); my %compiler = get_compiler_info($config{CXX}); - parse_templates(\%config, \%compiler); + my %version = get_version(); + parse_templates(\%config, \%compiler, \%version); print "Update complete!\n"; exit 0; } @@ -263,13 +265,13 @@ sub get_property($$;$) return defined $default ? $default : ''; } -sub parse_templates($$) { +sub parse_templates($$$) { # These are actually hash references - my ($config, $compiler) = @_; + my ($config, $compiler, $version) = @_; # Collect settings to be used when generating files - my %settings = __get_template_settings($config, $compiler); + my %settings = __get_template_settings($config, $compiler, $version); # Iterate through files in make/template. foreach (<make/template/*>) { |