On Sunday 09 October 2011, Stefano Lattarini wrote:
> This refactoring is only required in view of future changes.
> 
> * automake.in (require_file_internal): Move the guts of this
> function ...
> (required_file_check_or_copy): ... into this new function.  This
> ensures that calls to `push_required_file' and code that copies
> required files are placed in separate functions; this will be
> very useful for reorganizing de-serialization of file installs
> in future changes.
> ---
>
This change is much clearer when visualized with the `-w' option
of "git log" (thus ignoring whitespace changes).  Sorry for not
thinking of posting such a better diff right away; I'm making up
for it now (see attached patch).

Regards,
  Stefano
commit 75ce360ef4fde820ba6f1f974c6a1a9911b68461
Author:     Stefano Lattarini <[email protected]>
AuthorDate: Fri Oct 7 21:58:20 2011 +0200
Commit:     Stefano Lattarini <[email protected]>
CommitDate: Sat Oct 8 21:44:24 2011 +0200

    automake: refactor, break up 'require_file_internal'
    
    This refactoring is only required in view of future changes.
    
    * automake.in (require_file_internal): Move the guts of this
    function ...
    (required_file_check_or_copy): ... into this new function.  This
    ensures that calls to `push_required_file' and code that copies
    required files are placed in separate functions; this will be
    very useful for reorganizing de-serialization of file installs
    in future changes.

diff --git a/ChangeLog b/ChangeLog
index 3660fbb..299738f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2011-10-08  Stefano Lattarini  <[email protected]>
 
+	automake: refactor, break up 'require_file_internal'
+	This refactoring is only required in view of future changes.
+	* automake.in (require_file_internal): Move the guts of this
+	function ...
+	(required_file_check_or_copy): ... into this new function.  This
+	ensures that calls to `push_required_file' and code that copies
+	required files are placed in separate functions; this will be
+	very useful for reorganizing de-serialization of file installs
+	in future changes.
+
+2011-10-08  Stefano Lattarini  <[email protected]>
+
 	dist: separate auxiliary file instantiation from DIST_COMMON update
 	This change simplifies the automake internals dealing with the
 	checking, copying and distributing of required auxiliary files.
diff --git a/automake.in b/automake.in
index 9d51b8d..d75bc0b 100644
--- a/automake.in
+++ b/automake.in
@@ -7666,25 +7666,17 @@ sub push_required_file
 # than once.
 my %required_file_not_found = ();
 
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
-# --------------------------------------------------------------
+# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# --------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
-# $MYSTRICT is the strictness level at which this file becomes required.
-sub require_file_internal ($$$@)
-{
-  my ($where, $mystrict, $dir, @files) = @_;
-
-  foreach my $file (@files)
+sub required_file_check_or_copy ($$$)
     {
-      next
-        unless $strictness >= $mystrict;
+  my ($where, $dir, $file) = @_;
 
       my $fullfile = "$dir/$file";
       my $found_it = 0;
       my $dangling_sym = 0;
 
-      push_required_file ($dir, $file, $fullfile);
-
       if (-l $fullfile && ! -f $fullfile)
 	{
 	  $dangling_sym = 1;
@@ -7696,12 +7688,9 @@ sub require_file_internal ($$$@)
 
       # `--force-missing' only has an effect if `--add-missing' is
       # specified.
-      if ($found_it && (! $add_missing || ! $force_missing))
-	{
-	  next;
-	}
-      else
-	{
+  return
+    if $found_it && (! $add_missing || ! $force_missing);
+
 	  # If we've already looked for it, we're done.  You might
 	  # wonder why we don't do this before searching for the
 	  # file.  If we do that, then something like
@@ -7709,10 +7698,9 @@ sub require_file_internal ($$$@)
 	  # DIST_COMMON.
 	  if (! $found_it)
 	    {
-	      next if defined $required_file_not_found{$fullfile};
+      return if defined $required_file_not_found{$fullfile};
 	      $required_file_not_found{$fullfile} = 1;
 	    }
-          # FIXME: re-indent this correctly
 	      if ($dangling_sym && $add_missing)
 		{
 		  unlink ($fullfile);
@@ -7774,17 +7762,34 @@ sub require_file_internal ($$$@)
 
 	      # If --force-missing was specified, and we have
 	      # actually found the file, then do nothing.
-	      next
+  return
 		if $found_it && $force_missing;
 
 	      # If we couldn't install the file, but it is a target in
 	      # the Makefile, don't print anything.  This allows files
 	      # like README, AUTHORS, or THANKS to be generated.
-	      next
+  return
 		if !$suppress && rule $file;
 
 	      msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
 	}
+
+
+# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
+# --------------------------------------------------------------
+# Verify that the file must exist in $DIRECTORY, or install it.
+# $MYSTRICT is the strictness level at which this file becomes required.
+sub require_file_internal ($$$@)
+{
+  my ($where, $mystrict, $dir, @files) = @_;
+
+  return
+    unless $strictness >= $mystrict;
+
+  foreach my $file (@files)
+    {
+      push_required_file ($dir, $file, "$dir/$file");
+      required_file_check_or_copy ($where, $dir, $file);
     }
 }
 

Reply via email to