[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 6/8] automake: refactor, break up 'require_file_internal'
From: |
Stefano Lattarini |
Subject: |
Re: [PATCH 6/8] automake: refactor, break up 'require_file_internal' |
Date: |
Tue, 11 Oct 2011 11:28:36 +0200 |
User-agent: |
KMail/1.13.7 (Linux/2.6.30-2-686; KDE/4.6.5; i686; ; ) |
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 <address@hidden>
AuthorDate: Fri Oct 7 21:58:20 2011 +0200
Commit: Stefano Lattarini <address@hidden>
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 <address@hidden>
+ 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 <address@hidden>
+
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);
}
}
- [PATCH 0/8] Reorganize automake internals for distribution tarball creation, Stefano Lattarini, 2011/10/09
- [PATCH 4/8] refactor: rename a subroutine to a more proper name, Stefano Lattarini, 2011/10/09
- [PATCH 2/8] dist: simplify automake code accordingly to the previous changes, Stefano Lattarini, 2011/10/09
- [PATCH 3/8] dist: truly always distribute files in AC_REQUIRE_AUX_FILE, Stefano Lattarini, 2011/10/09
- [PATCH 1/8] dist: auxiliary files can be distributed from subdir Makefiles, Stefano Lattarini, 2011/10/09
- [PATCH 5/8] dist: separate auxiliary file instantiation from DIST_COMMON update, Stefano Lattarini, 2011/10/09
- [PATCH 8/8] tests: fix spurious failure with Solaris /bin/sh, Stefano Lattarini, 2011/10/09
- [PATCH 7/8] threaded-am: better serialization for required config files, Stefano Lattarini, 2011/10/09
- [PATCH 6/8] automake: refactor, break up 'require_file_internal', Stefano Lattarini, 2011/10/09
- Re: [PATCH 6/8] automake: refactor, break up 'require_file_internal',
Stefano Lattarini <=
- Re: [PATCH 0/8] Reorganize automake internals for distribution tarball creation, Stefano Lattarini, 2011/10/12
- [FYI 9/8] {dist-refactor} cosmetics: remove obsolete comment, Stefano Lattarini, 2011/10/17