mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Rename read_configure_cache to read_config_file and move to common.
This commit is contained in:
parent
ec4c5f0bb6
commit
64273cc51b
3
configure
vendored
3
configure
vendored
@ -3,6 +3,7 @@
|
||||
#
|
||||
# InspIRCd -- Internet Relay Chat Daemon
|
||||
#
|
||||
# Copyright (C) 2012-2017 Peter Powell <petpow@saberuk.com>
|
||||
# Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
|
||||
# Copyright (C) 2007, 2009 Dennis Friis <peavey@inspircd.org>
|
||||
# Copyright (C) 2003, 2006-2008 Craig Edwards <craigedwards@brainbox.cc>
|
||||
@ -131,7 +132,7 @@ print_format "<|BOLD Configuring InspIRCd $version{FULL} on $^O.|>\n";
|
||||
|
||||
our %config;
|
||||
if ($interactive) {
|
||||
%config = read_configure_cache();
|
||||
%config = read_config_file(CONFIGURE_CACHE_FILE);
|
||||
run_test CONFIGURE_CACHE_FILE, %config;
|
||||
if (!defined $config{VERSION}) {
|
||||
$config{VERSION} = CONFIGURE_CACHE_VERSION;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# InspIRCd -- Internet Relay Chat Daemon
|
||||
#
|
||||
# Copyright (C) 2013-2014 Peter Powell <petpow@saberuk.com>
|
||||
# Copyright (C) 2013-2017 Peter Powell <petpow@saberuk.com>
|
||||
#
|
||||
# This file is part of InspIRCd. InspIRCd is free software: you can
|
||||
# redistribute it and/or modify it under the terms of the GNU General Public
|
||||
@ -34,6 +34,7 @@ use File::Spec::Functions qw(rel2abs);
|
||||
our @EXPORT = qw(create_directory
|
||||
get_cpu_count
|
||||
get_version
|
||||
read_config_file
|
||||
module_installed);
|
||||
|
||||
sub create_directory($$) {
|
||||
@ -107,4 +108,17 @@ sub get_cpu_count {
|
||||
return $count;
|
||||
}
|
||||
|
||||
sub read_config_file($) {
|
||||
my $path = shift;
|
||||
my %config;
|
||||
open(my $fh, $path) or return %config;
|
||||
while (my $line = <$fh>) {
|
||||
next if $line =~ /^\s*($|\#)/;
|
||||
my ($key, $value) = ($line =~ /^(\S+)(?:\s(.*))?$/);
|
||||
$config{$key} = $value;
|
||||
}
|
||||
close $fh;
|
||||
return %config;
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# InspIRCd -- Internet Relay Chat Daemon
|
||||
#
|
||||
# Copyright (C) 2012-2014 Peter Powell <petpow@saberuk.com>
|
||||
# Copyright (C) 2012-2017 Peter Powell <petpow@saberuk.com>
|
||||
# Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
|
||||
# Copyright (C) 2007-2008 Craig Edwards <craigedwards@brainbox.cc>
|
||||
# Copyright (C) 2008 Thomas Stagner <aquanight@inspircd.org>
|
||||
@ -52,7 +52,6 @@ our @EXPORT = qw(CONFIGURE_CACHE_FILE
|
||||
run_test
|
||||
test_file
|
||||
test_header
|
||||
read_configure_cache
|
||||
write_configure_cache
|
||||
get_compiler_info
|
||||
find_compiler
|
||||
@ -180,7 +179,7 @@ EOH
|
||||
sub cmd_update {
|
||||
print_error "You have not run $0 before. Please do this before trying to update the generated files." unless -f CONFIGURE_CACHE_FILE;
|
||||
say 'Updating...';
|
||||
my %config = read_configure_cache();
|
||||
my %config = read_config_file(CONFIGURE_CACHE_FILE);
|
||||
my %compiler = get_compiler_info($config{CXX});
|
||||
my %version = get_version $config{DISTRIBUTION};
|
||||
parse_templates(\%config, \%compiler, \%version);
|
||||
@ -215,18 +214,6 @@ sub test_header($$;$) {
|
||||
return !$?;
|
||||
}
|
||||
|
||||
sub read_configure_cache {
|
||||
my %config;
|
||||
open(CACHE, CONFIGURE_CACHE_FILE) or return %config;
|
||||
while (my $line = <CACHE>) {
|
||||
next if $line =~ /^\s*($|\#)/;
|
||||
my ($key, $value) = ($line =~ /^(\S+)(?:\s(.*))?$/);
|
||||
$config{$key} = $value;
|
||||
}
|
||||
close(CACHE);
|
||||
return %config;
|
||||
}
|
||||
|
||||
sub write_configure_cache(%) {
|
||||
unless (-e CONFIGURE_DIRECTORY) {
|
||||
print_format "Creating <|GREEN ${\CONFIGURE_DIRECTORY}|> ...\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user