summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-12-09 04:53:41 +0000
committerfukachan <fukachan>2004-12-09 04:53:41 +0000
commit30a1ad5db27e6d165e17ff1d72ad709c5756ba7b (patch)
tree9bdc6af64f5ccd724669b5634687fb44cd94b01f
parent81e4f2d7bfaa529fe5ca4a3149c69bae5173783e (diff)
downloadfml8-30a1ad5db27e6d165e17ff1d72ad709c5756ba7b.tar.gz
fml8-30a1ad5db27e6d165e17ff1d72ad709c5756ba7b.tar.bz2
fml8-30a1ad5db27e6d165e17ff1d72ad709c5756ba7b.zip
run fallback to generate config.cf when config.ph is newer than config.cf
-rw-r--r--fml/lib/FML/Process/Emulate.pm19
-rw-r--r--fml/lib/FML/Process/Kernel.pm9
2 files changed, 19 insertions, 9 deletions
diff --git a/fml/lib/FML/Process/Emulate.pm b/fml/lib/FML/Process/Emulate.pm
index efb53ebd..2e7fd7e3 100644
--- a/fml/lib/FML/Process/Emulate.pm
+++ b/fml/lib/FML/Process/Emulate.pm
@@ -3,7 +3,7 @@
# Copyright (C) 2004 Ken'ichi Fukamachi
# All rights reserved.
#
-# $FML: Emulate.pm,v 1.2 2004/11/23 13:36:59 fukachan Exp $
+# $FML: Emulate.pm,v 1.3 2004/11/25 12:25:56 fukachan Exp $
#
package FML::Process::Emulate;
@@ -193,15 +193,17 @@ sub generate_config_cf_from_config_ph
my $config_ph_path = $fallback_args->{ config_cf_path };
$config_ph_path =~ s/config.cf/config.ph/;
- if (-f $config_ph_path && -f $config_cf_path) {
- # OK, DO NOTHING.
- }
- elsif (! -f $config_ph_path && -f $config_cf_path) {
+ use File::stat;
+ my $stat_ph = stat($config_ph_path);
+ my $stat_cf = stat($config_cf_path);
+ if (! -f $config_ph_path && -f $config_cf_path) {
# fml8 normal case.
# OK, DO NOTHING.
}
- elsif (-f $config_ph_path && ! -f $config_cf_path) {
+ elsif (($stat_ph->mtime > $stat_cf->mtime) ||
+ (-f $config_ph_path && ! -f $config_cf_path)) {
# fml4 -> fml8 case (config.ph -> config.cf).
+ $curproc->log("generate config.cf from config.ph");
use File::Basename;
my $ml_home_dir = dirname($config_cf_path);
my $params = {
@@ -211,6 +213,9 @@ sub generate_config_cf_from_config_ph
};
$curproc->_fml4_merge($params);
}
+ elsif (-f $config_ph_path && -f $config_cf_path) {
+ # OK, DO NOTHING.
+ }
else {
;
}
@@ -240,7 +245,7 @@ sub _fml4_merge
# 3. run newml --force.
use FML::ML::Control;
my $control = new FML::ML::Control;
- $control->install_template_files($curproc, {}, $params);
+ $control->install_config_cf($curproc, {}, $params);
# 4. convert files if needed.
$merge->convert_list_files();
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm
index 1ec400f9..f5f8ea7e 100644
--- a/fml/lib/FML/Process/Kernel.pm
+++ b/fml/lib/FML/Process/Kernel.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Kernel.pm,v 1.244 2004/11/30 04:14:59 fukachan Exp $
+# $FML: Kernel.pm,v 1.245 2004/12/05 16:19:10 fukachan Exp $
#
package FML::Process::Kernel;
@@ -822,7 +822,12 @@ sub resolve_ml_specific_variables
# we try to fallback something when config.cf not exists.
# Example: when fml.pl firstly runs without config.cf (fml8) file,
# fml.pl should generate config.cf and continue to run.
- unless (-f $config_cf_path) {
+ my $config_ph_path = $config_cf_path;
+ $config_ph_path =~ s/config.cf/config.ph/;
+ use File::stat;
+ my $stat_ph = stat($config_ph_path);
+ my $stat_cf = stat($config_cf_path);
+ if ((! -f $config_cf_path) || ($stat_ph->mtime > $stat_cf->mtime)) {
my $fallback = $resolver_args->{ fallback } || undef;
my $fallback_args = {
config_cf_path => $config_cf_path,