• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisione6c291944e1810aafe78250b8e60c843bc462f91 (tree)
Time2023-12-02 02:15:04
AuthorChristian Brabandt <cb@256b...>
CommiterChristian Brabandt

Log Message

CI: check that all files are listed in Filelist (#13601)

Commit: https://github.com/vim/vim/commit/9cc95aa0d8f52bb0c906ca13297ce3a2ba615f2b
Author: Peter Simonyi <the.peter.simonyi@gmail.com>
Date: Fri Dec 1 12:07:42 2023 -0500

CI: check that all files are listed in Filelist (https://github.com/vim/vim/issues/13601)
Sometimes patches add files that should be included in tarballs for
distribution, but are not added to Filelist (used by Makefile to build
the tar archive). This can break the build, or it can be silently
ignored as runtime files are simply not included in the distribution.
Add a CI check to ensure all files tracked in the repository are
assigned to a variable in Filelist. A few files were not listed because
they do not need to be included in builds and tarballs, so add an IGNORE
variable for these exceptions.
Co-authored-by: Peter Simonyi <pts@petersimonyi.ca>
Signed-off-by: Christian Brabandt <cb@256bit.org>

Change Summary

Incremental Difference

diff -r 58f24d966299 -r e6c291944e18 .github/workflows/ci.yml
--- a/.github/workflows/ci.yml Fri Dec 01 18:15:04 2023 +0100
+++ b/.github/workflows/ci.yml Fri Dec 01 18:15:04 2023 +0100
@@ -81,6 +81,12 @@
8181 - name: Checkout repository from github
8282 uses: actions/checkout@v4
8383
84+ - name: Check Filelist (for packaging)
85+ run: |
86+ # If any files in the repository are not listed in Filelist this will
87+ # exit with an error code and list the missing entries.
88+ make -f ci/unlisted.make
89+
8490 - run: sudo dpkg --add-architecture i386
8591 if: matrix.architecture == 'i386'
8692
diff -r 58f24d966299 -r e6c291944e18 Filelist
--- a/Filelist Fri Dec 01 18:15:04 2023 +0100
+++ b/Filelist Fri Dec 01 18:15:04 2023 +0100
@@ -213,6 +213,7 @@
213213 src/testdir/dumps/*.dump \
214214 src/testdir/dumps/*.vim \
215215 src/testdir/samples/*.txt \
216+ src/testdir/samples/*.vim \
216217 src/testdir/samples/test000 \
217218 src/testdir/color_ramp.vim \
218219 src/testdir/silent.wav \
@@ -1074,4 +1075,17 @@
10741075 src/po/*.mo \
10751076 runtime/lang/Make_mvc.mak \
10761077
1078+# Files in the repository that are deliberately not listed above, and will thus
1079+# be excluded from distribution tarballs and the like.
1080+# This excludes them from the CI check for unlisted files.
1081+IGNORE = \
1082+ .appveyor.yml \
1083+ .github/FUNDING.yml \
1084+ .github/labeler.yml \
1085+ .github/workflows/label.yml \
1086+ SECURITY.md \
1087+ ci/unlisted.make \
1088+ src/libvterm/CODE-MAP \
1089+ runtime/syntax/testdir/input/html_html \
1090+
10771091 # vim: set ft=make:
diff -r 58f24d966299 -r e6c291944e18 ci/unlisted.make
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ci/unlisted.make Fri Dec 01 18:15:04 2023 +0100
@@ -0,0 +1,49 @@
1+# vim: ft=make
2+SHELL = /bin/bash
3+
4+# List all files that are tracked in git but not listed in Filelist.
5+# Exit code is 2 ("Make encountered an error") if any such files exist.
6+
7+# Filelist is a Makefile that defines many variables, so we use Make itself to
8+# query which variables it defines, then expand them all by wrapping each name
9+# in $(...), importing Filelist and using $(eval).
10+
11+include Filelist
12+$(eval all_patterns := $(shell \
13+ make -f Filelist --question --print-data-base --no-builtin-rules \
14+ --no-builtin-variables 2>/dev/null \
15+ | sed -nre \
16+ '/^# makefile .from \x27Filelist\x27,/ { \
17+ n; \
18+ s/ = .*//; \
19+ T; \
20+ s/.*/$$(\0)/; \
21+ p; \
22+ }'))
23+
24+# In Makefile's `prepeare` target, all the IN_README_DIR files are moved from
25+# READMEdir to the root, so add those files in their Git-tracked location:
26+all_patterns := $(all_patterns) \
27+ $(foreach readme, $(IN_README_DIR), READMEdir/$(readme))
28+
29+# The result 'all_patterns' is a list of patterns (globs), which we expand with
30+# wildcard to get actual filenames. Note this means Filelist can list a file
31+# that does not exist, and it will be omitted at this step.
32+listed_files := $(wildcard $(all_patterns))
33+
34+# Default target to actually run the comparison:
35+.PHONY: check
36+check:
37+ @# There are too many files to list on the command line, so we write
38+ @# that to a temporary file, one per line.
39+ $(file > Filelist-listed-files)
40+ $(foreach filename, $(listed_files),\
41+ $(file >> Filelist-listed-files,$(filename)))
42+ @# Compare the sorted lists. Delete that temporary file on both
43+ @# success and failure, but exit with diff's exit code.
44+ diff -u0 --label files-in-git <(git ls-files | sort) \
45+ --label Filelist <(sort --unique Filelist-listed-files); \
46+ RV=$$?; \
47+ rm Filelist-listed-files; \
48+ (($$RV != 0)) && echo "Add files to the right variable in Filelist."; \
49+ exit $$RV
Show on old repository browser