Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Allow for ignoring paths that match a set of pa...



details:   https://anonhg.NetBSD.org/src/rev/2f4e450a4739
branches:  trunk
changeset: 345160:2f4e450a4739
user:      sjg <sjg%NetBSD.org@localhost>
date:      Tue May 10 23:45:45 2016 +0000

description:
Allow for ignoring paths that match a set of patterns.
This can be expensive, so use with caution.

diffstat:

 usr.bin/make/make.1 |   7 +++++--
 usr.bin/make/meta.c |  36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 39 insertions(+), 4 deletions(-)

diffs (105 lines):

diff -r 5e9c92638738 -r 2f4e450a4739 usr.bin/make/make.1
--- a/usr.bin/make/make.1       Tue May 10 21:15:54 2016 +0000
+++ b/usr.bin/make/make.1       Tue May 10 23:45:45 2016 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: make.1,v 1.256 2016/03/16 00:19:01 sjg Exp $
+.\"    $NetBSD: make.1,v 1.257 2016/05/10 23:45:45 sjg Exp $
 .\"
 .\" Copyright (c) 1990, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"    from: @(#)make.1        8.4 (Berkeley) 3/19/94
 .\"
-.Dd February 19, 2016
+.Dd May 10, 2016
 .Dt MAKE 1
 .Os
 .Sh NAME
@@ -913,6 +913,9 @@
 because the contents are expected to change over time.
 The default list includes:
 .Ql Pa /dev /etc /proc /tmp /var/run /var/tmp
+.It Va .MAKE.META.IGNORE_PATTERNS
+Provides a list of patterns to match against pathnames.
+Ignore any that match.
 .It Va .MAKE.META.PREFIX
 Defines the message printed for each meta file updated in "meta verbose" mode.
 The default value is:
diff -r 5e9c92638738 -r 2f4e450a4739 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c       Tue May 10 21:15:54 2016 +0000
+++ b/usr.bin/make/meta.c       Tue May 10 23:45:45 2016 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: meta.c,v 1.55 2016/05/10 00:02:31 sjg Exp $ */
+/*      $NetBSD: meta.c,v 1.56 2016/05/10 23:45:45 sjg Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -62,6 +62,9 @@
 #ifndef MAKE_META_IGNORE_PATHS
 #define MAKE_META_IGNORE_PATHS ".MAKE.META.IGNORE_PATHS"
 #endif
+#ifndef MAKE_META_IGNORE_PATTERNS
+#define MAKE_META_IGNORE_PATTERNS ".MAKE.META.IGNORE_PATTERNS"
+#endif
 
 Boolean useMeta = FALSE;
 static Boolean useFilemon = FALSE;
@@ -69,6 +72,7 @@
 static Boolean metaEnv = FALSE;                /* don't save env unless asked */
 static Boolean metaVerbose = FALSE;
 static Boolean metaIgnoreCMDs = FALSE; /* ignore CMDs in .meta files */
+static Boolean metaIgnorePatterns = FALSE; /* do we need to do pattern matches */
 static Boolean metaCurdirOk = FALSE;   /* write .meta in .CURDIR Ok? */
 static Boolean metaSilent = FALSE;     /* if we have a .meta be SILENT */
 
@@ -616,6 +620,15 @@
     if (metaIgnorePathsStr) {
        str2Lst_Append(metaIgnorePaths, metaIgnorePathsStr, NULL);
     }
+
+    /*
+     * We ignore any paths that match ${.MAKE.META.IGNORE_PATTERNS}
+     */
+    cp = NULL;
+    if (Var_Value(MAKE_META_IGNORE_PATTERNS, VAR_GLOBAL, &cp)) {
+       metaIgnorePatterns = TRUE;
+       free(cp);
+    }
 }
 
 /*
@@ -1210,13 +1223,32 @@
                        if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
 #ifdef DEBUG_META_MODE
                            if (DEBUG(META))
-                               fprintf(debug_file, "meta_oodate: ignoring: %s\n",
+                               fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
                                        p);
 #endif
                            break;
                        }
                    }
 
+                   if (metaIgnorePatterns) {
+                       char *pm;
+
+                       snprintf(fname1, sizeof(fname1),
+                                "${%s:@m@${%s:L:M$m}@}",
+                                MAKE_META_IGNORE_PATTERNS, p);
+                       pm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
+                       if (*pm) {
+#ifdef DEBUG_META_MODE
+                           if (DEBUG(META))
+                               fprintf(debug_file, "meta_oodate: ignoring pattern: %s\n",
+                                       p);
+#endif
+                           free(pm);
+                           break;
+                       }
+                       free(pm);
+                   }
+
                    /*
                     * The rest of the record is the file name.
                     * Check if it's not an absolute path.



Home | Main Index | Thread Index | Old Index