summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2018-10-31 13:02:29 -0700
committerDale Curtis <dalecurtis@chromium.org>2018-10-31 13:02:29 -0700
commit3c16ae0099239e01503493e9be6a2db0f5fbc582 (patch)
treefe1773aad77b7b0441568931c8e952d6ea94493e
parentbfa1ed0ae9cb15b54b008431d122db3c22cd45eb (diff)
downloadnasm-3c16ae0099239e01503493e9be6a2db0f5fbc582.tar.gz
Update .gitignore not to ignore generated files Chrome needs.
By default any file generated by "make perlreq" is hidden by the .gitignore. This may require ongoing maintanence, so a PRESUBMIT has been added to prevent future regressions. This is the first of the commits preparing NASM for use in Chrome. BUG=766721 TEST=none Change-Id: Ib6cae0b2e6ad0420185a01497e2184c094cc105e
-rw-r--r--.gitignore23
-rw-r--r--PRESUBMIT.py31
2 files changed, 31 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index c2f323f7..4d89041d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,15 +39,7 @@ tags
TAGS
/*.1
/Makefile
-/asm/directbl.c
-/asm/directbl.h
-/asm/directiv.h
-/asm/pptok.c
-/asm/pptok.h
/asm/pptok.ph
-/asm/tokens.h
-/asm/tokhash.c
-/config/config.h
/config/config.h.in
/config.log
/config.status
@@ -65,7 +57,6 @@ TAGS
/doc/info
/doc/inslist.src
/doc/version.src
-/macros/macros.c
/misc/omfdump
/nasm
/ndisasm
@@ -85,21 +76,7 @@ TAGS
/test/golden
/test/perf/*.asm
/test/testresults
-/version.h
/version.mac
/version.mak
/version.sed
-/x86/iflag.c
-/x86/iflaggen.h
-/x86/insnsa.c
-/x86/insnsb.c
-/x86/insnsd.c
-/x86/insnsi.h
-/x86/insnsn.c
-/x86/regdis.c
-/x86/regdis.h
-/x86/regflags.c
-/x86/regs.c
-/x86/regs.h
-/x86/regvals.c
/patches/
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
new file mode 100644
index 00000000..bcf853c2
--- /dev/null
+++ b/PRESUBMIT.py
@@ -0,0 +1,31 @@
+# Copyright 2018 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""Presubmit script for nasm repository."""
+
+
+def _WarnIfGitIgnoreHasSources(input_api, output_api):
+ """Warn if .gitignore has source files in it."""
+ for f in input_api.AffectedFiles():
+ if f.LocalPath().endswith('.gitignore'):
+ with open(f.LocalPath(), 'r') as f:
+ lines = f.readlines()
+
+ bad_lines = [l.strip() for l in lines if l.strip().endswith(('.c', '.h'))]
+ if not bad_lines:
+ break
+
+ return [
+ output_api.PresubmitError('\n'.join([
+ '.gitignore contains source files which may be needed for building, ',
+ 'please remove the .gitignore entries for the following lines:',
+ '\n ' + ' \n'.join(bad_lines)
+ ]))
+ ]
+ return []
+
+
+def CheckChangeOnUpload(input_api, output_api):
+ results = []
+ results.extend(_WarnIfGitIgnoreHasSources(input_api, output_api))
+ return results