Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Refactor the handling of .MAKE.META.IGNORE_* to...
details: https://anonhg.NetBSD.org/src/rev/ae5ccdfce19f
branches: trunk
changeset: 347196:ae5ccdfce19f
user: sjg <sjg%NetBSD.org@localhost>
date: Wed Aug 17 15:52:42 2016 +0000
description:
Refactor the handling of .MAKE.META.IGNORE_* to meta_ignore()
so that we can call it before adding paths to missingFiles.
Ie. do not track files we have been told to ignore.
diffstat:
usr.bin/make/meta.c | 119 +++++++++++++++++++++++++++++----------------------
1 files changed, 67 insertions(+), 52 deletions(-)
diffs (148 lines):
diff -r a1590aa3df04 -r ae5ccdfce19f usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Wed Aug 17 12:10:42 2016 +0000
+++ b/usr.bin/make/meta.c Wed Aug 17 15:52:42 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.66 2016/08/15 19:20:17 sjg Exp $ */
+/* $NetBSD: meta.c,v 1.67 2016/08/17 15:52:42 sjg Exp $ */
/*
* Implement 'meta' mode.
@@ -921,6 +921,67 @@
}
+static int
+meta_ignore(GNode *gn, const char *p)
+{
+ char fname[MAXPATHLEN];
+
+ if (p == NULL)
+ return TRUE;
+
+ if (*p == '/') {
+ cached_realpath(p, fname); /* clean it up */
+ if (Lst_ForEach(metaIgnorePaths, prefix_match, fname)) {
+#ifdef DEBUG_META_MODE
+ if (DEBUG(META))
+ fprintf(debug_file, "meta_oodate: ignoring path: %s\n",
+ p);
+#endif
+ return TRUE;
+ }
+ }
+
+ if (metaIgnorePatterns) {
+ char *pm;
+
+ snprintf(fname, sizeof(fname),
+ "${%s:@m@${%s:L:M$m}@}",
+ MAKE_META_IGNORE_PATTERNS, p);
+ pm = Var_Subst(NULL, fname, 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);
+ return TRUE;
+ }
+ free(pm);
+ }
+
+ if (metaIgnoreFilter) {
+ char *fm;
+
+ /* skip if filter result is empty */
+ snprintf(fname, sizeof(fname),
+ "${%s:L:${%s:ts:}}",
+ p, MAKE_META_IGNORE_FILTER);
+ fm = Var_Subst(NULL, fname, gn, VARF_WANTRES);
+ if (*fm == '\0') {
+#ifdef DEBUG_META_MODE
+ if (DEBUG(META))
+ fprintf(debug_file, "meta_oodate: ignoring filtered: %s\n",
+ p);
+#endif
+ free(fm);
+ return TRUE;
+ }
+ free(fm);
+ }
+ return FALSE;
+}
+
/*
* When running with 'meta' functionality, a target can be out-of-date
* if any of the references in its meta data file is more recent.
@@ -1279,8 +1340,10 @@
if ((link_src != NULL && cached_lstat(p, &fs) < 0) ||
(link_src == NULL && cached_stat(p, &fs) < 0)) {
- if (Lst_Find(missingFiles, p, string_match) == NULL)
+ if (!meta_ignore(gn, p)) {
+ if (Lst_Find(missingFiles, p, string_match) == NULL)
Lst_AtEnd(missingFiles, bmake_strdup(p));
+ }
}
break;
check_link_src:
@@ -1298,56 +1361,8 @@
* be part of the dependencies because
* they are _expected_ to change.
*/
- if (*p == '/') {
- cached_realpath(p, fname1); /* clean it up */
- if (Lst_ForEach(metaIgnorePaths, prefix_match, fname1)) {
-#ifdef DEBUG_META_MODE
- if (DEBUG(META))
- 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);
- }
-
- if (metaIgnoreFilter) {
- char *fm;
-
- /* skip if filter result is empty */
- snprintf(fname1, sizeof(fname1),
- "${%s:L:${%s:ts:}}",
- p, MAKE_META_IGNORE_FILTER);
- fm = Var_Subst(NULL, fname1, gn, VARF_WANTRES);
- if (*fm == '\0') {
-#ifdef DEBUG_META_MODE
- if (DEBUG(META))
- fprintf(debug_file, "meta_oodate: ignoring filtered: %s\n",
- p);
-#endif
- free(fm);
- break;
- }
- free(fm);
- }
+ if (meta_ignore(gn, p))
+ break;
/*
* The rest of the record is the file name.
Home |
Main Index |
Thread Index |
Old Index